mirror of
https://github.com/openjdk/jdk9u.git
synced 2025-12-10 15:25:05 -06:00
Merge
This commit is contained in:
commit
d9188809d8
@ -417,9 +417,40 @@ b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169
|
||||
2c25fc24103251f9711a1c280c31e1e41016d90f jdk-9+172
|
||||
88d7fd969e7df0e07a53b201cfd29393ca33ede9 jdk-9+173
|
||||
5466f409346e0446ee9a6daeb7f5d75c8fc76823 jdk-9+174
|
||||
023f93e511bae768203c33bb8681f82ee75014da jdk-9.0.1+00
|
||||
023f93e511bae768203c33bb8681f82ee75014da jdk-9.0.3+00
|
||||
8f7227c6012b0051ea4e0bcee040c627bf699b88 jdk-9+175
|
||||
84777531d994ef70163d35078ec9c4127f2eadb5 jdk-9+176
|
||||
a4371edb589c60db01142e45c317adb9ccbcb083 jdk-9+177
|
||||
ec4159ebe7050fcc5dcee8a2d150cf948ecc97db jdk-9+178
|
||||
252475ccfd84cc249f8d6faf4b7806b5e2c384ce jdk-9+179
|
||||
d2982a786f53814367698e63efe6349c9128e1db jdk-9+180
|
||||
b656dea9398ef601f7fc08d1a5157a560e0ccbe0 jdk-9+181
|
||||
d73368c690d4f1ab188cf306f4b27218e28596b6 jdk-9.0.3+1
|
||||
ede48839f34b0b74210e2e081872a3c12d5339ab jdk-9.0.3+2
|
||||
086e9950ebfa8a0239018ade61f59b7c539bacc9 jdk-9.0.3+3
|
||||
2c95bee2722f2396b709b384473c07291a7d1e4b jdk-9.0.3+4
|
||||
d24281b60e0bb6d441ec3a9440e7daa322bbc822 jdk-9.0.3+5
|
||||
489c57f8e1c0f6fa34de86f8ed8f98a809cba4a9 jdk-9.0.3+6
|
||||
9d5aca497123931d52625b3539a8549d98728622 jdk-9.0.3+7
|
||||
eaa4ea516c7f1e31c8e0faaec3ef981eb2919ae3 jdk-9.0.3+8
|
||||
a31dfd85bee9c16aac1e65dfbe81d1c5fe443c2c jdk-9.0.3+9
|
||||
9acb1002f33e257e932a188632969e45cc32e66c jdk-9.0.1+10
|
||||
9acb1002f33e257e932a188632969e45cc32e66c jdk-9.0.1+10
|
||||
0000000000000000000000000000000000000000 jdk-9.0.1+10
|
||||
0000000000000000000000000000000000000000 jdk-9.0.1+10
|
||||
5a9191c980ca3ada63b234e2b9ec6dc23bd37595 jdk-9.0.1+10
|
||||
e6edc89f5b2dc6dacd6041305e942a3f04a25ce5 jdk-9.0.1+11
|
||||
3a64fdb24a8c26e2d7d32864dad4425a9496b90d jdk-9.0.4+00
|
||||
726bf8524f7d3780518ada8648488ad4a7bfe6a2 jdk-9.0.4+1
|
||||
8055b6778ac8fc6bb165082230951cc8f146f8fd jdk-9.0.4+2
|
||||
572ea0db1d87a1d2fcc01f73ffbcfb78bd5688f4 jdk-9.0.4+3
|
||||
0053ace2e9e484fb52d00ec961e24805d0aae04a jdk-9.0.4+4
|
||||
73d63ccf56f46f258f367ed72633f0f5cc229680 jdk-9.0.4+5
|
||||
86219e4c9f8cd730bacd2f6080b6ac1dea7a0226 jdk-9.0.4+6
|
||||
9aba57f3071362ed7f2326d737506863b9d2646f jdk-9.0.4+7
|
||||
a4f0515fe6da55cfe74dec3e6e30b69c9693d133 jdk-9.0.4+8
|
||||
a4f0515fe6da55cfe74dec3e6e30b69c9693d133 jdk-9.0.4+8
|
||||
0000000000000000000000000000000000000000 jdk-9.0.4+8
|
||||
0000000000000000000000000000000000000000 jdk-9.0.4+8
|
||||
953d306b203e7d0808cb842a51e006fddc41b6c2 jdk-9.0.4+8
|
||||
|
||||
@ -1 +1,2 @@
|
||||
project=jdk9
|
||||
bugids=dup
|
||||
|
||||
@ -1090,10 +1090,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
|
||||
# We can build without it.
|
||||
LDD="true"
|
||||
fi
|
||||
BASIC_PATH_PROGS(OTOOL, otool)
|
||||
if test "x$OTOOL" = "x"; then
|
||||
OTOOL="true"
|
||||
fi
|
||||
BASIC_PATH_PROGS(READELF, [greadelf readelf])
|
||||
BASIC_PATH_PROGS(DOT, dot)
|
||||
BASIC_PATH_PROGS(HG, hg)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -443,20 +443,31 @@ AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
|
||||
fi
|
||||
AC_MSG_RESULT([$BUNDLE_FREETYPE])
|
||||
|
||||
fi # end freetype needed
|
||||
|
||||
FREETYPE_LICENSE=""
|
||||
if test "x$with_freetype_license" = "xyes"; then
|
||||
AC_MSG_ERROR([--with-freetype-license must have a value])
|
||||
elif test "x$with_freetype_license" != "x"; then
|
||||
AC_MSG_CHECKING([for freetype license])
|
||||
AC_MSG_RESULT([$with_freetype_license])
|
||||
FREETYPE_LICENSE="$with_freetype_license"
|
||||
BASIC_FIXUP_PATH(FREETYPE_LICENSE)
|
||||
if test ! -f "$FREETYPE_LICENSE"; then
|
||||
AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found])
|
||||
if test "x$BUNDLE_FREETYPE" = xyes; then
|
||||
FREETYPE_LICENSE=""
|
||||
AC_MSG_CHECKING([for freetype license])
|
||||
if test "x$with_freetype_license" = "xyes"; then
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([--with-freetype-license must have a value])
|
||||
elif test "x$with_freetype_license" != "x"; then
|
||||
AC_MSG_RESULT([$with_freetype_license])
|
||||
FREETYPE_LICENSE="$with_freetype_license"
|
||||
BASIC_FIXUP_PATH(FREETYPE_LICENSE)
|
||||
if test ! -f "$FREETYPE_LICENSE"; then
|
||||
AC_MSG_ERROR([$FREETYPE_LICENSE cannot be found])
|
||||
fi
|
||||
else
|
||||
if test "x$with_freetype" != "x" && test -f $with_freetype/freetype.md; then
|
||||
FREETYPE_LICENSE="$with_freetype/freetype.md"
|
||||
AC_MSG_RESULT([$FREETYPE_LICENSE])
|
||||
BASIC_FIXUP_PATH(FREETYPE_LICENSE)
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
fi # end freetype needed
|
||||
|
||||
AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
|
||||
AC_SUBST(FREETYPE_CFLAGS)
|
||||
|
||||
@ -483,6 +483,7 @@ GNM:=@GNM@
|
||||
STRIP:=@STRIP@
|
||||
|
||||
LIPO:=@LIPO@
|
||||
INSTALL_NAME_TOOL:=@INSTALL_NAME_TOOL@
|
||||
|
||||
# Options to linker to specify a mapfile.
|
||||
# (Note absence of := assignment, because we do not want to evaluate the macro body here)
|
||||
|
||||
@ -628,6 +628,10 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
||||
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
|
||||
BASIC_PATH_PROGS(LIPO, lipo)
|
||||
BASIC_FIXUP_EXECUTABLE(LIPO)
|
||||
BASIC_REQUIRE_PROGS(OTOOL, otool)
|
||||
BASIC_FIXUP_EXECUTABLE(OTOOL)
|
||||
BASIC_REQUIRE_PROGS(INSTALL_NAME_TOOL, install_name_tool)
|
||||
BASIC_FIXUP_EXECUTABLE(INSTALL_NAME_TOOL)
|
||||
fi
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 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
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
DEFAULT_VERSION_MAJOR=9
|
||||
DEFAULT_VERSION_MINOR=0
|
||||
DEFAULT_VERSION_SECURITY=0
|
||||
DEFAULT_VERSION_SECURITY=4
|
||||
DEFAULT_VERSION_PATCH=0
|
||||
|
||||
LAUNCHER_NAME=openjdk
|
||||
|
||||
@ -387,7 +387,7 @@ var getJibProfilesCommon = function (input, data) {
|
||||
// on such hardware.
|
||||
if (input.build_cpu == "sparcv9") {
|
||||
var cpu_brand = $EXEC("bash -c \"kstat -m cpu_info | grep brand | head -n1 | awk '{ print \$2 }'\"");
|
||||
if (cpu_brand.trim().match('SPARC-.7')) {
|
||||
if (cpu_brand.trim().match('SPARC-.[78]')) {
|
||||
boot_jdk_revision = "8u20";
|
||||
boot_jdk_subdirpart = "1.8.0_20";
|
||||
}
|
||||
@ -435,7 +435,7 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
"macosx-x64": {
|
||||
target_os: "macosx",
|
||||
target_cpu: "x64",
|
||||
dependencies: ["devkit"],
|
||||
dependencies: ["devkit", "freetype"],
|
||||
configure_args: concat(common.configure_args_64bit, "--with-zlib=system"),
|
||||
},
|
||||
|
||||
@ -728,9 +728,9 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
jdk: {
|
||||
local: "bundles/\\(jdk.*bin.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/linux-x64/jdk-" + data.version
|
||||
"bundles/openjdk/GPL/linux-x64/openjdk-" + data.version
|
||||
+ "_linux-x64_bin.tar.gz",
|
||||
"bundles/openjdk/GPL/linux-x64/\\1"
|
||||
"bundles/openjdk/GPL/linux-x64/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
@ -741,17 +741,17 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
test: {
|
||||
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/linux-x64/jdk-" + data.version
|
||||
"bundles/openjdk/GPL/linux-x64/openjdk-" + data.version
|
||||
+ "_linux-x64_bin-tests.tar.gz",
|
||||
"bundles/openjdk/GPL/linux-x64/\\1"
|
||||
"bundles/openjdk/GPL/linux-x64/open\\1"
|
||||
]
|
||||
},
|
||||
jdk_symbols: {
|
||||
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/linux-x64/jdk-" + data.version
|
||||
"bundles/openjdk/GPL/linux-x64/openjdk-" + data.version
|
||||
+ "_linux-x64_bin-symbols.tar.gz",
|
||||
"bundles/openjdk/GPL/linux-x64/\\1"
|
||||
"bundles/openjdk/GPL/linux-x64/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
@ -771,27 +771,27 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
jdk: {
|
||||
local: "bundles/\\(jdk.*bin.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/linux-x86/jdk-" + data.version
|
||||
"bundles/openjdk/GPL/linux-x86/openjdk-" + data.version
|
||||
+ "_linux-x86_bin.tar.gz",
|
||||
"bundles/openjdk/GPL/linux-x86/\\1"
|
||||
"bundles/openjdk/GPL/linux-x86/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
jdk_symbols: {
|
||||
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/linux-x86/jdk-" + data.version
|
||||
"bundles/openjdk/GPL/linux-x86/openjdk-" + data.version
|
||||
+ "_linux-x86_bin-symbols.tar.gz",
|
||||
"bundles/openjdk/GPL/linux-x86/\\1"
|
||||
"bundles/openjdk/GPL/linux-x86/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
test: {
|
||||
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/linux-x86/jdk-" + data.version
|
||||
"bundles/openjdk/GPL/linux-x86/openjdk-" + data.version
|
||||
+ "_linux-x86_bin-tests.tar.gz",
|
||||
"bundles/openjdk/GPL/linux-x86/\\1"
|
||||
"bundles/openjdk/GPL/linux-x86/open\\1"
|
||||
]
|
||||
},
|
||||
jre: {
|
||||
@ -814,41 +814,84 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
}
|
||||
},
|
||||
|
||||
"windows-x86-open": {
|
||||
"macosx-x64-open": {
|
||||
artifacts: {
|
||||
jdk: {
|
||||
local: "bundles/\\(jdk.*bin.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/windows-x86/jdk-" + data.version
|
||||
+ "_windows-x86_bin.tar.gz",
|
||||
"bundles/openjdk/GPL/windows-x86/\\1"
|
||||
"bundles/openjdk/GPL/osx-x64/openjdk-" + data.version
|
||||
+ "_osx-x64_bin.tar.gz",
|
||||
"bundles/openjdk/GPL/osx-x64/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
jre: {
|
||||
local: "bundles/\\(jre.*bin.tar.gz\\)",
|
||||
remote: "bundles/openjdk/GPL/windows-x86/\\1"
|
||||
remote: "bundles/openjdk/GPL/osx-x64/\\1",
|
||||
},
|
||||
test: {
|
||||
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/windows-x86/jdk-" + data.version
|
||||
+ "_windows-x86_bin-tests.tar.gz",
|
||||
"bundles/openjdk/GPL/windows-x86/\\1"
|
||||
"bundles/openjdk/GPL/osx-x64/openjdk-" + data.version
|
||||
+ "_osx-x64_bin-tests.tar.gz",
|
||||
"bundles/openjdk/GPL/osx-x64/open\\1"
|
||||
]
|
||||
},
|
||||
jdk_symbols: {
|
||||
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/windows-x86/jdk-" + data.version
|
||||
+ "_windows-x86_bin-symbols.tar.gz",
|
||||
"bundles/openjdk/GPL/windows-x86/\\1"
|
||||
"bundles/openjdk/GPL/osx-x64/openjdk-" + data.version
|
||||
+ "_osx-x64_bin-symbols.tar.gz",
|
||||
"bundles/openjdk/GPL/osx-x64/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
jre_symbols: {
|
||||
local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
|
||||
remote: "bundles/openjdk/GPL/windows-x86/\\1",
|
||||
remote: "bundles/openjdk/GPL/osx-x64/\\1",
|
||||
},
|
||||
doc_api_spec: {
|
||||
local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)",
|
||||
remote: "bundles/openjdk/GPL/osx-x64/\\1",
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
"windows-x64-open": {
|
||||
artifacts: {
|
||||
jdk: {
|
||||
local: "bundles/\\(jdk.*bin.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/windows-x64/openjdk-" + data.version
|
||||
+ "_windows-x64_bin.tar.gz",
|
||||
"bundles/openjdk/GPL/windows-x64/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
jre: {
|
||||
local: "bundles/\\(jre.*bin.tar.gz\\)",
|
||||
remote: "bundles/openjdk/GPL/windows-x64/\\1"
|
||||
},
|
||||
test: {
|
||||
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/windows-x64/openjdk-" + data.version
|
||||
+ "_windows-x64_bin-tests.tar.gz",
|
||||
"bundles/openjdk/GPL/windows-x64/open\\1"
|
||||
]
|
||||
},
|
||||
jdk_symbols: {
|
||||
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
|
||||
remote: [
|
||||
"bundles/openjdk/GPL/windows-x64/openjdk-" + data.version
|
||||
+ "_windows-x64_bin-symbols.tar.gz",
|
||||
"bundles/openjdk/GPL/windows-x64/open\\1"
|
||||
],
|
||||
subdir: "jdk-" + data.version
|
||||
},
|
||||
jre_symbols: {
|
||||
local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
|
||||
remote: "bundles/openjdk/GPL/windows-x64/\\1",
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -880,10 +923,11 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
profiles["linux-x64-ri"] = clone(profiles["linux-x64-open"]);
|
||||
profiles["linux-x86-ri"] = clone(profiles["linux-x86-open"]);
|
||||
profiles["linux-x86-ri-debug"] = clone(profiles["linux-x86-open-debug"]);
|
||||
profiles["windows-x86-ri"] = clone(profiles["windows-x86-open"]);
|
||||
profiles["macosx-x64-ri"] = clone(profiles["macosx-x64-open"]);
|
||||
profiles["windows-x64-ri"] = clone(profiles["windows-x64-open"]);
|
||||
|
||||
// Generate artifacts for ri profiles
|
||||
[ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "windows-x86-ri" ]
|
||||
[ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "macosx-x64-ri", "windows-x64-ri" ]
|
||||
.forEach(function (name) {
|
||||
// Rewrite all remote dirs to "bundles/openjdk/BCL/..."
|
||||
for (artifactName in profiles[name].artifacts) {
|
||||
@ -893,16 +937,6 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
}
|
||||
});
|
||||
|
||||
// The windows ri profile needs to add the freetype license file
|
||||
profilesRiFreetype = {
|
||||
"windows-x86-ri": {
|
||||
configure_args: "--with-freetype-license="
|
||||
+ input.get("freetype", "install_path")
|
||||
+ "/freetype-2.7.1-v120-x86/freetype.md"
|
||||
}
|
||||
};
|
||||
profiles = concatObjects(profiles, profilesRiFreetype);
|
||||
|
||||
// Generate the missing platform attributes
|
||||
profiles = generatePlatformAttributes(profiles);
|
||||
profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
|
||||
@ -934,6 +968,12 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
? input.target_os + "_x64"
|
||||
: input.target_platform);
|
||||
|
||||
var freetype_version = {
|
||||
windows_x64: "2.7.1-v120+1.1",
|
||||
windows_x86: "2.7.1-v120+1.1",
|
||||
macosx_x64: "2.7.1-Xcode6.3-MacOSX10.9+1.0"
|
||||
}[input.target_platform];
|
||||
|
||||
var dependencies = {
|
||||
|
||||
boot_jdk: {
|
||||
@ -998,7 +1038,7 @@ var getJibProfilesDependencies = function (input, common) {
|
||||
freetype: {
|
||||
organization: common.organization,
|
||||
ext: "tar.gz",
|
||||
revision: "2.7.1-v120+1.0",
|
||||
revision: freetype_version,
|
||||
module: "freetype-" + input.target_platform
|
||||
},
|
||||
|
||||
@ -1200,7 +1240,8 @@ var versionArgs = function(input, common) {
|
||||
if (input.build_type == "promoted") {
|
||||
args = concat(args,
|
||||
// This needs to be changed when we start building release candidates
|
||||
"--with-version-pre=ea",
|
||||
// 'ea' for EA builds and empty value for 'fcs'
|
||||
"--with-version-pre=",
|
||||
"--without-version-opt");
|
||||
} else {
|
||||
args = concat(args, "--with-version-opt=" + common.build_id);
|
||||
|
||||
@ -417,9 +417,32 @@ c62e5964cfcf144d8f72e9ba69757897785349a9 jdk-9+171
|
||||
95ed14547ca9246baed34f90ef3ca13217538a8c jdk-9+172
|
||||
534ba4f8cfcf12accc5b9adb943103f2ff79fe16 jdk-9+173
|
||||
3615768c12904e29bb2ec1b506cd4633cd8a9ced jdk-9+174
|
||||
6a33ed67219134933d276bd7575a84511a48c384 jdk-9.0.1+00
|
||||
6a33ed67219134933d276bd7575a84511a48c384 jdk-9.0.3+00
|
||||
dc78a3dd6b3a4f11cdae8a3e3d160e6a78bc7838 jdk-9+175
|
||||
40fb9f229471ef357d493813d34b15afcce9f32b jdk-9+176
|
||||
c72e9d3823f04cb3ef3166646dfea9e4c2769133 jdk-9+177
|
||||
9c1e9712648921ae389d623042d22561fad82d75 jdk-9+178
|
||||
24390da83c5ee9e23ceafbcaff4460a01e37bb3a jdk-9+179
|
||||
6ce6cb8ff41c71c49f23b15e0f0468aca5d52b17 jdk-9+180
|
||||
ba71941ad9dba53b8fffb30602ef673eee88696c jdk-9+181
|
||||
53ba069e7f46ad62c8db049be90a2974dfc638e0 jdk-9.0.3+1
|
||||
862693aa58490d65f1050d8d6b49d1abb40433b8 jdk-9.0.3+2
|
||||
34504835797ff6c671720590636b65395d392e9e jdk-9.0.3+3
|
||||
9d0501a9354d061b7e17a306dc0acc4676024c25 jdk-9.0.3+4
|
||||
23f00502db730453c28633bc62071030ae1f28c5 jdk-9.0.3+5
|
||||
db0ea99e2418dd88160c1c480c4c1525a5c0c993 jdk-9.0.3+6
|
||||
6189293024ef2e419b54392b37ad14e8b8670ab9 jdk-9.0.3+7
|
||||
b69fd398311af4f5d2b67b27c0bfa5622f971ec1 jdk-9.0.3+8
|
||||
e81a65e5771c0e9e524ff310c098e042cf381e8f jdk-9.0.3+9
|
||||
97fad1859593b8f8b445d170f412870bf0aceff4 jdk-9.0.1+10
|
||||
f67e7e2c01929cfe7a1a3cb2f4b279c1d4fee120 jdk-9.0.1+11
|
||||
0876f7e30c48b7cc0b3c15fcd3860522b1f4ae38 jdk-9.0.4+00
|
||||
03683a1b2e25231ea6305c91cae4cf83d01738f0 jdk-9.0.4+1
|
||||
bcb2300e20962172f7b94ba422d3e634d4f2c62c jdk-9.0.4+2
|
||||
7e5bd44ac820cfb3ccceaf1c2e72d3701a625946 jdk-9.0.4+3
|
||||
37249aa145988b06ec51b490e0d3d343f8faf660 jdk-9.0.4+4
|
||||
ec450e8c90c53c4e4cd35468a038123ca4fe0129 jdk-9.0.4+5
|
||||
7582f72a39b79c6206cdd7e0ccdfaa1ab342b040 jdk-9.0.4+6
|
||||
8d2b147370b7a6ed585f1b168fe3475a6e16cb5f jdk-9.0.4+7
|
||||
019e9e48d195e2aad4373e4301b068800f2ae5e6 jdk-9.0.4+8
|
||||
|
||||
@ -1 +1,2 @@
|
||||
project=jdk9
|
||||
bugids=dup
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2003, 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
|
||||
@ -26,11 +26,13 @@
|
||||
package com.sun.corba.se.impl.encoding;
|
||||
|
||||
import com.sun.corba.se.impl.orbutil.ORBConstants;
|
||||
import com.sun.corba.se.impl.orbutil.ORBUtility;
|
||||
import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
|
||||
import com.sun.corba.se.impl.encoding.BufferManagerWrite;
|
||||
import com.sun.corba.se.pept.encoding.OutputObject;
|
||||
import com.sun.corba.se.pept.transport.Connection;
|
||||
import com.sun.corba.se.spi.orb.ORB;
|
||||
import com.sun.corba.se.spi.orb.ORBData;
|
||||
|
||||
public class BufferManagerWriteGrow extends BufferManagerWrite
|
||||
{
|
||||
@ -48,7 +50,20 @@ public class BufferManagerWriteGrow extends BufferManagerWrite
|
||||
* buffer manager as set in the ORB.
|
||||
*/
|
||||
public int getBufferSize() {
|
||||
return orb.getORBData().getGIOPBufferSize();
|
||||
ORBData orbData = null;
|
||||
int bufferSize = ORBConstants.GIOP_DEFAULT_BUFFER_SIZE;
|
||||
if (orb != null) {
|
||||
orbData = orb.getORBData();
|
||||
if (orbData != null) {
|
||||
bufferSize = orbData.getGIOPBufferSize();
|
||||
dprint("BufferManagerWriteGrow.getBufferSize: bufferSize == " + bufferSize);
|
||||
} else {
|
||||
dprint("BufferManagerWriteGrow.getBufferSize: orbData reference is NULL");
|
||||
}
|
||||
} else {
|
||||
dprint("BufferManagerWriteGrow.getBufferSize: orb reference is NULL");
|
||||
}
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
public void overflow (ByteBufferWithInfo bbwi)
|
||||
@ -89,4 +104,9 @@ public class BufferManagerWriteGrow extends BufferManagerWrite
|
||||
*/
|
||||
public void close() {}
|
||||
|
||||
private void dprint(String msg) {
|
||||
if (orb.transportDebugFlag) {
|
||||
ORBUtility.dprint(this, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -725,12 +725,14 @@ public class CDRInputStream_1_0 extends CDRInputStreamBase
|
||||
// IDLEntity.class.isAssignableFrom( clz ).
|
||||
// 3. If clz is an interface, use it to create the appropriate
|
||||
// stub factory.
|
||||
|
||||
public org.omg.CORBA.Object read_Object(Class clz)
|
||||
{
|
||||
// In any case, we must first read the IOR.
|
||||
IOR ior = IORFactories.makeIOR(parent) ;
|
||||
if (ior.isNil())
|
||||
if (ior.isNil()) {
|
||||
return null ;
|
||||
}
|
||||
|
||||
PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
|
||||
String codeBase = ior.getProfile().getCodebase() ;
|
||||
@ -739,6 +741,7 @@ public class CDRInputStream_1_0 extends CDRInputStreamBase
|
||||
if (clz == null) {
|
||||
RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
|
||||
String className = rid.getClassName() ;
|
||||
orb.validateIORClass(className);
|
||||
boolean isIDLInterface = rid.isIDLType() ;
|
||||
|
||||
if (className == null || className.equals( "" ))
|
||||
@ -761,11 +764,9 @@ public class CDRInputStream_1_0 extends CDRInputStreamBase
|
||||
} else {
|
||||
// clz is an interface class
|
||||
boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;
|
||||
|
||||
stubFactory = sff.createStubFactory( clz.getName(),
|
||||
isIDL, codeBase, clz, clz.getClassLoader() ) ;
|
||||
}
|
||||
|
||||
return internalIORToObject( ior, stubFactory, orb ) ;
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,10 @@ import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.DigestOutputStream;
|
||||
import java.security.AccessController;
|
||||
import java.security.PermissionCollection;
|
||||
import java.security.Permissions;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Field;
|
||||
@ -57,6 +60,8 @@ import java.io.Serializable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sun.corba.se.impl.util.RepositoryId;
|
||||
|
||||
@ -443,6 +448,65 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
private static final PersistentFieldsValue persistentFieldsValue =
|
||||
new PersistentFieldsValue();
|
||||
|
||||
/**
|
||||
* Creates a PermissionDomain that grants no permission.
|
||||
*/
|
||||
private ProtectionDomain noPermissionsDomain() {
|
||||
PermissionCollection perms = new Permissions();
|
||||
perms.setReadOnly();
|
||||
return new ProtectionDomain(null, perms);
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggregate the ProtectionDomains of all the classes that separate
|
||||
* a concrete class {@code cl} from its ancestor's class declaring
|
||||
* a constructor {@code cons}.
|
||||
*
|
||||
* If {@code cl} is defined by the boot loader, or the constructor
|
||||
* {@code cons} is declared by {@code cl}, or if there is no security
|
||||
* manager, then this method does nothing and {@code null} is returned.
|
||||
*
|
||||
* @param cons A constructor declared by {@code cl} or one of its
|
||||
* ancestors.
|
||||
* @param cl A concrete class, which is either the class declaring
|
||||
* the constructor {@code cons}, or a serializable subclass
|
||||
* of that class.
|
||||
* @return An array of ProtectionDomain representing the set of
|
||||
* ProtectionDomain that separate the concrete class {@code cl}
|
||||
* from its ancestor's declaring {@code cons}, or {@code null}.
|
||||
*/
|
||||
private ProtectionDomain[] getProtectionDomains(Constructor<?> cons,
|
||||
Class<?> cl) {
|
||||
ProtectionDomain[] domains = null;
|
||||
if (cons != null && cl.getClassLoader() != null
|
||||
&& System.getSecurityManager() != null) {
|
||||
Class<?> cls = cl;
|
||||
Class<?> fnscl = cons.getDeclaringClass();
|
||||
Set<ProtectionDomain> pds = null;
|
||||
while (cls != fnscl) {
|
||||
ProtectionDomain pd = cls.getProtectionDomain();
|
||||
if (pd != null) {
|
||||
if (pds == null) pds = new HashSet<>();
|
||||
pds.add(pd);
|
||||
}
|
||||
cls = cls.getSuperclass();
|
||||
if (cls == null) {
|
||||
// that's not supposed to happen
|
||||
// make a ProtectionDomain with no permission.
|
||||
// should we throw instead?
|
||||
if (pds == null) pds = new HashSet<>();
|
||||
else pds.clear();
|
||||
pds.add(noPermissionsDomain());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pds != null) {
|
||||
domains = pds.toArray(new ProtectionDomain[0]);
|
||||
}
|
||||
}
|
||||
return domains;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize class descriptor. This method is only invoked on class
|
||||
* descriptors created via calls to lookupInternal(). This method is kept
|
||||
@ -568,11 +632,15 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
|
||||
readResolveObjectMethod = bridge.readResolveForSerialization(cl);
|
||||
|
||||
domains = new ProtectionDomain[] {noPermissionsDomain()};
|
||||
|
||||
if (externalizable)
|
||||
cons = getExternalizableConstructor(cl) ;
|
||||
else
|
||||
cons = getSerializableConstructor(cl) ;
|
||||
|
||||
domains = getProtectionDomains(cons, cl);
|
||||
|
||||
if (serializable && !forProxyClass) {
|
||||
writeObjectMethod = bridge.writeObjectForSerialization(cl) ;
|
||||
readObjectMethod = bridge.readObjectForSerialization(cl);
|
||||
@ -910,7 +978,7 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
{
|
||||
if (cons != null) {
|
||||
try {
|
||||
return cons.newInstance();
|
||||
return bridge.newInstanceForSerialization(cons, domains);
|
||||
} catch (IllegalAccessException ex) {
|
||||
// should not occur, as access checks have been suppressed
|
||||
InternalError ie = new InternalError();
|
||||
@ -1506,6 +1574,7 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
private transient MethodHandle writeReplaceObjectMethod;
|
||||
private transient MethodHandle readResolveObjectMethod;
|
||||
private transient Constructor<?> cons;
|
||||
private transient ProtectionDomain[] domains;
|
||||
|
||||
/**
|
||||
* Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a
|
||||
|
||||
@ -0,0 +1,179 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.sun.corba.se.impl.ior;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sun.corba.se.impl.orbutil.ORBUtility;
|
||||
import com.sun.corba.se.spi.ior.IORTypeCheckRegistry;
|
||||
import com.sun.corba.se.spi.orb.ORB;
|
||||
|
||||
public class IORTypeCheckRegistryImpl implements IORTypeCheckRegistry {
|
||||
|
||||
private final Set<String> iorTypeNames;
|
||||
private static final Set<String> builtinIorTypeNames;
|
||||
private ORB theOrb;
|
||||
|
||||
static {
|
||||
builtinIorTypeNames = initBuiltinIorTypeNames();
|
||||
}
|
||||
|
||||
public IORTypeCheckRegistryImpl( String filterProperties, ORB orb) {
|
||||
theOrb = orb;
|
||||
iorTypeNames = parseIorClassNameList(filterProperties);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* A note on the validation flow:
|
||||
* 1. against the filter class name list
|
||||
* 2. against the builtin class name list
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean isValidIORType(String iorClassName) {
|
||||
dprintTransport(".isValidIORType : iorClassName == " + iorClassName);
|
||||
return validateIorTypeByName(iorClassName);
|
||||
}
|
||||
|
||||
|
||||
private boolean validateIorTypeByName(String iorClassName) {
|
||||
dprintTransport(".validateIorTypeByName : iorClassName == " + iorClassName);
|
||||
boolean isValidType;
|
||||
|
||||
isValidType = checkIorTypeNames(iorClassName);
|
||||
|
||||
if (!isValidType) {
|
||||
isValidType = checkBuiltinClassNames(iorClassName);
|
||||
}
|
||||
|
||||
dprintTransport(".validateIorTypeByName : isValidType == " + isValidType);
|
||||
return isValidType;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* check if the class name corresponding to an IOR Type name
|
||||
* is in the ior class name list as generated from the filter property.
|
||||
* So if the IOR type is recorded in the registry then allow the creation of the
|
||||
* stub factory and let it resolve and load the class. That is if current
|
||||
* type check deliberation permits.
|
||||
* IOR Type names are configured by the filter property
|
||||
*/
|
||||
|
||||
private boolean checkIorTypeNames(
|
||||
String theIorClassName) {
|
||||
return (iorTypeNames != null) && (iorTypeNames.contains(theIorClassName));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the IOR interface class name against the set of
|
||||
* class names that correspond to the builtin JDK IDL stub classes.
|
||||
*/
|
||||
|
||||
private boolean checkBuiltinClassNames(
|
||||
String theIorClassName) {
|
||||
return builtinIorTypeNames.contains(theIorClassName);
|
||||
}
|
||||
|
||||
|
||||
private Set<String> parseIorClassNameList(String filterProperty) {
|
||||
Set<String> _iorTypeNames = null;
|
||||
if (filterProperty != null) {
|
||||
String[] tempIorClassNames = filterProperty.split(";");
|
||||
_iorTypeNames = Set.<String>of(tempIorClassNames);
|
||||
if (theOrb.orbInitDebugFlag) {
|
||||
dprintConfiguredIorTypeNames();
|
||||
}
|
||||
}
|
||||
return _iorTypeNames;
|
||||
}
|
||||
|
||||
|
||||
private static Set<String> initBuiltinIorTypeNames() {
|
||||
Set<Class<?>> builtInCorbaStubTypes = initBuiltInCorbaStubTypes();
|
||||
String [] tempBuiltinIorTypeNames = new String[builtInCorbaStubTypes.size()];
|
||||
int i = 0;
|
||||
for (Class<?> _stubClass: builtInCorbaStubTypes) {
|
||||
tempBuiltinIorTypeNames[i++] = _stubClass.getName();
|
||||
}
|
||||
return Set.<String>of(tempBuiltinIorTypeNames);
|
||||
}
|
||||
|
||||
private static Set<Class<?>> initBuiltInCorbaStubTypes() {
|
||||
Class<?> tempBuiltinCorbaStubTypes[] = {
|
||||
com.sun.corba.se.spi.activation.Activator.class,
|
||||
com.sun.corba.se.spi.activation._ActivatorStub.class,
|
||||
com.sun.corba.se.spi.activation._InitialNameServiceStub.class,
|
||||
com.sun.corba.se.spi.activation._LocatorStub.class,
|
||||
com.sun.corba.se.spi.activation._RepositoryStub.class,
|
||||
com.sun.corba.se.spi.activation._ServerManagerStub.class,
|
||||
com.sun.corba.se.spi.activation._ServerStub.class,
|
||||
org.omg.CosNaming.BindingIterator.class,
|
||||
org.omg.CosNaming._BindingIteratorStub.class,
|
||||
org.omg.CosNaming.NamingContextExt.class,
|
||||
org.omg.CosNaming._NamingContextExtStub.class,
|
||||
org.omg.CosNaming.NamingContext.class,
|
||||
org.omg.CosNaming._NamingContextStub.class,
|
||||
org.omg.DynamicAny.DynAnyFactory.class,
|
||||
org.omg.DynamicAny._DynAnyFactoryStub.class,
|
||||
org.omg.DynamicAny.DynAny.class,
|
||||
org.omg.DynamicAny._DynAnyStub.class,
|
||||
org.omg.DynamicAny.DynArray.class,
|
||||
org.omg.DynamicAny._DynArrayStub.class,
|
||||
org.omg.DynamicAny.DynEnum.class,
|
||||
org.omg.DynamicAny._DynEnumStub.class,
|
||||
org.omg.DynamicAny.DynFixed.class,
|
||||
org.omg.DynamicAny._DynFixedStub.class,
|
||||
org.omg.DynamicAny.DynSequence.class,
|
||||
org.omg.DynamicAny._DynSequenceStub.class,
|
||||
org.omg.DynamicAny.DynStruct.class,
|
||||
org.omg.DynamicAny._DynStructStub.class,
|
||||
org.omg.DynamicAny.DynUnion.class,
|
||||
org.omg.DynamicAny._DynUnionStub.class,
|
||||
org.omg.DynamicAny._DynValueStub.class,
|
||||
org.omg.DynamicAny.DynValue.class,
|
||||
org.omg.PortableServer.ServantActivator.class,
|
||||
org.omg.PortableServer._ServantActivatorStub.class,
|
||||
org.omg.PortableServer.ServantLocator.class,
|
||||
org.omg.PortableServer._ServantLocatorStub.class };
|
||||
return Set.<Class<?>>of(tempBuiltinCorbaStubTypes);
|
||||
}
|
||||
|
||||
private void dprintConfiguredIorTypeNames() {
|
||||
if (iorTypeNames != null) {
|
||||
for (String iorTypeName : iorTypeNames) {
|
||||
ORBUtility.dprint(this, ".dprintConfiguredIorTypeNames: " + iorTypeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dprintTransport(String msg) {
|
||||
if (theOrb.transportDebugFlag) {
|
||||
ORBUtility.dprint(this, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -54,6 +54,7 @@ import java.net.InetAddress;
|
||||
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.AccessController;
|
||||
import java.security.Security;
|
||||
|
||||
import javax.rmi.CORBA.Util;
|
||||
import javax.rmi.CORBA.ValueHandler;
|
||||
@ -90,6 +91,7 @@ import com.sun.corba.se.pept.transport.ConnectionCache;
|
||||
import com.sun.corba.se.pept.transport.TransportManager;
|
||||
|
||||
import com.sun.corba.se.spi.ior.IOR;
|
||||
import com.sun.corba.se.spi.ior.IORTypeCheckRegistry;
|
||||
import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder;
|
||||
import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder;
|
||||
import com.sun.corba.se.spi.ior.IORFactories;
|
||||
@ -124,6 +126,7 @@ import com.sun.corba.se.spi.orb.StringPair;
|
||||
import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
|
||||
import com.sun.corba.se.spi.transport.CorbaTransportManager;
|
||||
import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
|
||||
import com.sun.corba.se.spi.logging.CORBALogDomains;
|
||||
import com.sun.corba.se.spi.copyobject.CopierManager;
|
||||
import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
|
||||
import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
|
||||
@ -145,6 +148,7 @@ import com.sun.corba.se.impl.encoding.EncapsOutputStream;
|
||||
import com.sun.corba.se.impl.encoding.CachedCodeBase;
|
||||
import com.sun.corba.se.impl.interceptors.PIHandlerImpl;
|
||||
import com.sun.corba.se.impl.interceptors.PINoOpHandlerImpl;
|
||||
import com.sun.corba.se.impl.ior.IORTypeCheckRegistryImpl;
|
||||
import com.sun.corba.se.impl.ior.TaggedComponentFactoryFinderImpl;
|
||||
import com.sun.corba.se.impl.ior.TaggedProfileFactoryFinderImpl;
|
||||
import com.sun.corba.se.impl.ior.TaggedProfileTemplateFactoryFinderImpl;
|
||||
@ -226,6 +230,8 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
|
||||
|
||||
private ServiceContextRegistry serviceContextRegistry ;
|
||||
|
||||
private IORTypeCheckRegistry iorTypeCheckRegistry;
|
||||
|
||||
// Needed here to implement connect/disconnect
|
||||
private TOAFactory toaFactory ;
|
||||
|
||||
@ -274,6 +280,8 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
|
||||
// insNamingDelegate.
|
||||
private final Object resolverLock = new Object() ;
|
||||
|
||||
private static final String IORTYPECHECKREGISTRY_FILTER_PROPNAME = "com.sun.CORBA.ORBIorTypeCheckRegistryFilter";
|
||||
|
||||
private TaggedComponentFactoryFinder taggedComponentFactoryFinder ;
|
||||
|
||||
private IdentifiableFactoryFinder taggedProfileFactoryFinder ;
|
||||
@ -411,6 +419,39 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
|
||||
};
|
||||
|
||||
serviceContextRegistry = new ServiceContextRegistry( this ) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initIORTypeCheckRegistry() {
|
||||
String filterProps = AccessController
|
||||
.doPrivileged(new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
String props = System
|
||||
.getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
|
||||
if (props == null) {
|
||||
props = Security
|
||||
.getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
});
|
||||
if (filterProps != null) {
|
||||
try {
|
||||
iorTypeCheckRegistry = new IORTypeCheckRegistryImpl(filterProps, this);
|
||||
} catch (Exception ex) {
|
||||
throw wrapper.bootstrapException(ex);
|
||||
}
|
||||
|
||||
if (this.orbInitDebugFlag) {
|
||||
dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl created for properties == "
|
||||
+ filterProps);
|
||||
}
|
||||
} else {
|
||||
if (this.orbInitDebugFlag) {
|
||||
dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl NOT created for properties == ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void setDebugFlags( String[] args )
|
||||
@ -494,6 +535,8 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
|
||||
getThreadPoolManager();
|
||||
|
||||
super.getByteBufferPool();
|
||||
|
||||
initIORTypeCheckRegistry();
|
||||
}
|
||||
|
||||
private synchronized POAFactory getPOAFactory()
|
||||
@ -2089,6 +2132,17 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
|
||||
}
|
||||
return copierManager ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateIORClass(String iorClassName) {
|
||||
if (iorTypeCheckRegistry != null) {
|
||||
if (!iorTypeCheckRegistry.isValidIORType(iorClassName)) {
|
||||
throw ORBUtilSystemException.get( this,
|
||||
CORBALogDomains.OA_IOR ).badStringifiedIor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // Class ORBImpl
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -768,6 +768,13 @@ public class ORBSingleton extends ORB
|
||||
public CopierManager getCopierManager() {
|
||||
return null ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateIORClass(String iorClassName) {
|
||||
getFullORB().validateIORClass(iorClassName);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// End of file.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -22,21 +22,10 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.io.ObjectStreamClass;
|
||||
package com.sun.corba.se.spi.ior;
|
||||
|
||||
/**
|
||||
* A callback used by {@code ObjectInputStream} to do descriptor validation.
|
||||
*
|
||||
* @author sjiang
|
||||
*/
|
||||
public interface ObjectStreamClassValidator {
|
||||
/**
|
||||
* This method will be called by ObjectInputStream to
|
||||
* check a descriptor just before creating an object described by this descriptor.
|
||||
* The object will not be created if this method throws a {@code RuntimeException}.
|
||||
* @param descriptor descriptor to be checked.
|
||||
*/
|
||||
public void validateDescriptor(ObjectStreamClass descriptor);
|
||||
public interface IORTypeCheckRegistry {
|
||||
public boolean isValidIORType(String iorClassName);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 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
|
||||
@ -121,6 +121,7 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
|
||||
public boolean shutdownDebugFlag = false;
|
||||
public boolean giopDebugFlag = false;
|
||||
public boolean invocationTimingDebugFlag = false ;
|
||||
public boolean orbInitDebugFlag = false ;
|
||||
|
||||
// SystemException log wrappers. Protected so that they can be used in
|
||||
// subclasses.
|
||||
@ -487,6 +488,24 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
|
||||
public abstract ThreadPoolManager getThreadPoolManager();
|
||||
|
||||
public abstract CopierManager getCopierManager() ;
|
||||
|
||||
/*
|
||||
* This method is called to verify that a stringified IOR passed to
|
||||
* an org.omg.CORBA.ORB::string_to_object method contains a valid and acceptable IOR type.
|
||||
* If an ORB is configured with IOR type checking enabled,
|
||||
* the ORB executes a IOR type registry lookup to
|
||||
* validate that the class name extract from a type id in
|
||||
* a stringified IOR is a known and accepted type.
|
||||
* A CORBA {@code org.omg.CORBA.DATA_CONVERSION} exception will be thrown should the type check fail.
|
||||
*
|
||||
* @param iorClassName
|
||||
* a string representing the class name corresponding to the type id of an IOR
|
||||
* @throws org.omg.CORBA.DATA_CONVERSION
|
||||
* exception with an indication that it is a "Bad stringified IOR", which is thrown
|
||||
* when the type check fails.
|
||||
*/
|
||||
public abstract void validateIORClass(String iorClassName);
|
||||
|
||||
}
|
||||
|
||||
// End of file.
|
||||
|
||||
@ -27,8 +27,9 @@ package sun.corba ;
|
||||
|
||||
import java.io.OptionalDataException;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.reflect.Field ;
|
||||
import java.lang.reflect.Constructor ;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.StackWalker;
|
||||
import java.lang.StackWalker.StackFrame;
|
||||
import java.util.Optional;
|
||||
@ -37,6 +38,7 @@ import java.util.stream.Stream;
|
||||
import java.security.AccessController;
|
||||
import java.security.Permission;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import sun.misc.Unsafe;
|
||||
import sun.reflect.ReflectionFactory;
|
||||
@ -340,6 +342,36 @@ public final class Bridge
|
||||
return reflectionFactory.newConstructorForExternalization( cl ) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the supplied constructor, adding the provided protection domains
|
||||
* to the invocation stack before invoking {@code Constructor::newInstance}.
|
||||
*
|
||||
* This is equivalent to calling
|
||||
* {@code ReflectionFactory.newInstanceForSerialization(cons,domains)}.
|
||||
*
|
||||
* @param cons A constructor obtained from {@code
|
||||
* newConstructorForSerialization} or {@code
|
||||
* newConstructorForExternalization}.
|
||||
*
|
||||
* @param domains An array of protection domains that limit the privileges
|
||||
* with which the constructor is invoked. Can be {@code null}
|
||||
* or empty, in which case privileges are only limited by the
|
||||
* {@linkplain AccessController#getContext() current context}.
|
||||
*
|
||||
* @return A new object built from the provided constructor.
|
||||
*
|
||||
* @throws NullPointerException if {@code cons} is {@code null}.
|
||||
* @throws InstantiationException if thrown by {@code cons.newInstance()}.
|
||||
* @throws InvocationTargetException if thrown by {@code cons.newInstance()}.
|
||||
* @throws IllegalAccessException if thrown by {@code cons.newInstance()}.
|
||||
*/
|
||||
public final Object newInstanceForSerialization(Constructor<?> cons,
|
||||
ProtectionDomain[] domains)
|
||||
throws InstantiationException, InvocationTargetException, IllegalAccessException
|
||||
{
|
||||
return reflectionFactory.newInstanceForSerialization(cons, domains);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given class defines a static initializer method,
|
||||
* false otherwise.
|
||||
|
||||
@ -577,9 +577,32 @@ d53171650a2cc6c6f699c966c533b914ca9c0602 jdk-9+171
|
||||
1ae9e84f68b359420d2d153ecfe5ee2903e33a2e jdk-9+172
|
||||
e64b1cb48d6e7703928a9d1da106fc27f8cb65fd jdk-9+173
|
||||
944791f8160185bffa13fbb821fc09b6198f1f25 jdk-9+174
|
||||
ca47dcfdd35129fe3ab2dab71b2601d7a0ff07c0 jdk-9.0.1+00
|
||||
ca47dcfdd35129fe3ab2dab71b2601d7a0ff07c0 jdk-9.0.3+00
|
||||
8f04d457168b9f1f4a1b2c37f49e0513ca9d33a7 jdk-9+175
|
||||
2ab74e5dbdc2b6a962c865500cafd23cf387dc60 jdk-9+176
|
||||
1ca8f038fceb88c640badf9bd18905205bc63b43 jdk-9+177
|
||||
9d032191f82fca5ba0aac98682f69c4ff0f1283d jdk-9+178
|
||||
d2661aa42bff322badbe6c1337fc638d2e0f5730 jdk-9+179
|
||||
d7baadc223e790c08bc69bf7e553bce65b4e7e40 jdk-9+180
|
||||
4a443796f6f57842d6a0434ac27ca3d1033ccc20 jdk-9+181
|
||||
8297b62a7b62bafe42c7d567a5752f7a82bafab8 jdk-9.0.3+1
|
||||
d2efdbb193a02613867c8949f783d2905f7a28fc jdk-9.0.3+2
|
||||
68f9ff7c5eedfd41f9c10959e41024efbd3aa79c jdk-9.0.3+3
|
||||
82584ea6464de2e0a59e9fc00173e18a85dc45d8 jdk-9.0.3+4
|
||||
c45e75533bae7b5db5c626bf9233b4226934d582 jdk-9.0.3+5
|
||||
4c0248d117fabf46c5931cdd09e543c3d89b68a5 jdk-9.0.3+6
|
||||
fca264c9fa3ce57b3f4d662242d38b44fb442c87 jdk-9.0.3+7
|
||||
1f5a9c0ddb4b8da443f70fc5d135b320f6e0b78a jdk-9.0.3+8
|
||||
a10c11fed5bdc5202523baee3cf391cc0e0cfcaa jdk-9.0.3+9
|
||||
172baf6c99c5e9fdd72a6f3729f6ec8cd6b48183 jdk-9.0.1+10
|
||||
3546eb2ee2693043eb107d980ce5b72fe7f8f47a jdk-9.0.1+11
|
||||
5be37d3ef648d06850aa164d8b22ac7539559e80 jdk-9.0.4+00
|
||||
46290b7298be50f9a70d27465d50d1675732f0af jdk-9.0.4+1
|
||||
dab4c60adabfb8ea35cfcd96a7218994a84d652f jdk-9.0.4+2
|
||||
deed95e4b4cba997b3cc13b62e33615fd11bc902 jdk-9.0.4+3
|
||||
ce49d719fd4d5f0ff12a1906d9d8b651a7a7d60c jdk-9.0.4+4
|
||||
11116cc619ac1b0d00cdcd47e8a7eb2339207bbf jdk-9.0.4+5
|
||||
f3ba0e190ffcc82f1ed0dd8275a51096123514b6 jdk-9.0.4+6
|
||||
e020892c9b441ff0855479ad4de63a9eb4b59bf7 jdk-9.0.4+7
|
||||
d74a282dcd6d05cc3752c8e29a526eb9216fa08c jdk-9.0.4+8
|
||||
|
||||
@ -1 +1,2 @@
|
||||
project=jdk9
|
||||
bugids=dup
|
||||
|
||||
@ -773,7 +773,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
__ load_klass(rscratch1, receiver);
|
||||
__ ldr(tmp, Address(holder, CompiledICHolder::holder_klass_offset()));
|
||||
__ cmp(rscratch1, tmp);
|
||||
__ ldr(rmethod, Address(holder, CompiledICHolder::holder_method_offset()));
|
||||
__ ldr(rmethod, Address(holder, CompiledICHolder::holder_metadata_offset()));
|
||||
__ br(Assembler::EQ, ok);
|
||||
__ far_jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
|
||||
|
||||
|
||||
@ -2475,49 +2475,65 @@ void MacroAssembler::store_sized_value(Register src, Address dst, size_t size_in
|
||||
// On success, the result will be in method_result, and execution falls through.
|
||||
// On failure, execution transfers to the given label.
|
||||
void MacroAssembler::lookup_interface_method(Register Rklass,
|
||||
Register Rinterf,
|
||||
Register Rindex,
|
||||
Register Rintf,
|
||||
RegisterOrConstant itable_index,
|
||||
Register method_result,
|
||||
Register temp_reg1,
|
||||
Register temp_reg2,
|
||||
Register Rscan,
|
||||
Register Rtmp,
|
||||
Label& L_no_such_interface) {
|
||||
|
||||
assert_different_registers(Rklass, Rinterf, temp_reg1, temp_reg2, Rindex);
|
||||
assert_different_registers(Rklass, Rintf, Rscan, Rtmp);
|
||||
|
||||
Register Ritable = temp_reg1;
|
||||
const int entry_size = itableOffsetEntry::size() * HeapWordSize;
|
||||
assert(itableOffsetEntry::interface_offset_in_bytes() == 0, "not added for convenience");
|
||||
|
||||
// Compute start of first itableOffsetEntry (which is at the end of the vtable)
|
||||
const int base = in_bytes(Klass::vtable_start_offset());
|
||||
const int scale = exact_log2(vtableEntry::size_in_bytes());
|
||||
ldr_s32(temp_reg2, Address(Rklass, Klass::vtable_length_offset())); // Get length of vtable
|
||||
add(Ritable, Rklass, base);
|
||||
add(Ritable, Ritable, AsmOperand(temp_reg2, lsl, scale));
|
||||
ldr_s32(Rtmp, Address(Rklass, Klass::vtable_length_offset())); // Get length of vtable
|
||||
add(Rscan, Rklass, base);
|
||||
add(Rscan, Rscan, AsmOperand(Rtmp, lsl, scale));
|
||||
|
||||
Label entry, search;
|
||||
// Search through the itable for an interface equal to incoming Rintf
|
||||
// itable looks like [intface][offset][intface][offset][intface][offset]
|
||||
|
||||
b(entry);
|
||||
Label loop;
|
||||
bind(loop);
|
||||
ldr(Rtmp, Address(Rscan, entry_size, post_indexed));
|
||||
#ifdef AARCH64
|
||||
Label found;
|
||||
cmp(Rtmp, Rintf);
|
||||
b(found, eq);
|
||||
cbnz(Rtmp, loop);
|
||||
#else
|
||||
cmp(Rtmp, Rintf); // set ZF and CF if interface is found
|
||||
cmn(Rtmp, 0, ne); // check if tmp == 0 and clear CF if it is
|
||||
b(loop, ne);
|
||||
#endif // AARCH64
|
||||
|
||||
bind(search);
|
||||
add(Ritable, Ritable, itableOffsetEntry::size() * HeapWordSize);
|
||||
#ifdef AARCH64
|
||||
b(L_no_such_interface);
|
||||
bind(found);
|
||||
#else
|
||||
// CF == 0 means we reached the end of itable without finding icklass
|
||||
b(L_no_such_interface, cc);
|
||||
#endif // !AARCH64
|
||||
|
||||
bind(entry);
|
||||
|
||||
// Check that the entry is non-null. A null entry means that the receiver
|
||||
// class doesn't implement the interface, and wasn't the same as the
|
||||
// receiver class checked when the interface was resolved.
|
||||
|
||||
ldr(temp_reg2, Address(Ritable, itableOffsetEntry::interface_offset_in_bytes()));
|
||||
cbz(temp_reg2, L_no_such_interface);
|
||||
|
||||
cmp(Rinterf, temp_reg2);
|
||||
b(search, ne);
|
||||
|
||||
ldr_s32(temp_reg2, Address(Ritable, itableOffsetEntry::offset_offset_in_bytes()));
|
||||
add(temp_reg2, temp_reg2, Rklass); // Add offset to Klass*
|
||||
assert(itableMethodEntry::size() * HeapWordSize == wordSize, "adjust the scaling in the code below");
|
||||
assert(itableMethodEntry::method_offset_in_bytes() == 0, "adjust the offset in the code below");
|
||||
|
||||
ldr(method_result, Address::indexed_ptr(temp_reg2, Rindex));
|
||||
if (method_result != noreg) {
|
||||
// Interface found at previous position of Rscan, now load the method
|
||||
ldr_s32(Rtmp, Address(Rscan, itableOffsetEntry::offset_offset_in_bytes() - entry_size));
|
||||
if (itable_index.is_register()) {
|
||||
add(Rtmp, Rtmp, Rklass); // Add offset to Klass*
|
||||
assert(itableMethodEntry::size() * HeapWordSize == wordSize, "adjust the scaling in the code below");
|
||||
assert(itableMethodEntry::method_offset_in_bytes() == 0, "adjust the offset in the code below");
|
||||
ldr(method_result, Address::indexed_ptr(Rtmp, itable_index.as_register()));
|
||||
} else {
|
||||
int method_offset = itableMethodEntry::size() * HeapWordSize * itable_index.as_constant() +
|
||||
itableMethodEntry::method_offset_in_bytes();
|
||||
add_slow(method_result, Rklass, method_offset);
|
||||
ldr(method_result, Address(method_result, Rtmp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef COMPILER2
|
||||
|
||||
@ -1316,7 +1316,7 @@ public:
|
||||
|
||||
void lookup_interface_method(Register recv_klass,
|
||||
Register intf_klass,
|
||||
Register itable_index,
|
||||
RegisterOrConstant itable_index,
|
||||
Register method_result,
|
||||
Register temp_reg1,
|
||||
Register temp_reg2,
|
||||
|
||||
@ -987,7 +987,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
|
||||
__ load_klass(receiver_klass, receiver);
|
||||
__ ldr(holder_klass, Address(Ricklass, CompiledICHolder::holder_klass_offset()));
|
||||
__ ldr(Rmethod, Address(Ricklass, CompiledICHolder::holder_method_offset()));
|
||||
__ ldr(Rmethod, Address(Ricklass, CompiledICHolder::holder_metadata_offset()));
|
||||
__ cmp(receiver_klass, holder_klass);
|
||||
|
||||
#ifdef AARCH64
|
||||
|
||||
@ -4192,7 +4192,7 @@ void TemplateTable::invokeinterface(int byte_no) {
|
||||
const Register Rflags = R3_tmp;
|
||||
const Register Rklass = R3_tmp;
|
||||
|
||||
prepare_invoke(byte_no, Rinterf, Rindex, Rrecv, Rflags);
|
||||
prepare_invoke(byte_no, Rinterf, Rmethod, Rrecv, Rflags);
|
||||
|
||||
// Special case of invokeinterface called for virtual method of
|
||||
// java.lang.Object. See cpCacheOop.cpp for details.
|
||||
@ -4201,56 +4201,39 @@ void TemplateTable::invokeinterface(int byte_no) {
|
||||
Label notMethod;
|
||||
__ tbz(Rflags, ConstantPoolCacheEntry::is_forced_virtual_shift, notMethod);
|
||||
|
||||
__ mov(Rmethod, Rindex);
|
||||
invokevirtual_helper(Rmethod, Rrecv, Rflags);
|
||||
__ bind(notMethod);
|
||||
|
||||
// Get receiver klass into Rklass - also a null check
|
||||
__ load_klass(Rklass, Rrecv);
|
||||
|
||||
Label no_such_interface;
|
||||
|
||||
// Receiver subtype check against REFC.
|
||||
__ lookup_interface_method(// inputs: rec. class, interface
|
||||
Rklass, Rinterf, noreg,
|
||||
// outputs: scan temp. reg1, scan temp. reg2
|
||||
noreg, Ritable, Rtemp,
|
||||
no_such_interface);
|
||||
|
||||
// profile this call
|
||||
__ profile_virtual_call(R0_tmp, Rklass);
|
||||
|
||||
// Compute start of first itableOffsetEntry (which is at the end of the vtable)
|
||||
const int base = in_bytes(Klass::vtable_start_offset());
|
||||
assert(vtableEntry::size() == 1, "adjust the scaling in the code below");
|
||||
__ ldr_s32(Rtemp, Address(Rklass, Klass::vtable_length_offset())); // Get length of vtable
|
||||
__ add(Ritable, Rklass, base);
|
||||
__ add(Ritable, Ritable, AsmOperand(Rtemp, lsl, LogBytesPerWord));
|
||||
// Get declaring interface class from method
|
||||
__ ldr(Rtemp, Address(Rmethod, Method::const_offset()));
|
||||
__ ldr(Rtemp, Address(Rtemp, ConstMethod::constants_offset()));
|
||||
__ ldr(Rinterf, Address(Rtemp, ConstantPool::pool_holder_offset_in_bytes()));
|
||||
|
||||
Label entry, search, interface_ok;
|
||||
// Get itable index from method
|
||||
__ ldr_s32(Rtemp, Address(Rmethod, Method::itable_index_offset()));
|
||||
__ add(Rtemp, Rtemp, (-Method::itable_index_max)); // small negative constant is too large for an immediate on arm32
|
||||
__ neg(Rindex, Rtemp);
|
||||
|
||||
__ b(entry);
|
||||
|
||||
__ bind(search);
|
||||
__ add(Ritable, Ritable, itableOffsetEntry::size() * HeapWordSize);
|
||||
|
||||
__ bind(entry);
|
||||
|
||||
// Check that the entry is non-null. A null entry means that the receiver
|
||||
// class doesn't implement the interface, and wasn't the same as the
|
||||
// receiver class checked when the interface was resolved.
|
||||
|
||||
__ ldr(Rtemp, Address(Ritable, itableOffsetEntry::interface_offset_in_bytes()));
|
||||
__ cbnz(Rtemp, interface_ok);
|
||||
|
||||
// throw exception
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address,
|
||||
InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
|
||||
// the call_VM checks for exception, so we should never return here.
|
||||
__ should_not_reach_here();
|
||||
|
||||
__ bind(interface_ok);
|
||||
|
||||
__ cmp(Rinterf, Rtemp);
|
||||
__ b(search, ne);
|
||||
|
||||
__ ldr_s32(Rtemp, Address(Ritable, itableOffsetEntry::offset_offset_in_bytes()));
|
||||
__ add(Rtemp, Rtemp, Rklass); // Add offset to Klass*
|
||||
assert(itableMethodEntry::size() == 1, "adjust the scaling in the code below");
|
||||
|
||||
__ ldr(Rmethod, Address::indexed_ptr(Rtemp, Rindex));
|
||||
__ lookup_interface_method(// inputs: rec. class, interface
|
||||
Rklass, Rinterf, Rindex,
|
||||
// outputs: scan temp. reg1, scan temp. reg2
|
||||
Rmethod, Ritable, Rtemp,
|
||||
no_such_interface);
|
||||
|
||||
// Rmethod: Method* to call
|
||||
|
||||
@ -4272,6 +4255,13 @@ void TemplateTable::invokeinterface(int byte_no) {
|
||||
|
||||
// do the call
|
||||
__ jump_from_interpreted(Rmethod);
|
||||
|
||||
// throw exception
|
||||
__ bind(no_such_interface);
|
||||
__ restore_method();
|
||||
__ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
// the call_VM checks for exception, so we should never return here.
|
||||
__ should_not_reach_here();
|
||||
}
|
||||
|
||||
void TemplateTable::invokehandle(int byte_no) {
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "code/vtableStubs.hpp"
|
||||
#include "interp_masm_arm.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/compiledICHolder.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
@ -118,67 +119,48 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
|
||||
// R0-R3 / R0-R7 registers hold the arguments and cannot be spoiled
|
||||
const Register Rclass = AARCH64_ONLY(R9) NOT_AARCH64(R4);
|
||||
const Register Rlength = AARCH64_ONLY(R10) NOT_AARCH64(R5);
|
||||
const Register Rintf = AARCH64_ONLY(R10) NOT_AARCH64(R5);
|
||||
const Register Rscan = AARCH64_ONLY(R11) NOT_AARCH64(R6);
|
||||
const Register tmp = Rtemp;
|
||||
|
||||
assert_different_registers(Ricklass, Rclass, Rlength, Rscan, tmp);
|
||||
assert_different_registers(Ricklass, Rclass, Rintf, Rscan, Rtemp);
|
||||
|
||||
// Calculate the start of itable (itable goes after vtable)
|
||||
const int scale = exact_log2(vtableEntry::size_in_bytes());
|
||||
address npe_addr = __ pc();
|
||||
__ load_klass(Rclass, R0);
|
||||
__ ldr_s32(Rlength, Address(Rclass, Klass::vtable_length_offset()));
|
||||
|
||||
__ add(Rscan, Rclass, in_bytes(Klass::vtable_start_offset()));
|
||||
__ add(Rscan, Rscan, AsmOperand(Rlength, lsl, scale));
|
||||
Label L_no_such_interface;
|
||||
|
||||
// Search through the itable for an interface equal to incoming Ricklass
|
||||
// itable looks like [intface][offset][intface][offset][intface][offset]
|
||||
const int entry_size = itableOffsetEntry::size() * HeapWordSize;
|
||||
assert(itableOffsetEntry::interface_offset_in_bytes() == 0, "not added for convenience");
|
||||
// Receiver subtype check against REFC.
|
||||
__ ldr(Rintf, Address(Ricklass, CompiledICHolder::holder_klass_offset()));
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
Rclass, Rintf, noreg,
|
||||
// outputs: temp reg1, temp reg2
|
||||
noreg, Rscan, Rtemp,
|
||||
L_no_such_interface);
|
||||
|
||||
Label loop;
|
||||
__ bind(loop);
|
||||
__ ldr(tmp, Address(Rscan, entry_size, post_indexed));
|
||||
#ifdef AARCH64
|
||||
Label found;
|
||||
__ cmp(tmp, Ricklass);
|
||||
__ b(found, eq);
|
||||
__ cbnz(tmp, loop);
|
||||
#else
|
||||
__ cmp(tmp, Ricklass); // set ZF and CF if interface is found
|
||||
__ cmn(tmp, 0, ne); // check if tmp == 0 and clear CF if it is
|
||||
__ b(loop, ne);
|
||||
#endif // AARCH64
|
||||
|
||||
assert(StubRoutines::throw_IncompatibleClassChangeError_entry() != NULL, "Check initialization order");
|
||||
#ifdef AARCH64
|
||||
__ jump(StubRoutines::throw_IncompatibleClassChangeError_entry(), relocInfo::runtime_call_type, tmp);
|
||||
__ bind(found);
|
||||
#else
|
||||
// CF == 0 means we reached the end of itable without finding icklass
|
||||
__ jump(StubRoutines::throw_IncompatibleClassChangeError_entry(), relocInfo::runtime_call_type, noreg, cc);
|
||||
#endif // !AARCH64
|
||||
|
||||
// Interface found at previous position of Rscan, now load the method oop
|
||||
__ ldr_s32(tmp, Address(Rscan, itableOffsetEntry::offset_offset_in_bytes() - entry_size));
|
||||
{
|
||||
const int method_offset = itableMethodEntry::size() * HeapWordSize * itable_index +
|
||||
itableMethodEntry::method_offset_in_bytes();
|
||||
__ add_slow(Rmethod, Rclass, method_offset);
|
||||
}
|
||||
__ ldr(Rmethod, Address(Rmethod, tmp));
|
||||
// Get Method* and entry point for compiler
|
||||
__ ldr(Rintf, Address(Ricklass, CompiledICHolder::holder_metadata_offset()));
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
Rclass, Rintf, itable_index,
|
||||
// outputs: temp reg1, temp reg2, temp reg3
|
||||
Rmethod, Rscan, Rtemp,
|
||||
L_no_such_interface);
|
||||
|
||||
address ame_addr = __ pc();
|
||||
|
||||
#ifdef AARCH64
|
||||
__ ldr(tmp, Address(Rmethod, Method::from_compiled_offset()));
|
||||
__ br(tmp);
|
||||
__ ldr(Rtemp, Address(Rmethod, Method::from_compiled_offset()));
|
||||
__ br(Rtemp);
|
||||
#else
|
||||
__ ldr(PC, Address(Rmethod, Method::from_compiled_offset()));
|
||||
#endif // AARCH64
|
||||
|
||||
__ bind(L_no_such_interface);
|
||||
|
||||
assert(StubRoutines::throw_IncompatibleClassChangeError_entry() != NULL, "check initialization order");
|
||||
__ jump(StubRoutines::throw_IncompatibleClassChangeError_entry(), relocInfo::runtime_call_type, Rtemp);
|
||||
|
||||
masm->flush();
|
||||
|
||||
if (PrintMiscellaneous && (WizardMode || Verbose)) {
|
||||
@ -205,7 +187,7 @@ int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
|
||||
instr_count = NOT_AARCH64(4) AARCH64_ONLY(5);
|
||||
} else {
|
||||
// itable stub size
|
||||
instr_count = NOT_AARCH64(20) AARCH64_ONLY(20);
|
||||
instr_count = NOT_AARCH64(31) AARCH64_ONLY(31);
|
||||
}
|
||||
|
||||
#ifdef AARCH64
|
||||
|
||||
@ -1185,7 +1185,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
// Argument is valid and klass is as expected, continue.
|
||||
|
||||
// Extract method from inline cache, verified entry point needs it.
|
||||
__ ld(R19_method, CompiledICHolder::holder_method_offset(), ic);
|
||||
__ ld(R19_method, CompiledICHolder::holder_metadata_offset(), ic);
|
||||
assert(R19_method == ic, "the inline cache register is dead here");
|
||||
|
||||
__ ld(code, method_(code));
|
||||
|
||||
@ -291,7 +291,7 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
|
||||
length.set_instruction(x->length());
|
||||
length.load_item();
|
||||
}
|
||||
if (needs_store_check) {
|
||||
if (needs_store_check || x->check_boolean()) {
|
||||
value.load_item();
|
||||
} else {
|
||||
value.load_for_store(x->elt_type());
|
||||
@ -341,11 +341,14 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
|
||||
// Needs GC write barriers.
|
||||
pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */,
|
||||
true /* do_load */, false /* patch */, NULL);
|
||||
__ move(value.result(), array_addr, null_check_info);
|
||||
// Seems to be a precise.
|
||||
}
|
||||
|
||||
LIR_Opr result = maybe_mask_boolean(x, array.result(), value.result(), null_check_info);
|
||||
__ move(result, array_addr, null_check_info);
|
||||
|
||||
if (obj_store) {
|
||||
// Precise card mark
|
||||
post_barrier(LIR_OprFact::address(array_addr), value.result());
|
||||
} else {
|
||||
__ move(value.result(), array_addr, null_check_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -842,6 +842,38 @@ void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
|
||||
verify_oop(Z_tos, state);
|
||||
}
|
||||
|
||||
void InterpreterMacroAssembler::narrow(Register result, Register ret_type) {
|
||||
get_method(ret_type);
|
||||
z_lg(ret_type, Address(ret_type, in_bytes(Method::const_offset())));
|
||||
z_lb(ret_type, Address(ret_type, in_bytes(ConstMethod::result_type_offset())));
|
||||
|
||||
Label notBool, notByte, notChar, done;
|
||||
|
||||
// common case first
|
||||
compareU32_and_branch(ret_type, T_INT, bcondEqual, done);
|
||||
|
||||
compareU32_and_branch(ret_type, T_BOOLEAN, bcondNotEqual, notBool);
|
||||
z_nilf(result, 0x1);
|
||||
z_bru(done);
|
||||
|
||||
bind(notBool);
|
||||
compareU32_and_branch(ret_type, T_BYTE, bcondNotEqual, notByte);
|
||||
z_lbr(result, result);
|
||||
z_bru(done);
|
||||
|
||||
bind(notByte);
|
||||
compareU32_and_branch(ret_type, T_CHAR, bcondNotEqual, notChar);
|
||||
z_nilf(result, 0xffff);
|
||||
z_bru(done);
|
||||
|
||||
bind(notChar);
|
||||
// compareU32_and_branch(ret_type, T_SHORT, bcondNotEqual, notShort);
|
||||
z_lhr(result, result);
|
||||
|
||||
// Nothing to do for T_INT
|
||||
bind(done);
|
||||
}
|
||||
|
||||
// remove activation
|
||||
//
|
||||
// Unlock the receiver if this is a synchronized method.
|
||||
|
||||
@ -86,6 +86,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
||||
void dispatch_next_noverify_oop(TosState state, int step = 0);
|
||||
void dispatch_via(TosState state, address* table);
|
||||
|
||||
void narrow(Register result, Register ret_type);
|
||||
|
||||
// Jump to an invoked target.
|
||||
void prepare_to_jump_from_interpreted(Register method);
|
||||
void jump_from_interpreted(Register method, Register temp);
|
||||
|
||||
@ -2628,9 +2628,9 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
Label skip_fixup;
|
||||
{
|
||||
Label ic_miss;
|
||||
const int klass_offset = oopDesc::klass_offset_in_bytes();
|
||||
const int holder_klass_offset = CompiledICHolder::holder_klass_offset();
|
||||
const int holder_method_offset = CompiledICHolder::holder_method_offset();
|
||||
const int klass_offset = oopDesc::klass_offset_in_bytes();
|
||||
const int holder_klass_offset = CompiledICHolder::holder_klass_offset();
|
||||
const int holder_metadata_offset = CompiledICHolder::holder_metadata_offset();
|
||||
|
||||
// Out-of-line call to ic_miss handler.
|
||||
__ call_ic_miss_handler(ic_miss, 0x11, 0, Z_R1_scratch);
|
||||
@ -2659,7 +2659,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
// This def MUST MATCH code in gen_c2i_adapter!
|
||||
const Register code = Z_R11;
|
||||
|
||||
__ z_lg(Z_method, holder_method_offset, Z_method);
|
||||
__ z_lg(Z_method, holder_metadata_offset, Z_method);
|
||||
__ load_and_test_long(Z_R0, method_(code));
|
||||
__ z_brne(ic_miss); // Cache miss: call runtime to handle this.
|
||||
|
||||
|
||||
@ -2314,6 +2314,12 @@ address TemplateInterpreterGenerator::generate_earlyret_entry_for (TosState stat
|
||||
__ store_const(Address(RjvmtiState, JvmtiThreadState::earlyret_state_offset()),
|
||||
JvmtiThreadState::earlyret_inactive, 4, 4, Z_R0_scratch);
|
||||
|
||||
if (state == itos) {
|
||||
// Narrow result if state is itos but result type is smaller.
|
||||
// Need to narrow in the return bytecode rather than in generate_return_entry
|
||||
// since compiled code callers expect the result to already be narrowed.
|
||||
__ narrow(Z_tos, Z_tmp_1); /* fall through */
|
||||
}
|
||||
__ remove_activation(state,
|
||||
Z_tmp_1, // retaddr
|
||||
false, // throw_monitor_exception
|
||||
|
||||
@ -1174,8 +1174,20 @@ void TemplateTable::bastore() {
|
||||
__ pop_i(Z_ARG3);
|
||||
__ pop_ptr(Z_tmp_2);
|
||||
// Z_tos : value
|
||||
// Z_ARG3 : index
|
||||
// Z_ARG3 : index
|
||||
// Z_tmp_2 : array
|
||||
|
||||
// Need to check whether array is boolean or byte
|
||||
// since both types share the bastore bytecode.
|
||||
__ load_klass(Z_tmp_1, Z_tmp_2);
|
||||
__ z_llgf(Z_tmp_1, Address(Z_tmp_1, Klass::layout_helper_offset()));
|
||||
__ z_tmll(Z_tmp_1, Klass::layout_helper_boolean_diffbit());
|
||||
Label L_skip;
|
||||
__ z_bfalse(L_skip);
|
||||
// if it is a T_BOOLEAN array, mask the stored value to 0/1
|
||||
__ z_nilf(Z_tos, 0x1);
|
||||
__ bind(L_skip);
|
||||
|
||||
// No index shift necessary - pass 0.
|
||||
index_check(Z_tmp_2, Z_ARG3, 0); // Prefer index in Z_ARG3.
|
||||
__ z_stc(Z_tos,
|
||||
@ -2321,6 +2333,13 @@ void TemplateTable::_return(TosState state) {
|
||||
__ bind(skip_register_finalizer);
|
||||
}
|
||||
|
||||
if (state == itos) {
|
||||
// Narrow result if state is itos but result type is smaller.
|
||||
// Need to narrow in the return bytecode rather than in generate_return_entry
|
||||
// since compiled code callers expect the result to already be narrowed.
|
||||
__ narrow(Z_tos, Z_tmp_1); /* fall through */
|
||||
}
|
||||
|
||||
__ remove_activation(state, Z_R14);
|
||||
__ z_br(Z_R14);
|
||||
}
|
||||
|
||||
@ -2069,9 +2069,10 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||
Register method_result,
|
||||
Register scan_temp,
|
||||
Register sethi_temp,
|
||||
Label& L_no_such_interface) {
|
||||
Label& L_no_such_interface,
|
||||
bool return_method) {
|
||||
assert_different_registers(recv_klass, intf_klass, method_result, scan_temp);
|
||||
assert(itable_index.is_constant() || itable_index.as_register() == method_result,
|
||||
assert(!return_method || itable_index.is_constant() || itable_index.as_register() == method_result,
|
||||
"caller must use same register for non-constant itable index as for method");
|
||||
|
||||
Label L_no_such_interface_restore;
|
||||
@ -2103,11 +2104,13 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||
add(scan_temp, itb_offset, scan_temp);
|
||||
add(recv_klass, scan_temp, scan_temp);
|
||||
|
||||
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
|
||||
RegisterOrConstant itable_offset = itable_index;
|
||||
itable_offset = regcon_sll_ptr(itable_index, exact_log2(itableMethodEntry::size() * wordSize), itable_offset);
|
||||
itable_offset = regcon_inc_ptr(itable_offset, itableMethodEntry::method_offset_in_bytes(), itable_offset);
|
||||
add(recv_klass, ensure_simm13_or_reg(itable_offset, sethi_temp), recv_klass);
|
||||
if (return_method) {
|
||||
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
|
||||
RegisterOrConstant itable_offset = itable_index;
|
||||
itable_offset = regcon_sll_ptr(itable_index, exact_log2(itableMethodEntry::size() * wordSize), itable_offset);
|
||||
itable_offset = regcon_inc_ptr(itable_offset, itableMethodEntry::method_offset_in_bytes(), itable_offset);
|
||||
add(recv_klass, ensure_simm13_or_reg(itable_offset, sethi_temp), recv_klass);
|
||||
}
|
||||
|
||||
// for (scan = klass->itable(); scan->interface() != NULL; scan += scan_step) {
|
||||
// if (scan->interface() == intf) {
|
||||
@ -2142,12 +2145,14 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||
|
||||
bind(L_found_method);
|
||||
|
||||
// Got a hit.
|
||||
int ito_offset = itableOffsetEntry::offset_offset_in_bytes();
|
||||
// scan_temp[-scan_step] points to the vtable offset we need
|
||||
ito_offset -= scan_step;
|
||||
lduw(scan_temp, ito_offset, scan_temp);
|
||||
ld_ptr(recv_klass, scan_temp, method_result);
|
||||
if (return_method) {
|
||||
// Got a hit.
|
||||
int ito_offset = itableOffsetEntry::offset_offset_in_bytes();
|
||||
// scan_temp[-scan_step] points to the vtable offset we need
|
||||
ito_offset -= scan_step;
|
||||
lduw(scan_temp, ito_offset, scan_temp);
|
||||
ld_ptr(recv_klass, scan_temp, method_result);
|
||||
}
|
||||
|
||||
if (did_save) {
|
||||
Label L_done;
|
||||
|
||||
@ -1290,7 +1290,8 @@ public:
|
||||
RegisterOrConstant itable_index,
|
||||
Register method_result,
|
||||
Register temp_reg, Register temp2_reg,
|
||||
Label& no_such_interface);
|
||||
Label& no_such_interface,
|
||||
bool return_method = true);
|
||||
|
||||
// virtual method calling
|
||||
void lookup_virtual_method(Register recv_klass,
|
||||
|
||||
@ -1079,7 +1079,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
|
||||
Label ok, ok2;
|
||||
__ brx(Assembler::equal, false, Assembler::pt, ok);
|
||||
__ delayed()->ld_ptr(G5_method, CompiledICHolder::holder_method_offset(), G5_method);
|
||||
__ delayed()->ld_ptr(G5_method, CompiledICHolder::holder_metadata_offset(), G5_method);
|
||||
__ jump_to(ic_miss, G3_scratch);
|
||||
__ delayed()->nop();
|
||||
|
||||
|
||||
@ -3173,15 +3173,15 @@ void TemplateTable::invokeinterface(int byte_no) {
|
||||
assert(byte_no == f1_byte, "use this argument");
|
||||
|
||||
const Register Rinterface = G1_scratch;
|
||||
const Register Rmethod = Lscratch;
|
||||
const Register Rret = G3_scratch;
|
||||
const Register Rindex = Lscratch;
|
||||
const Register O0_recv = O0;
|
||||
const Register O1_flags = O1;
|
||||
const Register O2_Klass = O2;
|
||||
const Register Rscratch = G4_scratch;
|
||||
assert_different_registers(Rscratch, G5_method);
|
||||
|
||||
prepare_invoke(byte_no, Rinterface, Rret, Rindex, O0_recv, O1_flags);
|
||||
prepare_invoke(byte_no, Rinterface, Rret, Rmethod, O0_recv, O1_flags);
|
||||
|
||||
// get receiver klass
|
||||
__ null_check(O0_recv, oopDesc::klass_offset_in_bytes());
|
||||
@ -3201,55 +3201,40 @@ void TemplateTable::invokeinterface(int byte_no) {
|
||||
|
||||
__ bind(notMethod);
|
||||
|
||||
Register Rtemp = O1_flags;
|
||||
|
||||
Label L_no_such_interface;
|
||||
|
||||
// Receiver subtype check against REFC.
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
O2_Klass, Rinterface, noreg,
|
||||
// outputs: temp reg1, temp reg2, temp reg3
|
||||
G5_method, Rscratch, Rtemp,
|
||||
L_no_such_interface,
|
||||
/*return_method=*/false);
|
||||
|
||||
__ profile_virtual_call(O2_Klass, O4);
|
||||
|
||||
//
|
||||
// find entry point to call
|
||||
//
|
||||
|
||||
// compute start of first itableOffsetEntry (which is at end of vtable)
|
||||
const int base = in_bytes(Klass::vtable_start_offset());
|
||||
Label search;
|
||||
Register Rtemp = O1_flags;
|
||||
// Get declaring interface class from method
|
||||
__ ld_ptr(Rmethod, Method::const_offset(), Rinterface);
|
||||
__ ld_ptr(Rinterface, ConstMethod::constants_offset(), Rinterface);
|
||||
__ ld_ptr(Rinterface, ConstantPool::pool_holder_offset_in_bytes(), Rinterface);
|
||||
|
||||
__ ld(O2_Klass, in_bytes(Klass::vtable_length_offset()), Rtemp);
|
||||
__ sll(Rtemp, LogBytesPerWord, Rtemp); // Rscratch *= 4;
|
||||
if (Assembler::is_simm13(base)) {
|
||||
__ add(Rtemp, base, Rtemp);
|
||||
} else {
|
||||
__ set(base, Rscratch);
|
||||
__ add(Rscratch, Rtemp, Rtemp);
|
||||
}
|
||||
__ add(O2_Klass, Rtemp, Rscratch);
|
||||
// Get itable index from method
|
||||
const Register Rindex = G5_method;
|
||||
__ ld(Rmethod, Method::itable_index_offset(), Rindex);
|
||||
__ sub(Rindex, Method::itable_index_max, Rindex);
|
||||
__ neg(Rindex);
|
||||
|
||||
__ bind(search);
|
||||
|
||||
__ ld_ptr(Rscratch, itableOffsetEntry::interface_offset_in_bytes(), Rtemp);
|
||||
{
|
||||
Label ok;
|
||||
|
||||
// Check that entry is non-null. Null entries are probably a bytecode
|
||||
// problem. If the interface isn't implemented by the receiver class,
|
||||
// the VM should throw IncompatibleClassChangeError. linkResolver checks
|
||||
// this too but that's only if the entry isn't already resolved, so we
|
||||
// need to check again.
|
||||
__ br_notnull_short( Rtemp, Assembler::pt, ok);
|
||||
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
__ should_not_reach_here();
|
||||
__ bind(ok);
|
||||
}
|
||||
|
||||
__ cmp(Rinterface, Rtemp);
|
||||
__ brx(Assembler::notEqual, true, Assembler::pn, search);
|
||||
__ delayed()->add(Rscratch, itableOffsetEntry::size() * wordSize, Rscratch);
|
||||
|
||||
// entry found and Rscratch points to it
|
||||
__ ld(Rscratch, itableOffsetEntry::offset_offset_in_bytes(), Rscratch);
|
||||
|
||||
assert(itableMethodEntry::method_offset_in_bytes() == 0, "adjust instruction below");
|
||||
__ sll(Rindex, exact_log2(itableMethodEntry::size() * wordSize), Rindex); // Rindex *= 8;
|
||||
__ add(Rscratch, Rindex, Rscratch);
|
||||
__ ld_ptr(O2_Klass, Rscratch, G5_method);
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
O2_Klass, Rinterface, Rindex,
|
||||
// outputs: method, scan temp reg, temp reg
|
||||
G5_method, Rscratch, Rtemp,
|
||||
L_no_such_interface);
|
||||
|
||||
// Check for abstract method error.
|
||||
{
|
||||
@ -3266,6 +3251,10 @@ void TemplateTable::invokeinterface(int byte_no) {
|
||||
__ profile_arguments_type(G5_method, Rcall, Gargs, true);
|
||||
__ profile_called_method(G5_method, Rscratch);
|
||||
__ call_from_interpreter(Rcall, Gargs, Rret);
|
||||
|
||||
__ bind(L_no_such_interface);
|
||||
call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));
|
||||
__ should_not_reach_here();
|
||||
}
|
||||
|
||||
void TemplateTable::invokehandle(int byte_no) {
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "code/vtableStubs.hpp"
|
||||
#include "interp_masm_sparc.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/compiledICHolder.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
@ -140,7 +141,8 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
MacroAssembler* masm = new MacroAssembler(&cb);
|
||||
|
||||
Register G3_Klass = G3_scratch;
|
||||
Register G5_interface = G5; // Passed in as an argument
|
||||
Register G5_icholder = G5; // Passed in as an argument
|
||||
Register G4_interface = G4_scratch;
|
||||
Label search;
|
||||
|
||||
// Entry arguments:
|
||||
@ -164,14 +166,26 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
}
|
||||
#endif /* PRODUCT */
|
||||
|
||||
Label throw_icce;
|
||||
Label L_no_such_interface;
|
||||
|
||||
Register L5_method = L5;
|
||||
|
||||
// Receiver subtype check against REFC.
|
||||
__ ld_ptr(G5_icholder, CompiledICHolder::holder_klass_offset(), G4_interface);
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
G3_Klass, G5_interface, itable_index,
|
||||
G3_Klass, G4_interface, itable_index,
|
||||
// outputs: scan temp. reg1, scan temp. reg2
|
||||
L5_method, L2, L3,
|
||||
L_no_such_interface,
|
||||
/*return_method=*/ false);
|
||||
|
||||
// Get Method* and entrypoint for compiler
|
||||
__ ld_ptr(G5_icholder, CompiledICHolder::holder_metadata_offset(), G4_interface);
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
G3_Klass, G4_interface, itable_index,
|
||||
// outputs: method, scan temp. reg
|
||||
L5_method, L2, L3,
|
||||
throw_icce);
|
||||
L_no_such_interface);
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (DebugVtables) {
|
||||
@ -197,7 +211,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
__ JMP(G3_scratch, 0);
|
||||
__ delayed()->nop();
|
||||
|
||||
__ bind(throw_icce);
|
||||
__ bind(L_no_such_interface);
|
||||
AddressLiteral icce(StubRoutines::throw_IncompatibleClassChangeError_entry());
|
||||
__ jump_to(icce, G3_scratch);
|
||||
__ delayed()->restore();
|
||||
@ -232,7 +246,7 @@ int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
|
||||
MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
|
||||
return basic + slop;
|
||||
} else {
|
||||
const int basic = (28 LP64_ONLY(+ 6)) * BytesPerInstWord +
|
||||
const int basic = (48 LP64_ONLY(+ 6)) * BytesPerInstWord +
|
||||
// shift;add for load_klass (only shift with zero heap based)
|
||||
(UseCompressedClassPointers ?
|
||||
MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
|
||||
|
||||
@ -5733,8 +5733,13 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||
RegisterOrConstant itable_index,
|
||||
Register method_result,
|
||||
Register scan_temp,
|
||||
Label& L_no_such_interface) {
|
||||
assert_different_registers(recv_klass, intf_klass, method_result, scan_temp);
|
||||
Label& L_no_such_interface,
|
||||
bool return_method) {
|
||||
assert_different_registers(recv_klass, intf_klass, scan_temp);
|
||||
assert_different_registers(method_result, intf_klass, scan_temp);
|
||||
assert(recv_klass != method_result || !return_method,
|
||||
"recv_klass can be destroyed when method isn't needed");
|
||||
|
||||
assert(itable_index.is_constant() || itable_index.as_register() == method_result,
|
||||
"caller must use same register for non-constant itable index as for method");
|
||||
|
||||
@ -5751,9 +5756,11 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||
// %%% Could store the aligned, prescaled offset in the klassoop.
|
||||
lea(scan_temp, Address(recv_klass, scan_temp, times_vte_scale, vtable_base));
|
||||
|
||||
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
|
||||
assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
|
||||
lea(recv_klass, Address(recv_klass, itable_index, Address::times_ptr, itentry_off));
|
||||
if (return_method) {
|
||||
// Adjust recv_klass by scaled itable_index, so we can free itable_index.
|
||||
assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below");
|
||||
lea(recv_klass, Address(recv_klass, itable_index, Address::times_ptr, itentry_off));
|
||||
}
|
||||
|
||||
// for (scan = klass->itable(); scan->interface() != NULL; scan += scan_step) {
|
||||
// if (scan->interface() == intf) {
|
||||
@ -5787,9 +5794,11 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
|
||||
|
||||
bind(found_method);
|
||||
|
||||
// Got a hit.
|
||||
movl(scan_temp, Address(scan_temp, itableOffsetEntry::offset_offset_in_bytes()));
|
||||
movptr(method_result, Address(recv_klass, scan_temp, Address::times_1));
|
||||
if (return_method) {
|
||||
// Got a hit.
|
||||
movl(scan_temp, Address(scan_temp, itableOffsetEntry::offset_offset_in_bytes()));
|
||||
movptr(method_result, Address(recv_klass, scan_temp, Address::times_1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -538,7 +538,8 @@ class MacroAssembler: public Assembler {
|
||||
RegisterOrConstant itable_index,
|
||||
Register method_result,
|
||||
Register scan_temp,
|
||||
Label& no_such_interface);
|
||||
Label& no_such_interface,
|
||||
bool return_method = true);
|
||||
|
||||
// virtual method calling
|
||||
void lookup_virtual_method(Register recv_klass,
|
||||
|
||||
@ -952,7 +952,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
Label missed;
|
||||
__ movptr(temp, Address(receiver, oopDesc::klass_offset_in_bytes()));
|
||||
__ cmpptr(temp, Address(holder, CompiledICHolder::holder_klass_offset()));
|
||||
__ movptr(rbx, Address(holder, CompiledICHolder::holder_method_offset()));
|
||||
__ movptr(rbx, Address(holder, CompiledICHolder::holder_metadata_offset()));
|
||||
__ jcc(Assembler::notEqual, missed);
|
||||
// Method might have been compiled since the call site was patched to
|
||||
// interpreted if that is the case treat it as a miss so we can get
|
||||
|
||||
@ -942,7 +942,7 @@ AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm
|
||||
{
|
||||
__ load_klass(temp, receiver);
|
||||
__ cmpptr(temp, Address(holder, CompiledICHolder::holder_klass_offset()));
|
||||
__ movptr(rbx, Address(holder, CompiledICHolder::holder_method_offset()));
|
||||
__ movptr(rbx, Address(holder, CompiledICHolder::holder_metadata_offset()));
|
||||
__ jcc(Assembler::equal, ok);
|
||||
__ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
|
||||
|
||||
|
||||
@ -3695,11 +3695,11 @@ void TemplateTable::fast_invokevfinal(int byte_no) {
|
||||
void TemplateTable::invokeinterface(int byte_no) {
|
||||
transition(vtos, vtos);
|
||||
assert(byte_no == f1_byte, "use this argument");
|
||||
prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 itable index
|
||||
prepare_invoke(byte_no, rax, rbx, // get f1 Klass*, f2 Method*
|
||||
rcx, rdx); // recv, flags
|
||||
|
||||
// rax: interface klass (from f1)
|
||||
// rbx: itable index (from f2)
|
||||
// rax: reference klass (from f1)
|
||||
// rbx: method (from f2)
|
||||
// rcx: receiver
|
||||
// rdx: flags
|
||||
|
||||
@ -3721,10 +3721,28 @@ void TemplateTable::invokeinterface(int byte_no) {
|
||||
__ null_check(rcx, oopDesc::klass_offset_in_bytes());
|
||||
__ load_klass(rdx, rcx);
|
||||
|
||||
Label no_such_interface, no_such_method;
|
||||
|
||||
// Receiver subtype check against REFC.
|
||||
// Superklass in rax. Subklass in rdx. Blows rcx, rdi.
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
rdx, rax, noreg,
|
||||
// outputs: scan temp. reg, scan temp. reg
|
||||
rbcp, rlocals,
|
||||
no_such_interface,
|
||||
/*return_method=*/false);
|
||||
|
||||
// profile this call
|
||||
__ restore_bcp(); // rbcp was destroyed by receiver type check
|
||||
__ profile_virtual_call(rdx, rbcp, rlocals);
|
||||
|
||||
Label no_such_interface, no_such_method;
|
||||
// Get declaring interface class from method, and itable index
|
||||
__ movptr(rax, Address(rbx, Method::const_offset()));
|
||||
__ movptr(rax, Address(rax, ConstMethod::constants_offset()));
|
||||
__ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes()));
|
||||
__ movl(rbx, Address(rbx, Method::itable_index_offset()));
|
||||
__ subl(rbx, Method::itable_index_max);
|
||||
__ negl(rbx);
|
||||
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
rdx, rax, rbx,
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "code/vtableStubs.hpp"
|
||||
#include "interp_masm_x86.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/compiledICHolder.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
@ -147,7 +148,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
MacroAssembler* masm = new MacroAssembler(&cb);
|
||||
|
||||
// Entry arguments:
|
||||
// rax,: Interface
|
||||
// rax: CompiledICHolder
|
||||
// rcx: Receiver
|
||||
|
||||
#ifndef PRODUCT
|
||||
@ -155,25 +156,42 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
__ incrementl(ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr()));
|
||||
}
|
||||
#endif /* PRODUCT */
|
||||
// get receiver (need to skip return address on top of stack)
|
||||
|
||||
assert(VtableStub::receiver_location() == rcx->as_VMReg(), "receiver expected in rcx");
|
||||
|
||||
// get receiver klass (also an implicit null-check)
|
||||
address npe_addr = __ pc();
|
||||
__ movptr(rsi, Address(rcx, oopDesc::klass_offset_in_bytes()));
|
||||
|
||||
// Most registers are in use; we'll use rax, rbx, rsi, rdi
|
||||
// (If we need to make rsi, rdi callee-save, do a push/pop here.)
|
||||
const Register method = rbx;
|
||||
Label throw_icce;
|
||||
const Register recv_klass_reg = rsi;
|
||||
const Register holder_klass_reg = rax; // declaring interface klass (DECC)
|
||||
const Register resolved_klass_reg = rbx; // resolved interface klass (REFC)
|
||||
const Register temp_reg = rdi;
|
||||
|
||||
// Get Method* and entrypoint for compiler
|
||||
const Register icholder_reg = rax;
|
||||
__ movptr(resolved_klass_reg, Address(icholder_reg, CompiledICHolder::holder_klass_offset()));
|
||||
__ movptr(holder_klass_reg, Address(icholder_reg, CompiledICHolder::holder_metadata_offset()));
|
||||
|
||||
Label L_no_such_interface;
|
||||
|
||||
// get receiver klass (also an implicit null-check)
|
||||
address npe_addr = __ pc();
|
||||
assert(VtableStub::receiver_location() == rcx->as_VMReg(), "receiver expected in rcx");
|
||||
__ load_klass(recv_klass_reg, rcx);
|
||||
|
||||
// Receiver subtype check against REFC.
|
||||
// Destroys recv_klass_reg value.
|
||||
__ lookup_interface_method(// inputs: rec. class, interface
|
||||
recv_klass_reg, resolved_klass_reg, noreg,
|
||||
// outputs: scan temp. reg1, scan temp. reg2
|
||||
recv_klass_reg, temp_reg,
|
||||
L_no_such_interface,
|
||||
/*return_method=*/false);
|
||||
|
||||
// Get selected method from declaring class and itable index
|
||||
const Register method = rbx;
|
||||
__ load_klass(recv_klass_reg, rcx); // restore recv_klass_reg
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
rsi, rax, itable_index,
|
||||
recv_klass_reg, holder_klass_reg, itable_index,
|
||||
// outputs: method, scan temp. reg
|
||||
method, rdi,
|
||||
throw_icce);
|
||||
method, temp_reg,
|
||||
L_no_such_interface);
|
||||
|
||||
// method (rbx): Method*
|
||||
// rcx: receiver
|
||||
@ -193,9 +211,10 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
address ame_addr = __ pc();
|
||||
__ jmp(Address(method, Method::from_compiled_offset()));
|
||||
|
||||
__ bind(throw_icce);
|
||||
__ bind(L_no_such_interface);
|
||||
__ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
|
||||
masm->flush();
|
||||
|
||||
__ flush();
|
||||
|
||||
if (PrintMiscellaneous && (WizardMode || Verbose)) {
|
||||
tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d",
|
||||
@ -220,7 +239,7 @@ int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
|
||||
return (DebugVtables ? 210 : 16) + (CountCompiledCalls ? 6 : 0);
|
||||
} else {
|
||||
// Itable stub size
|
||||
return (DebugVtables ? 256 : 66) + (CountCompiledCalls ? 6 : 0);
|
||||
return (DebugVtables ? 256 : 110) + (CountCompiledCalls ? 6 : 0);
|
||||
}
|
||||
// In order to tune these parameters, run the JVM with VM options
|
||||
// +PrintMiscellaneous and +WizardMode to see information about
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "code/vtableStubs.hpp"
|
||||
#include "interp_masm_x86.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/compiledICHolder.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
@ -147,36 +148,50 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
#endif
|
||||
|
||||
// Entry arguments:
|
||||
// rax: Interface
|
||||
// rax: CompiledICHolder
|
||||
// j_rarg0: Receiver
|
||||
|
||||
// Free registers (non-args) are rax (interface), rbx
|
||||
|
||||
// get receiver (need to skip return address on top of stack)
|
||||
|
||||
assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0");
|
||||
// get receiver klass (also an implicit null-check)
|
||||
address npe_addr = __ pc();
|
||||
|
||||
// Most registers are in use; we'll use rax, rbx, r10, r11
|
||||
// (various calling sequences use r[cd]x, r[sd]i, r[89]; stay away from them)
|
||||
__ load_klass(r10, j_rarg0);
|
||||
const Register recv_klass_reg = r10;
|
||||
const Register holder_klass_reg = rax; // declaring interface klass (DECC)
|
||||
const Register resolved_klass_reg = rbx; // resolved interface klass (REFC)
|
||||
const Register temp_reg = r11;
|
||||
|
||||
Label L_no_such_interface;
|
||||
|
||||
const Register icholder_reg = rax;
|
||||
__ movptr(resolved_klass_reg, Address(icholder_reg, CompiledICHolder::holder_klass_offset()));
|
||||
__ movptr(holder_klass_reg, Address(icholder_reg, CompiledICHolder::holder_metadata_offset()));
|
||||
|
||||
// get receiver klass (also an implicit null-check)
|
||||
assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0");
|
||||
address npe_addr = __ pc();
|
||||
__ load_klass(recv_klass_reg, j_rarg0);
|
||||
|
||||
// Receiver subtype check against REFC.
|
||||
// Destroys recv_klass_reg value.
|
||||
__ lookup_interface_method(// inputs: rec. class, interface
|
||||
recv_klass_reg, resolved_klass_reg, noreg,
|
||||
// outputs: scan temp. reg1, scan temp. reg2
|
||||
recv_klass_reg, temp_reg,
|
||||
L_no_such_interface,
|
||||
/*return_method=*/false);
|
||||
|
||||
// Get selected method from declaring class and itable index
|
||||
const Register method = rbx;
|
||||
__ load_klass(recv_klass_reg, j_rarg0); // restore recv_klass_reg
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
recv_klass_reg, holder_klass_reg, itable_index,
|
||||
// outputs: method, scan temp. reg
|
||||
method, temp_reg,
|
||||
L_no_such_interface);
|
||||
|
||||
// If we take a trap while this arg is on the stack we will not
|
||||
// be able to walk the stack properly. This is not an issue except
|
||||
// when there are mistakes in this assembly code that could generate
|
||||
// a spurious fault. Ask me how I know...
|
||||
|
||||
const Register method = rbx;
|
||||
Label throw_icce;
|
||||
|
||||
// Get Method* and entrypoint for compiler
|
||||
__ lookup_interface_method(// inputs: rec. class, interface, itable index
|
||||
r10, rax, itable_index,
|
||||
// outputs: method, scan temp. reg
|
||||
method, r11,
|
||||
throw_icce);
|
||||
|
||||
// method (rbx): Method*
|
||||
// j_rarg0: receiver
|
||||
|
||||
@ -197,7 +212,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
|
||||
address ame_addr = __ pc();
|
||||
__ jmp(Address(method, Method::from_compiled_offset()));
|
||||
|
||||
__ bind(throw_icce);
|
||||
__ bind(L_no_such_interface);
|
||||
__ jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry()));
|
||||
|
||||
__ flush();
|
||||
@ -224,8 +239,8 @@ int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
|
||||
(UseCompressedClassPointers ? MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
|
||||
} else {
|
||||
// Itable stub size
|
||||
return (DebugVtables ? 512 : 74) + (CountCompiledCalls ? 13 : 0) +
|
||||
(UseCompressedClassPointers ? MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
|
||||
return (DebugVtables ? 512 : 140) + (CountCompiledCalls ? 13 : 0) +
|
||||
(UseCompressedClassPointers ? 2 * MacroAssembler::instr_size_for_decode_klass_not_null() : 0);
|
||||
}
|
||||
// In order to tune these parameters, run the JVM with VM options
|
||||
// +PrintMiscellaneous and +WizardMode to see information about
|
||||
|
||||
@ -40,10 +40,10 @@ public class CompiledICHolder extends VMObject {
|
||||
}
|
||||
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("CompiledICHolder");
|
||||
holderMethod = new MetadataField(type.getAddressField("_holder_method"), 0);
|
||||
holderKlass = new MetadataField(type.getAddressField("_holder_klass"), 0);
|
||||
headerSize = type.getSize();
|
||||
Type type = db.lookupType("CompiledICHolder");
|
||||
holderMetadata = new MetadataField(type.getAddressField("_holder_metadata"), 0);
|
||||
holderKlass = new MetadataField(type.getAddressField("_holder_klass"), 0);
|
||||
headerSize = type.getSize();
|
||||
}
|
||||
|
||||
public CompiledICHolder(Address addr) {
|
||||
@ -55,12 +55,12 @@ public class CompiledICHolder extends VMObject {
|
||||
private static long headerSize;
|
||||
|
||||
// Fields
|
||||
private static MetadataField holderMethod;
|
||||
private static MetadataField holderMetadata;
|
||||
private static MetadataField holderKlass;
|
||||
|
||||
// Accessors for declared fields
|
||||
public Method getHolderMethod() { return (Method) holderMethod.getValue(this); }
|
||||
public Klass getHolderKlass() { return (Klass) holderKlass.getValue(this); }
|
||||
public Metadata getHolderMetadata() { return (Metadata) holderMetadata.getValue(this); }
|
||||
public Klass getHolderKlass() { return (Klass) holderKlass.getValue(this); }
|
||||
|
||||
public void printValueOn(PrintStream tty) {
|
||||
tty.print("CompiledICHolder");
|
||||
|
||||
@ -273,7 +273,7 @@ void AOTCompiledMethod::metadata_do(void f(Metadata*)) {
|
||||
CompiledIC *ic = CompiledIC_at(&iter);
|
||||
if (ic->is_icholder_call()) {
|
||||
CompiledICHolder* cichk = ic->cached_icholder();
|
||||
f(cichk->holder_method());
|
||||
f(cichk->holder_metadata());
|
||||
f(cichk->holder_klass());
|
||||
} else {
|
||||
// Get Klass* or NULL (if value is -1) from GOT cell of virtual call PLT stub.
|
||||
|
||||
@ -230,10 +230,13 @@ bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecod
|
||||
#ifdef ASSERT
|
||||
int index = call_info->resolved_method()->itable_index();
|
||||
assert(index == itable_index, "CallInfo pre-computes this");
|
||||
#endif //ASSERT
|
||||
InstanceKlass* k = call_info->resolved_method()->method_holder();
|
||||
assert(k->verify_itable_index(itable_index), "sanity check");
|
||||
InlineCacheBuffer::create_transition_stub(this, k, entry);
|
||||
#endif //ASSERT
|
||||
CompiledICHolder* holder = new CompiledICHolder(call_info->resolved_method()->method_holder(),
|
||||
call_info->resolved_klass()());
|
||||
holder->claim();
|
||||
InlineCacheBuffer::create_transition_stub(this, holder, entry);
|
||||
} else {
|
||||
assert(call_info->call_kind() == CallInfo::vtable_call, "either itable or vtable");
|
||||
// Can be different than selected_method->vtable_index(), due to package-private etc.
|
||||
@ -517,7 +520,14 @@ void CompiledIC::compute_monomorphic_entry(const methodHandle& method,
|
||||
|
||||
bool CompiledIC::is_icholder_entry(address entry) {
|
||||
CodeBlob* cb = CodeCache::find_blob_unsafe(entry);
|
||||
return (cb != NULL && cb->is_adapter_blob());
|
||||
if (cb != NULL && cb->is_adapter_blob()) {
|
||||
return true;
|
||||
}
|
||||
// itable stubs also use CompiledICHolder
|
||||
if (VtableStubs::is_entry_point(entry) && VtableStubs::stub_containing(entry)->is_itable_stub()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site, const CompiledMethod* cm) {
|
||||
|
||||
@ -45,11 +45,11 @@
|
||||
// \ / \ /
|
||||
// [4] \ / [4] \->-/
|
||||
// \->- Megamorphic -<-/
|
||||
// (Method*)
|
||||
// (CompiledICHolder*)
|
||||
//
|
||||
// The text in paranteses () refere to the value of the inline cache receiver (mov instruction)
|
||||
// The text in parentheses () refers to the value of the inline cache receiver (mov instruction)
|
||||
//
|
||||
// The numbers in square brackets refere to the kind of transition:
|
||||
// The numbers in square brackets refer to the kind of transition:
|
||||
// [1]: Initial fixup. Receiver it found from debug information
|
||||
// [2]: Compilation of a method
|
||||
// [3]: Recompilation of a method (note: only entry is changed. The Klass* must stay the same)
|
||||
|
||||
@ -417,8 +417,7 @@ void CompiledMethod::clean_ic_if_metadata_is_dead(CompiledIC *ic, BoolObjectClos
|
||||
// yet be marked below. (We check this further below).
|
||||
CompiledICHolder* cichk_oop = ic->cached_icholder();
|
||||
|
||||
if (cichk_oop->holder_method()->method_holder()->is_loader_alive(is_alive) &&
|
||||
cichk_oop->holder_klass()->is_loader_alive(is_alive)) {
|
||||
if (cichk_oop->is_loader_alive(is_alive)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1577,7 +1577,7 @@ void nmethod::metadata_do(void f(Metadata*)) {
|
||||
CompiledIC *ic = CompiledIC_at(&iter);
|
||||
if (ic->is_icholder_call()) {
|
||||
CompiledICHolder* cichk = ic->cached_icholder();
|
||||
f(cichk->holder_method());
|
||||
f(cichk->holder_metadata());
|
||||
f(cichk->holder_klass());
|
||||
} else {
|
||||
Metadata* ic_oop = ic->cached_metadata();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, 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
|
||||
@ -795,7 +795,7 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte
|
||||
// it is not an interface. The receiver for invokespecial calls within interface
|
||||
// methods must be checked for every call.
|
||||
InstanceKlass* sender = pool->pool_holder();
|
||||
sender = sender->is_anonymous() ? sender->host_klass() : sender;
|
||||
sender = sender->has_host_klass() ? sender->host_klass() : sender;
|
||||
|
||||
switch (info.call_kind()) {
|
||||
case CallInfo::direct_call:
|
||||
@ -813,6 +813,7 @@ void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code byte
|
||||
case CallInfo::itable_call:
|
||||
cp_cache_entry->set_itable_call(
|
||||
bytecode,
|
||||
info.resolved_klass(),
|
||||
info.resolved_method(),
|
||||
info.itable_index());
|
||||
break;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, 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
|
||||
@ -1061,11 +1061,7 @@ void LinkResolver::resolve_special_call(CallInfo& result,
|
||||
const LinkInfo& link_info,
|
||||
TRAPS) {
|
||||
methodHandle resolved_method = linktime_resolve_special_method(link_info, CHECK);
|
||||
runtime_resolve_special_method(result, resolved_method,
|
||||
link_info.resolved_klass(),
|
||||
link_info.current_klass(),
|
||||
recv,
|
||||
link_info.check_access(), CHECK);
|
||||
runtime_resolve_special_method(result, link_info, resolved_method, recv, CHECK);
|
||||
}
|
||||
|
||||
// throws linktime exceptions
|
||||
@ -1148,11 +1144,11 @@ methodHandle LinkResolver::linktime_resolve_special_method(const LinkInfo& link_
|
||||
|
||||
// throws runtime exceptions
|
||||
void LinkResolver::runtime_resolve_special_method(CallInfo& result,
|
||||
const LinkInfo& link_info,
|
||||
const methodHandle& resolved_method,
|
||||
KlassHandle resolved_klass,
|
||||
KlassHandle current_klass,
|
||||
Handle recv,
|
||||
bool check_access, TRAPS) {
|
||||
Handle recv, TRAPS) {
|
||||
|
||||
KlassHandle resolved_klass = link_info.resolved_klass();
|
||||
|
||||
// resolved method is selected method unless we have an old-style lookup
|
||||
// for a superclass method
|
||||
@ -1160,12 +1156,13 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result,
|
||||
// no checks for shadowing
|
||||
methodHandle sel_method(THREAD, resolved_method());
|
||||
|
||||
if (check_access &&
|
||||
if (link_info.check_access() &&
|
||||
// check if the method is not <init>
|
||||
resolved_method->name() != vmSymbols::object_initializer_name()) {
|
||||
|
||||
// check if this is an old-style super call and do a new lookup if so
|
||||
// check if this is an old-style super call and do a new lookup if so
|
||||
// a) check if ACC_SUPER flag is set for the current class
|
||||
KlassHandle current_klass = link_info.current_klass();
|
||||
if ((current_klass->is_super() || !AllowNonVirtualCalls) &&
|
||||
// b) check if the class of the resolved_klass is a superclass
|
||||
// (not supertype in order to exclude interface classes) of the current class.
|
||||
@ -1185,6 +1182,9 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result,
|
||||
Method::name_and_sig_as_C_string(resolved_klass(),
|
||||
resolved_method->name(),
|
||||
resolved_method->signature()));
|
||||
// check loader constraints if found a different method
|
||||
} else if (sel_method() != resolved_method()) {
|
||||
check_method_loader_constraints(link_info, sel_method, "method", CHECK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, 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
|
||||
@ -227,11 +227,10 @@ class LinkResolver: AllStatic {
|
||||
static methodHandle linktime_resolve_interface_method (const LinkInfo& link_info, TRAPS);
|
||||
|
||||
static void runtime_resolve_special_method (CallInfo& result,
|
||||
const LinkInfo& link_info,
|
||||
const methodHandle& resolved_method,
|
||||
KlassHandle resolved_klass,
|
||||
KlassHandle current_klass,
|
||||
Handle recv,
|
||||
bool check_access, TRAPS);
|
||||
Handle recv, TRAPS);
|
||||
|
||||
static void runtime_resolve_virtual_method (CallInfo& result,
|
||||
const methodHandle& resolved_method,
|
||||
KlassHandle resolved_klass,
|
||||
|
||||
@ -32,8 +32,8 @@ volatile int CompiledICHolder::_live_count;
|
||||
volatile int CompiledICHolder::_live_not_claimed_count;
|
||||
|
||||
|
||||
CompiledICHolder::CompiledICHolder(Method* method, Klass* klass)
|
||||
: _holder_method(method), _holder_klass(klass) {
|
||||
CompiledICHolder::CompiledICHolder(Metadata* metadata, Klass* klass)
|
||||
: _holder_metadata(metadata), _holder_klass(klass) {
|
||||
#ifdef ASSERT
|
||||
Atomic::inc(&_live_count);
|
||||
Atomic::inc(&_live_not_claimed_count);
|
||||
@ -47,12 +47,28 @@ CompiledICHolder::~CompiledICHolder() {
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
||||
bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) {
|
||||
if (_holder_metadata->is_method()) {
|
||||
if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) {
|
||||
return false;
|
||||
}
|
||||
} else if (_holder_metadata->is_klass()) {
|
||||
if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!_holder_klass->is_loader_alive(is_alive)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Printing
|
||||
|
||||
void CompiledICHolder::print_on(outputStream* st) const {
|
||||
st->print("%s", internal_name());
|
||||
st->print(" - method: "); holder_method()->print_value_on(st); st->cr();
|
||||
st->print(" - klass: "); holder_klass()->print_value_on(st); st->cr();
|
||||
st->print(" - metadata: "); holder_metadata()->print_value_on(st); st->cr();
|
||||
st->print(" - klass: "); holder_klass()->print_value_on(st); st->cr();
|
||||
}
|
||||
|
||||
void CompiledICHolder::print_value_on(outputStream* st) const {
|
||||
@ -63,7 +79,7 @@ void CompiledICHolder::print_value_on(outputStream* st) const {
|
||||
// Verification
|
||||
|
||||
void CompiledICHolder::verify_on(outputStream* st) {
|
||||
guarantee(holder_method()->is_method(), "should be method");
|
||||
guarantee(holder_metadata()->is_method() || holder_metadata()->is_klass(), "should be method or klass");
|
||||
guarantee(holder_klass()->is_klass(), "should be klass");
|
||||
}
|
||||
|
||||
|
||||
@ -29,8 +29,9 @@
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
// A CompiledICHolder* is a helper object for the inline cache implementation.
|
||||
// It holds an intermediate value (method+klass pair) used when converting from
|
||||
// compiled to an interpreted call.
|
||||
// It holds:
|
||||
// (1) (method+klass pair) when converting from compiled to an interpreted call
|
||||
// (2) (klass+klass pair) when calling itable stub from megamorphic compiled call
|
||||
//
|
||||
// These are always allocated in the C heap and are freed during a
|
||||
// safepoint by the ICBuffer logic. It's unsafe to free them earlier
|
||||
@ -45,32 +46,33 @@ class CompiledICHolder : public CHeapObj<mtCompiler> {
|
||||
static volatile int _live_not_claimed_count; // allocated but not yet in use so not
|
||||
// reachable by iterating over nmethods
|
||||
|
||||
Method* _holder_method;
|
||||
Metadata* _holder_metadata;
|
||||
Klass* _holder_klass; // to avoid name conflict with oopDesc::_klass
|
||||
CompiledICHolder* _next;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
CompiledICHolder(Method* method, Klass* klass);
|
||||
CompiledICHolder(Metadata* metadata, Klass* klass);
|
||||
~CompiledICHolder() NOT_DEBUG_RETURN;
|
||||
|
||||
static int live_count() { return _live_count; }
|
||||
static int live_not_claimed_count() { return _live_not_claimed_count; }
|
||||
|
||||
// accessors
|
||||
Method* holder_method() const { return _holder_method; }
|
||||
Klass* holder_klass() const { return _holder_klass; }
|
||||
Metadata* holder_metadata() const { return _holder_metadata; }
|
||||
|
||||
void set_holder_method(Method* m) { _holder_method = m; }
|
||||
void set_holder_klass(Klass* k) { _holder_klass = k; }
|
||||
void set_holder_metadata(Metadata* m) { _holder_metadata = m; }
|
||||
void set_holder_klass(Klass* k) { _holder_klass = k; }
|
||||
|
||||
// interpreter support (offsets in bytes)
|
||||
static int holder_method_offset() { return offset_of(CompiledICHolder, _holder_method); }
|
||||
static int holder_metadata_offset() { return offset_of(CompiledICHolder, _holder_metadata); }
|
||||
static int holder_klass_offset() { return offset_of(CompiledICHolder, _holder_klass); }
|
||||
|
||||
CompiledICHolder* next() { return _next; }
|
||||
void set_next(CompiledICHolder* n) { _next = n; }
|
||||
|
||||
bool is_loader_alive(BoolObjectClosure* is_alive);
|
||||
|
||||
// Verify
|
||||
void verify_on(outputStream* st);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, 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
|
||||
@ -958,7 +958,7 @@ class SymbolHashMap: public CHeapObj<mtSymbol> {
|
||||
delete(cur);
|
||||
}
|
||||
}
|
||||
delete _buckets;
|
||||
FREE_C_HEAP_ARRAY(SymbolHashMapBucket, _buckets);
|
||||
}
|
||||
}; // End SymbolHashMap class
|
||||
|
||||
|
||||
@ -255,14 +255,16 @@ void ConstantPoolCacheEntry::set_vtable_call(Bytecodes::Code invoke_code, method
|
||||
set_direct_or_vtable_call(invoke_code, method, index, false);
|
||||
}
|
||||
|
||||
void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, const methodHandle& method, int index) {
|
||||
void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code,
|
||||
KlassHandle referenced_klass,
|
||||
const methodHandle& method, int index) {
|
||||
assert(method->method_holder()->verify_itable_index(index), "");
|
||||
assert(invoke_code == Bytecodes::_invokeinterface, "");
|
||||
InstanceKlass* interf = method->method_holder();
|
||||
assert(interf->is_interface(), "must be an interface");
|
||||
assert(!method->is_final_method(), "interfaces do not have final methods; cannot link to one here");
|
||||
set_f1(interf);
|
||||
set_f2(index);
|
||||
set_f1(referenced_klass());
|
||||
set_f2((intx)method());
|
||||
set_method_flags(as_TosState(method->result_type()),
|
||||
0, // no option bits
|
||||
method()->size_of_parameters());
|
||||
@ -434,10 +436,23 @@ oop ConstantPoolCacheEntry::method_type_if_resolved(const constantPoolHandle& cp
|
||||
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
|
||||
void log_adjust(const char* entry_type, Method* old_method, Method* new_method, bool* trace_name_printed) {
|
||||
if (log_is_enabled(Info, redefine, class, update)) {
|
||||
ResourceMark rm;
|
||||
if (!(*trace_name_printed)) {
|
||||
log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name());
|
||||
*trace_name_printed = true;
|
||||
}
|
||||
log_debug(redefine, class, update, constantpool)
|
||||
("cpc %s entry update: %s(%s)", entry_type, new_method->name()->as_C_string(), new_method->signature()->as_C_string());
|
||||
}
|
||||
}
|
||||
|
||||
// RedefineClasses() API support:
|
||||
// If this ConstantPoolCacheEntry refers to old_method then update it
|
||||
// to refer to new_method.
|
||||
bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
|
||||
void ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
|
||||
Method* new_method, bool * trace_name_printed) {
|
||||
|
||||
if (is_vfinal()) {
|
||||
@ -446,63 +461,35 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
|
||||
// match old_method so need an update
|
||||
// NOTE: can't use set_f2_as_vfinal_method as it asserts on different values
|
||||
_f2 = (intptr_t)new_method;
|
||||
if (log_is_enabled(Info, redefine, class, update)) {
|
||||
ResourceMark rm;
|
||||
if (!(*trace_name_printed)) {
|
||||
log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name());
|
||||
*trace_name_printed = true;
|
||||
}
|
||||
log_debug(redefine, class, update, constantpool)
|
||||
("cpc vf-entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string());
|
||||
}
|
||||
return true;
|
||||
log_adjust("vfinal", old_method, new_method, trace_name_printed);
|
||||
}
|
||||
|
||||
// f1() is not used with virtual entries so bail out
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_f1 == NULL) {
|
||||
// NULL f1() means this is a virtual entry so bail out
|
||||
// We are assuming that the vtable index does not need change.
|
||||
return false;
|
||||
}
|
||||
assert (_f1 != NULL, "should not call with uninteresting entry");
|
||||
|
||||
if (_f1 == old_method) {
|
||||
if (!(_f1->is_method())) {
|
||||
// _f1 is a Klass* for an interface, _f2 is the method
|
||||
if (f2_as_interface_method() == old_method) {
|
||||
_f2 = (intptr_t)new_method;
|
||||
log_adjust("interface", old_method, new_method, trace_name_printed);
|
||||
}
|
||||
} else if (_f1 == old_method) {
|
||||
_f1 = new_method;
|
||||
if (log_is_enabled(Info, redefine, class, update)) {
|
||||
ResourceMark rm;
|
||||
if (!(*trace_name_printed)) {
|
||||
log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name());
|
||||
*trace_name_printed = true;
|
||||
}
|
||||
log_debug(redefine, class, update, constantpool)
|
||||
("cpc entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string());
|
||||
}
|
||||
return true;
|
||||
log_adjust("special, static or dynamic", old_method, new_method, trace_name_printed);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// a constant pool cache entry should never contain old or obsolete methods
|
||||
bool ConstantPoolCacheEntry::check_no_old_or_obsolete_entries() {
|
||||
if (is_vfinal()) {
|
||||
// virtual and final so _f2 contains method ptr instead of vtable index
|
||||
Metadata* f2 = (Metadata*)_f2;
|
||||
// Return false if _f2 refers to an old or an obsolete method.
|
||||
// _f2 == NULL || !_f2->is_method() are just as unexpected here.
|
||||
return (f2 != NULL NOT_PRODUCT(&& f2->is_valid()) && f2->is_method() &&
|
||||
!((Method*)f2)->is_old() && !((Method*)f2)->is_obsolete());
|
||||
} else if (_f1 == NULL ||
|
||||
(NOT_PRODUCT(_f1->is_valid() &&) !_f1->is_method())) {
|
||||
// _f1 == NULL || !_f1->is_method() are OK here
|
||||
Method* m = get_interesting_method_entry(NULL);
|
||||
// return false if m refers to a non-deleted old or obsolete method
|
||||
if (m != NULL) {
|
||||
assert(m->is_valid() && m->is_method(), "m is a valid method");
|
||||
return !m->is_old() && !m->is_obsolete(); // old is always set for old and obsolete
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
// return false if _f1 refers to a non-deleted old or obsolete method
|
||||
return (NOT_PRODUCT(_f1->is_valid() &&) _f1->is_method() &&
|
||||
(f1_as_method()->is_deleted() ||
|
||||
(!f1_as_method()->is_old() && !f1_as_method()->is_obsolete())));
|
||||
}
|
||||
|
||||
Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) {
|
||||
@ -519,10 +506,11 @@ Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) {
|
||||
return NULL;
|
||||
} else {
|
||||
if (!(_f1->is_method())) {
|
||||
// _f1 can also contain a Klass* for an interface
|
||||
return NULL;
|
||||
// _f1 is a Klass* for an interface
|
||||
m = f2_as_interface_method();
|
||||
} else {
|
||||
m = f1_as_method();
|
||||
}
|
||||
m = f1_as_method();
|
||||
}
|
||||
assert(m != NULL && m->is_method(), "sanity check");
|
||||
if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
|
||||
|
||||
@ -249,6 +249,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
|
||||
|
||||
void set_itable_call(
|
||||
Bytecodes::Code invoke_code, // the bytecode used; must be invokeinterface
|
||||
KlassHandle referenced_klass, // the referenced klass in the InterfaceMethodref
|
||||
const methodHandle& method, // the resolved interface method
|
||||
int itable_index // index into itable for the method
|
||||
);
|
||||
@ -345,6 +346,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
|
||||
bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound
|
||||
int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; }
|
||||
Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; }
|
||||
Method* f2_as_interface_method() const { assert(bytecode_1() == Bytecodes::_invokeinterface, ""); return (Method*)_f2; }
|
||||
int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); }
|
||||
int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); }
|
||||
bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
|
||||
@ -377,7 +379,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
|
||||
// trace_name_printed is set to true if the current call has
|
||||
// printed the klass name so that other routines in the adjust_*
|
||||
// group don't print the klass name.
|
||||
bool adjust_method_entry(Method* old_method, Method* new_method,
|
||||
void adjust_method_entry(Method* old_method, Method* new_method,
|
||||
bool* trace_name_printed);
|
||||
bool check_no_old_or_obsolete_entries();
|
||||
Method* get_interesting_method_entry(Klass* k);
|
||||
|
||||
@ -625,9 +625,11 @@ class InstanceKlass: public Klass {
|
||||
InstanceKlass* host_klass() const {
|
||||
InstanceKlass** hk = adr_host_klass();
|
||||
if (hk == NULL) {
|
||||
assert(!is_anonymous(), "Anonymous classes have host klasses");
|
||||
return NULL;
|
||||
} else {
|
||||
assert(*hk != NULL, "host klass should always be set if the address is not null");
|
||||
assert(is_anonymous(), "Only anonymous classes have host klasses");
|
||||
return *hk;
|
||||
}
|
||||
}
|
||||
@ -639,6 +641,9 @@ class InstanceKlass: public Klass {
|
||||
*addr = host;
|
||||
}
|
||||
}
|
||||
bool has_host_klass() const {
|
||||
return adr_host_klass() != NULL;
|
||||
}
|
||||
bool is_anonymous() const {
|
||||
return (_misc_flags & _misc_is_anonymous) != 0;
|
||||
}
|
||||
|
||||
@ -1173,7 +1173,6 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass
|
||||
Array<Method*>* methods = InstanceKlass::cast(interf_h())->methods();
|
||||
int nof_methods = methods->length();
|
||||
HandleMark hm;
|
||||
assert(nof_methods > 0, "at least one method must exist for interface to be in vtable");
|
||||
Handle interface_loader (THREAD, InstanceKlass::cast(interf_h())->class_loader());
|
||||
|
||||
int ime_count = method_count_for_interface(interf_h());
|
||||
@ -1350,8 +1349,10 @@ void visit_all_interfaces(Array<Klass*>* transitive_intf, InterfaceVisiterClosur
|
||||
}
|
||||
}
|
||||
|
||||
// Only count interfaces with at least one method
|
||||
if (method_count > 0) {
|
||||
// Visit all interfaces which either have any methods or can participate in receiver type check.
|
||||
// We do not bother to count methods in transitive interfaces, although that would allow us to skip
|
||||
// this step in the rare case of a zero-method interface extending another zero-method interface.
|
||||
if (method_count > 0 || InstanceKlass::cast(intf)->transitive_interfaces()->length() > 0) {
|
||||
blk->doit(intf, method_count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,6 +700,7 @@ class Method : public Metadata {
|
||||
static ByteSize from_interpreted_offset() { return byte_offset_of(Method, _from_interpreted_entry ); }
|
||||
static ByteSize interpreter_entry_offset() { return byte_offset_of(Method, _i2i_entry ); }
|
||||
static ByteSize signature_handler_offset() { return in_ByteSize(sizeof(Method) + wordSize); }
|
||||
static ByteSize itable_index_offset() { return byte_offset_of(Method, _vtable_index ); }
|
||||
|
||||
// for code generation
|
||||
static int method_data_offset_in_bytes() { return offset_of(Method, _method_data); }
|
||||
|
||||
@ -2839,7 +2839,7 @@ jni_Get##Result##ArrayRegion(JNIEnv *env, ElementType##Array array, jsize start,
|
||||
EntryProbe; \
|
||||
DT_VOID_RETURN_MARK(Get##Result##ArrayRegion); \
|
||||
typeArrayOop src = typeArrayOop(JNIHandles::resolve_non_null(array)); \
|
||||
if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)src->length())) { \
|
||||
if (start < 0 || len < 0 || (start > src->length() - len)) { \
|
||||
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \
|
||||
} else { \
|
||||
if (len > 0) { \
|
||||
@ -2889,7 +2889,7 @@ jni_Set##Result##ArrayRegion(JNIEnv *env, ElementType##Array array, jsize start,
|
||||
EntryProbe; \
|
||||
DT_VOID_RETURN_MARK(Set##Result##ArrayRegion); \
|
||||
typeArrayOop dst = typeArrayOop(JNIHandles::resolve_non_null(array)); \
|
||||
if (start < 0 || len < 0 || ((unsigned int)start + (unsigned int)len > (unsigned int)dst->length())) { \
|
||||
if (start < 0 || len < 0 || (start > dst->length() - len)) { \
|
||||
THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException()); \
|
||||
} else { \
|
||||
if (len > 0) { \
|
||||
@ -3126,7 +3126,7 @@ JNI_ENTRY(void, jni_GetStringRegion(JNIEnv *env, jstring string, jsize start, js
|
||||
DT_VOID_RETURN_MARK(GetStringRegion);
|
||||
oop s = JNIHandles::resolve_non_null(string);
|
||||
int s_len = java_lang_String::length(s);
|
||||
if (start < 0 || len < 0 || start + len > s_len) {
|
||||
if (start < 0 || len < 0 || start > s_len - len) {
|
||||
THROW(vmSymbols::java_lang_StringIndexOutOfBoundsException());
|
||||
} else {
|
||||
if (len > 0) {
|
||||
@ -3152,7 +3152,7 @@ JNI_ENTRY(void, jni_GetStringUTFRegion(JNIEnv *env, jstring string, jsize start,
|
||||
DT_VOID_RETURN_MARK(GetStringUTFRegion);
|
||||
oop s = JNIHandles::resolve_non_null(string);
|
||||
int s_len = java_lang_String::length(s);
|
||||
if (start < 0 || len < 0 || start + len > s_len) {
|
||||
if (start < 0 || len < 0 || start > s_len - len) {
|
||||
THROW(vmSymbols::java_lang_StringIndexOutOfBoundsException());
|
||||
} else {
|
||||
//%note jni_7
|
||||
|
||||
@ -230,7 +230,7 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
|
||||
nonstatic_field(ArrayKlass, _dimension, int) \
|
||||
volatile_nonstatic_field(ArrayKlass, _higher_dimension, Klass*) \
|
||||
volatile_nonstatic_field(ArrayKlass, _lower_dimension, Klass*) \
|
||||
nonstatic_field(CompiledICHolder, _holder_method, Method*) \
|
||||
nonstatic_field(CompiledICHolder, _holder_metadata, Metadata*) \
|
||||
nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \
|
||||
nonstatic_field(ConstantPool, _tags, Array<u1>*) \
|
||||
nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \
|
||||
|
||||
52
hotspot/test/native/code/test_vtableStub.cpp
Normal file
52
hotspot/test/native/code/test_vtableStub.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "code/vtableStubs.hpp"
|
||||
#include "runtime/interfaceSupport.hpp"
|
||||
#include "unittest.hpp"
|
||||
|
||||
TEST_VM(code, vtableStubs) {
|
||||
// Should be in VM to use locks
|
||||
ThreadInVMfromNative ThreadInVMfromNative(JavaThread::current());
|
||||
|
||||
VtableStubs::find_vtable_stub(0); // min vtable index
|
||||
for (int i = 0; i < 15; i++) {
|
||||
VtableStubs::find_vtable_stub((1 << i) - 1);
|
||||
VtableStubs::find_vtable_stub((1 << i));
|
||||
}
|
||||
VtableStubs::find_vtable_stub((1 << 15) - 1); // max vtable index
|
||||
}
|
||||
|
||||
TEST_VM(code, itableStubs) {
|
||||
// Should be in VM to use locks
|
||||
ThreadInVMfromNative ThreadInVMfromNative(JavaThread::current());
|
||||
|
||||
VtableStubs::find_itable_stub(0); // min itable index
|
||||
for (int i = 0; i < 15; i++) {
|
||||
VtableStubs::find_itable_stub((1 << i) - 1);
|
||||
VtableStubs::find_itable_stub((1 << i));
|
||||
}
|
||||
VtableStubs::find_itable_stub((1 << 15) - 1); // max itable index
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8174962
|
||||
* @summary Redefine class with interface method call
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules java.compiler
|
||||
* java.instrument
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @run main RedefineClassHelper
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+update*=trace RedefineInterfaceCall
|
||||
*/
|
||||
|
||||
import static jdk.test.lib.Asserts.assertEquals;
|
||||
|
||||
interface I1 { default int m() { return 0; } }
|
||||
interface I2 extends I1 {}
|
||||
|
||||
public class RedefineInterfaceCall {
|
||||
|
||||
public static class C implements I2 {
|
||||
public int test(I2 i) {
|
||||
return i.m(); // invokeinterface cpCacheEntry
|
||||
}
|
||||
}
|
||||
|
||||
static String newI1 =
|
||||
"interface I1 { default int m() { return 1; } }";
|
||||
|
||||
static String newC =
|
||||
"public class RedefineInterfaceCall$C implements I2 { " +
|
||||
" public int test(I2 i) { " +
|
||||
" return i.m(); " +
|
||||
" } " +
|
||||
"} ";
|
||||
|
||||
static int test(I2 i) {
|
||||
return i.m(); // invokeinterface cpCacheEntry
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
C c = new C();
|
||||
|
||||
assertEquals(test(c), 0);
|
||||
assertEquals(c.test(c), 0);
|
||||
|
||||
RedefineClassHelper.redefineClass(C.class, newC);
|
||||
|
||||
assertEquals(c.test(c), 0);
|
||||
|
||||
RedefineClassHelper.redefineClass(I1.class, newI1);
|
||||
|
||||
assertEquals(test(c), 1);
|
||||
assertEquals(c.test(c), 1);
|
||||
|
||||
RedefineClassHelper.redefineClass(C.class, newC);
|
||||
|
||||
assertEquals(c.test(c), 1);
|
||||
}
|
||||
}
|
||||
@ -62,8 +62,8 @@ public class TransformTestCommon {
|
||||
String parent, String child)
|
||||
throws Exception {
|
||||
|
||||
String parentSharedMatch = parent + " source: shared objects file";
|
||||
String childSharedMatch = child + " source: shared objects file";
|
||||
String parentSharedMatch = " " + parent + " source: shared objects file";
|
||||
String childSharedMatch = " " + child + " source: shared objects file";
|
||||
|
||||
if (entry.isParentExpectedShared)
|
||||
out.shouldContain(parentSharedMatch);
|
||||
|
||||
23
jaxp/.hgtags
23
jaxp/.hgtags
@ -417,9 +417,32 @@ c27321c889cf4c8e465a61b84572c00ef7ee6004 jdk-9+171
|
||||
eedb6e54c8bd6197ecba5fc0d8568bac8ae852dd jdk-9+172
|
||||
9788347e0629d0cb3a0e55a903494ff741d4fa15 jdk-9+173
|
||||
b9c0b105002272d7414c8b34af9aded151f9cad6 jdk-9+174
|
||||
c0b8bea54e914a56c9843d6391aeb8ef9dc06d11 jdk-9.0.1+00
|
||||
c0b8bea54e914a56c9843d6391aeb8ef9dc06d11 jdk-9.0.3+00
|
||||
736412a8dccee9d439044e6b1af2e7470d0a3563 jdk-9+175
|
||||
38cf34e2328070cc691c4f136e6dde1a44c04171 jdk-9+176
|
||||
332ad9f92632f56f337b8c40edef9a95a42b26bc jdk-9+177
|
||||
0983b2dbe17ba4fed3af34e0512ca77a9845fe8a jdk-9+178
|
||||
87243a3131f79e8b3903eaca6b629abc48f08ace jdk-9+179
|
||||
9934a03646f91ce55f61f53d8448c629828f8088 jdk-9+180
|
||||
ea18d767c9ec50ea7f40bbe6cf7379d3538110f1 jdk-9+181
|
||||
3457491ec221327e95dfddf93250fa1bacd2b6c3 jdk-9.0.3+1
|
||||
a3a20651f67b22f9eebc7c8dfff13a0944d039ed jdk-9.0.3+2
|
||||
2baca7f85d81abd5ddf198351682733baecb6677 jdk-9.0.3+3
|
||||
aea6e4919ca1755e32edf86117b1788b624549ba jdk-9.0.3+4
|
||||
4afbdc0e37ea5df83499c72f73d599a0ae6d2ba6 jdk-9.0.3+5
|
||||
2d630b6de3e3d07bc65c10eb463fa6923d33e82e jdk-9.0.3+6
|
||||
d74584f91e7d0643fc6f2e6c325ddeed5d20b1d7 jdk-9.0.3+7
|
||||
86788168f6660ee1fbf8e96a31b4f81ca8b1c5b4 jdk-9.0.3+8
|
||||
c29d16704b119af18e61a6c6484979829365f0a0 jdk-9.0.3+9
|
||||
b0b8bff18b0c3b9990775fe912dff67a433cb9d5 jdk-9.0.1+10
|
||||
067a3eada8b593daa7c27c9d68e201822a530344 jdk-9.0.1+11
|
||||
04e8b60cb228668ebcc456c0c810bf783ab62e6f jdk-9.0.4+00
|
||||
67b943123ad883e5a59734ee20b9ab899dae823c jdk-9.0.4+1
|
||||
2cb55df963aed0adc48361012bbb7b78253d8017 jdk-9.0.4+2
|
||||
64fcfe23d2c222127802b00d8231102b1ef24b9a jdk-9.0.4+3
|
||||
6ee4d4da8b41c5891a4fe71dad18f5dfb25b1165 jdk-9.0.4+4
|
||||
0c1a87c4dae1dd0f49bfec097ab3dca7cc351d7b jdk-9.0.4+5
|
||||
712b68f58f395314d5a3eafda4f4a7164b172762 jdk-9.0.4+6
|
||||
c3d8e85a5c783353b9a7d324f4200ea1f6a07a9d jdk-9.0.4+7
|
||||
95716a91e842e04b2f31cac0a70933a74a723bdb jdk-9.0.4+8
|
||||
|
||||
@ -1 +1,2 @@
|
||||
project=jdk9
|
||||
bugids=dup
|
||||
|
||||
@ -25,8 +25,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
|
||||
|
||||
/**
|
||||
* Commonly used constants.
|
||||
*
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -36,6 +35,7 @@ import com.sun.org.apache.xpath.internal.objects.XBoolean;
|
||||
import com.sun.org.apache.xpath.internal.objects.XNodeSet;
|
||||
import com.sun.org.apache.xpath.internal.objects.XNumber;
|
||||
import com.sun.org.apache.xpath.internal.objects.XObject;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
@ -410,10 +410,7 @@ public class ExsltDynamic extends ExsltBase
|
||||
{
|
||||
if (lDoc == null)
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
dbf.setNamespaceAware(true);
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
lDoc = db.newDocument();
|
||||
lDoc = JdkXmlUtils.getDOMDocument();
|
||||
}
|
||||
|
||||
Element element = null;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -22,7 +22,7 @@
|
||||
*/
|
||||
package com.sun.org.apache.xalan.internal.lib;
|
||||
|
||||
import com.sun.org.apache.xml.internal.utils.DOMHelper;
|
||||
import com.sun.org.apache.xml.internal.utils.DOM2Helper;
|
||||
import com.sun.org.apache.xpath.internal.NodeSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -72,8 +72,8 @@ public class ExsltSets extends ExsltBase
|
||||
for (int i = 0; i < nl1.getLength(); i++)
|
||||
{
|
||||
Node testNode = nl1.item(i);
|
||||
if (DOMHelper.isNodeAfter(testNode, endNode)
|
||||
&& !DOMHelper.isNodeTheSame(testNode, endNode))
|
||||
if (DOM2Helper.isNodeAfter(testNode, endNode)
|
||||
&& !DOM2Helper.isNodeTheSame(testNode, endNode))
|
||||
leadNodes.addElement(testNode);
|
||||
}
|
||||
return leadNodes;
|
||||
@ -107,8 +107,8 @@ public class ExsltSets extends ExsltBase
|
||||
for (int i = 0; i < nl1.getLength(); i++)
|
||||
{
|
||||
Node testNode = nl1.item(i);
|
||||
if (DOMHelper.isNodeAfter(startNode, testNode)
|
||||
&& !DOMHelper.isNodeTheSame(startNode, testNode))
|
||||
if (DOM2Helper.isNodeAfter(startNode, testNode)
|
||||
&& !DOM2Helper.isNodeTheSame(startNode, testNode))
|
||||
trailNodes.addElement(testNode);
|
||||
}
|
||||
return trailNodes;
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -22,12 +21,8 @@
|
||||
package com.sun.org.apache.xalan.internal.lib;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.FactoryConfigurationError;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.NodeSet;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
@ -51,7 +46,6 @@ import org.w3c.dom.Text;
|
||||
*/
|
||||
public class ExsltStrings extends ExsltBase
|
||||
{
|
||||
static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
|
||||
|
||||
/**
|
||||
* The str:align function aligns a string within another string.
|
||||
@ -226,7 +220,7 @@ public class ExsltStrings extends ExsltBase
|
||||
token = str.substring(fromIndex);
|
||||
}
|
||||
|
||||
Document doc = getDocument();
|
||||
Document doc = JdkXmlUtils.getDOMDocument();
|
||||
synchronized (doc)
|
||||
{
|
||||
Element element = doc.createElement("token");
|
||||
@ -290,7 +284,7 @@ public class ExsltStrings extends ExsltBase
|
||||
{
|
||||
StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims);
|
||||
|
||||
Document doc = getDocument();
|
||||
Document doc = JdkXmlUtils.getDOMDocument();
|
||||
synchronized (doc)
|
||||
{
|
||||
while (lTokenizer.hasMoreTokens())
|
||||
@ -306,7 +300,7 @@ public class ExsltStrings extends ExsltBase
|
||||
else
|
||||
{
|
||||
|
||||
Document doc = getDocument();
|
||||
Document doc = JdkXmlUtils.getDOMDocument();
|
||||
synchronized (doc)
|
||||
{
|
||||
for (int i = 0; i < toTokenize.length(); i++)
|
||||
@ -328,23 +322,4 @@ public class ExsltStrings extends ExsltBase
|
||||
{
|
||||
return tokenize(toTokenize, " \t\n\r");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an instance of DOM Document
|
||||
*/
|
||||
private static Document getDocument()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (System.getSecurityManager() == null) {
|
||||
return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||
} else {
|
||||
return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument();
|
||||
}
|
||||
}
|
||||
catch(ParserConfigurationException pce)
|
||||
{
|
||||
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,14 +22,12 @@ package com.sun.org.apache.xalan.internal.lib;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.extensions.ExpressionContext;
|
||||
import com.sun.org.apache.xpath.internal.NodeSet;
|
||||
import com.sun.org.apache.xpath.internal.objects.XBoolean;
|
||||
import com.sun.org.apache.xpath.internal.objects.XNumber;
|
||||
import com.sun.org.apache.xpath.internal.objects.XObject;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentFragment;
|
||||
@ -51,7 +48,6 @@ import org.xml.sax.SAXNotSupportedException;
|
||||
*/
|
||||
public class Extensions
|
||||
{
|
||||
static final String JDK_DEFAULT_DOM = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
|
||||
/**
|
||||
* Constructor Extensions
|
||||
*
|
||||
@ -110,7 +106,7 @@ public class Extensions
|
||||
|
||||
// This no longer will work right since the DTM.
|
||||
// Document myDoc = myProcessor.getContextNode().getOwnerDocument();
|
||||
Document myDoc = getDocument();
|
||||
Document myDoc = JdkXmlUtils.getDOMDocument();
|
||||
|
||||
Text textNode = myDoc.createTextNode(textNodeValue);
|
||||
DocumentFragment docFrag = myDoc.createDocumentFragment();
|
||||
@ -236,7 +232,7 @@ public class Extensions
|
||||
public static NodeList tokenize(String toTokenize, String delims)
|
||||
{
|
||||
|
||||
Document doc = getDocument();
|
||||
Document doc = JdkXmlUtils.getDOMDocument();
|
||||
|
||||
StringTokenizer lTokenizer = new StringTokenizer(toTokenize, delims);
|
||||
NodeSet resultSet = new NodeSet();
|
||||
@ -269,23 +265,4 @@ public class Extensions
|
||||
{
|
||||
return tokenize(toTokenize, " \t\n\r");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an instance of DOM Document
|
||||
*/
|
||||
private static Document getDocument()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (System.getSecurityManager() == null) {
|
||||
return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||
} else {
|
||||
return DocumentBuilderFactory.newInstance(JDK_DEFAULT_DOM, null).newDocumentBuilder().newDocument();
|
||||
}
|
||||
}
|
||||
catch(ParserConfigurationException pce)
|
||||
{
|
||||
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(pce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.utils;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huizhe wang
|
||||
*/
|
||||
public class FactoryImpl {
|
||||
|
||||
static final String DBF = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
|
||||
static final String SF = "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
|
||||
|
||||
static public DocumentBuilderFactory getDOMFactory(boolean useServicesMechanism) {
|
||||
DocumentBuilderFactory dbf =
|
||||
useServicesMechanism ?
|
||||
DocumentBuilderFactory.newInstance() :
|
||||
DocumentBuilderFactory.newInstance( DBF,
|
||||
FactoryImpl.class.getClassLoader());
|
||||
|
||||
return dbf;
|
||||
}
|
||||
static public SAXParserFactory getSAXFactory(boolean useServicesMechanism) {
|
||||
SAXParserFactory factory =
|
||||
useServicesMechanism ?
|
||||
SAXParserFactory.newInstance() :
|
||||
SAXParserFactory.newInstance(SF,
|
||||
FactoryImpl.class.getClassLoader());
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -49,7 +48,7 @@ public interface Translet {
|
||||
public String[] getUrisArray();
|
||||
public int[] getTypesArray();
|
||||
public String[] getNamespaceArray();
|
||||
public boolean useServicesMechnism();
|
||||
public void setServicesMechnism(boolean flag);
|
||||
public boolean overrideDefaultParser();
|
||||
public void setOverrideDefaultParser(boolean flag);
|
||||
|
||||
}
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -22,7 +22,6 @@ package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import com.sun.java_cup.internal.runtime.Symbol;
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
|
||||
@ -44,9 +43,6 @@ import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.catalog.CatalogFeatures;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import jdk.xml.internal.JdkXmlFeatures;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import org.xml.sax.Attributes;
|
||||
@ -56,7 +52,6 @@ import org.xml.sax.Locator;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.AttributesImpl;
|
||||
|
||||
@ -100,11 +95,11 @@ public class Parser implements Constants, ContentHandler {
|
||||
|
||||
private int _currentImportPrecedence;
|
||||
|
||||
private boolean _useServicesMechanism = true;
|
||||
private boolean _overrideDefaultParser;
|
||||
|
||||
public Parser(XSLTC xsltc, boolean useServicesMechanism) {
|
||||
public Parser(XSLTC xsltc, boolean useOverrideDefaultParser) {
|
||||
_xsltc = xsltc;
|
||||
_useServicesMechanism = useServicesMechanism;
|
||||
_overrideDefaultParser = useOverrideDefaultParser;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
@ -464,56 +459,35 @@ public class Parser implements Constants, ContentHandler {
|
||||
*/
|
||||
public SyntaxTreeNode parse(InputSource input) {
|
||||
try {
|
||||
// Create a SAX parser and get the XMLReader object it uses
|
||||
final SAXParserFactory factory = FactoryImpl.getSAXFactory(_useServicesMechanism);
|
||||
final XMLReader reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
|
||||
_xsltc.isSecureProcessing());
|
||||
|
||||
if (_xsltc.isSecureProcessing()) {
|
||||
try {
|
||||
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
}
|
||||
catch (SAXException e) {}
|
||||
}
|
||||
JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD,
|
||||
_xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true);
|
||||
|
||||
try {
|
||||
factory.setFeature(Constants.NAMESPACE_FEATURE,true);
|
||||
}
|
||||
catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
|
||||
factory.setNamespaceAware(true);
|
||||
}
|
||||
|
||||
final SAXParser parser = factory.newSAXParser();
|
||||
try {
|
||||
parser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
|
||||
_xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
|
||||
} catch (SAXNotRecognizedException e) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.WARNING_MSG,
|
||||
parser.getClass().getName() + ": " + e.getMessage());
|
||||
reportError(WARNING, err);
|
||||
}
|
||||
|
||||
boolean supportCatalog = true;
|
||||
boolean useCatalog = _xsltc.getFeature(JdkXmlFeatures.XmlFeature.USE_CATALOG);
|
||||
try {
|
||||
factory.setFeature(JdkXmlUtils.USE_CATALOG,useCatalog);
|
||||
reader.setFeature(JdkXmlUtils.USE_CATALOG, useCatalog);
|
||||
}
|
||||
catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
|
||||
catch (SAXNotRecognizedException | SAXNotSupportedException e) {
|
||||
supportCatalog = false;
|
||||
}
|
||||
|
||||
if (supportCatalog && useCatalog) {
|
||||
try {
|
||||
CatalogFeatures cf = (CatalogFeatures)_xsltc.getProperty(JdkXmlFeatures.CATALOG_FEATURES);
|
||||
if (cf != null) {
|
||||
for (CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
|
||||
parser.setProperty(f.getPropertyName(), cf.get(f));
|
||||
if (cf != null) {
|
||||
for (CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) {
|
||||
reader.setProperty(f.getPropertyName(), cf.get(f));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SAXNotRecognizedException e) {
|
||||
//shall not happen for internal settings
|
||||
}
|
||||
}
|
||||
|
||||
final XMLReader reader = parser.getXMLReader();
|
||||
String lastProperty = "";
|
||||
try {
|
||||
XMLSecurityManager securityManager =
|
||||
@ -524,7 +498,7 @@ public class Parser implements Constants, ContentHandler {
|
||||
}
|
||||
if (securityManager.printEntityCountInfo()) {
|
||||
lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
|
||||
parser.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
|
||||
reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
|
||||
}
|
||||
} catch (SAXException se) {
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
|
||||
@ -536,13 +510,6 @@ public class Parser implements Constants, ContentHandler {
|
||||
|
||||
return(parse(reader, input));
|
||||
}
|
||||
catch (ParserConfigurationException e) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.SAX_PARSER_CONFIG_ERR);
|
||||
reportError(ERROR, err);
|
||||
}
|
||||
catch (SAXParseException e){
|
||||
reportError(ERROR, new ErrorMsg(e.getMessage(),e.getLineNumber()));
|
||||
}
|
||||
catch (SAXException e) {
|
||||
reportError(ERROR, new ErrorMsg(e.getMessage()));
|
||||
}
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -137,7 +137,7 @@ public final class XSLTC {
|
||||
*/
|
||||
private boolean _isSecureProcessing = false;
|
||||
|
||||
private boolean _useServicesMechanism = true;
|
||||
private boolean _overrideDefaultParser;
|
||||
|
||||
/**
|
||||
* protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
|
||||
@ -177,8 +177,10 @@ public final class XSLTC {
|
||||
/**
|
||||
* XSLTC compiler constructor
|
||||
*/
|
||||
public XSLTC(boolean useServicesMechanism, JdkXmlFeatures featureManager) {
|
||||
_parser = new Parser(this, useServicesMechanism);
|
||||
public XSLTC(JdkXmlFeatures featureManager) {
|
||||
_overrideDefaultParser = featureManager.getFeature(
|
||||
JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
|
||||
_parser = new Parser(this, _overrideDefaultParser);
|
||||
_xmlFeatures = featureManager;
|
||||
_extensionClassLoader = null;
|
||||
_externalExtensionFunctions = new HashMap<>();
|
||||
@ -197,19 +199,6 @@ public final class XSLTC {
|
||||
public boolean isSecureProcessing() {
|
||||
return _isSecureProcessing;
|
||||
}
|
||||
/**
|
||||
* Return the state of the services mechanism feature.
|
||||
*/
|
||||
public boolean useServicesMechnism() {
|
||||
return _useServicesMechanism;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the services mechanism feature.
|
||||
*/
|
||||
public void setServicesMechnism(boolean flag) {
|
||||
_useServicesMechanism = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of the specified feature
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,7 +21,6 @@
|
||||
package com.sun.org.apache.xalan.internal.xsltc.runtime;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOM;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOMCache;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM;
|
||||
@ -33,19 +32,18 @@ import com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHand
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
|
||||
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
|
||||
import com.sun.org.apache.xml.internal.serializer.ToStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.Templates;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
@ -106,7 +104,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
// This is the name of the index used for ID attributes
|
||||
private final static String ID_INDEX_NAME = "##id";
|
||||
|
||||
private boolean _useServicesMechanism;
|
||||
private boolean _overrideDefaultParser;
|
||||
|
||||
// The OutputStream for redirect function
|
||||
private FileOutputStream output = null;
|
||||
@ -559,7 +557,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
{
|
||||
try {
|
||||
final TransletOutputHandlerFactory factory
|
||||
= TransletOutputHandlerFactory.newInstance();
|
||||
= TransletOutputHandlerFactory.newInstance(_overrideDefaultParser);
|
||||
|
||||
String dirStr = new File(filename).getParent();
|
||||
if ((null != dirStr) && (dirStr.length() > 0)) {
|
||||
@ -761,15 +759,15 @@ public abstract class AbstractTranslet implements Translet {
|
||||
/**
|
||||
* Return the state of the services mechanism feature.
|
||||
*/
|
||||
public boolean useServicesMechnism() {
|
||||
return _useServicesMechanism;
|
||||
public boolean overrideDefaultParser() {
|
||||
return _overrideDefaultParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the services mechanism feature.
|
||||
*/
|
||||
public void setServicesMechnism(boolean flag) {
|
||||
_useServicesMechanism = flag;
|
||||
public void setOverrideDefaultParser(boolean flag) {
|
||||
_overrideDefaultParser = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -795,7 +793,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
throws ParserConfigurationException
|
||||
{
|
||||
if (_domImplementation == null) {
|
||||
DocumentBuilderFactory dbf = FactoryImpl.getDOMFactory(_useServicesMechanism);
|
||||
DocumentBuilderFactory dbf = JdkXmlUtils.getDOMFactory(_overrideDefaultParser);
|
||||
_domImplementation = dbf.newDocumentBuilder().getDOMImplementation();
|
||||
}
|
||||
return _domImplementation.createDocument(uri, qname, null);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -70,17 +69,17 @@ public class TransletOutputHandlerFactory {
|
||||
private ContentHandler _handler = null;
|
||||
private LexicalHandler _lexHandler = null;
|
||||
|
||||
private boolean _useServicesMechanism;
|
||||
private boolean _overrideDefaultParser;
|
||||
|
||||
static public TransletOutputHandlerFactory newInstance() {
|
||||
return new TransletOutputHandlerFactory(true);
|
||||
}
|
||||
static public TransletOutputHandlerFactory newInstance(boolean useServicesMechanism) {
|
||||
return new TransletOutputHandlerFactory(useServicesMechanism);
|
||||
static public TransletOutputHandlerFactory newInstance(boolean overrideDefaultParser) {
|
||||
return new TransletOutputHandlerFactory(overrideDefaultParser);
|
||||
}
|
||||
|
||||
public TransletOutputHandlerFactory(boolean useServicesMechanism) {
|
||||
_useServicesMechanism = useServicesMechanism;
|
||||
public TransletOutputHandlerFactory(boolean overrideDefaultParser) {
|
||||
_overrideDefaultParser = overrideDefaultParser;
|
||||
}
|
||||
public void setOutputType(int outputType) {
|
||||
_outputType = outputType;
|
||||
@ -194,7 +193,9 @@ public class TransletOutputHandlerFactory {
|
||||
return result;
|
||||
|
||||
case DOM :
|
||||
_handler = (_node != null) ? new SAX2DOM(_node, _nextSibling, _useServicesMechanism) : new SAX2DOM(_useServicesMechanism);
|
||||
_handler = (_node != null) ?
|
||||
new SAX2DOM(_node, _nextSibling, _overrideDefaultParser) :
|
||||
new SAX2DOM(_overrideDefaultParser);
|
||||
_lexHandler = (LexicalHandler) _handler;
|
||||
// falls through
|
||||
case STAX :
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -24,18 +23,17 @@ package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import java.util.Stack;
|
||||
import java.util.Vector;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.Constants;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.ProcessingInstruction;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
@ -68,16 +66,16 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
* synchronization because the Javadoc is not explicit about
|
||||
* thread safety.
|
||||
*/
|
||||
private DocumentBuilderFactory _factory =
|
||||
DocumentBuilderFactory.newInstance();
|
||||
private DocumentBuilderFactory _factory;
|
||||
private boolean _internal = true;
|
||||
|
||||
public SAX2DOM(boolean useServicesMechanism) throws ParserConfigurationException {
|
||||
_document = createDocument(useServicesMechanism);
|
||||
public SAX2DOM(boolean overrideDefaultParser) throws ParserConfigurationException {
|
||||
_document = createDocument(overrideDefaultParser);
|
||||
_root = _document;
|
||||
}
|
||||
|
||||
public SAX2DOM(Node root, Node nextSibling, boolean useServicesMechanism) throws ParserConfigurationException {
|
||||
public SAX2DOM(Node root, Node nextSibling, boolean overrideDefaultParser)
|
||||
throws ParserConfigurationException {
|
||||
_root = root;
|
||||
if (root instanceof Document) {
|
||||
_document = (Document)root;
|
||||
@ -86,15 +84,16 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
_document = root.getOwnerDocument();
|
||||
}
|
||||
else {
|
||||
_document = createDocument(useServicesMechanism);
|
||||
_document = createDocument(overrideDefaultParser);
|
||||
_root = _document;
|
||||
}
|
||||
|
||||
_nextSibling = nextSibling;
|
||||
}
|
||||
|
||||
public SAX2DOM(Node root, boolean useServicesMechanism) throws ParserConfigurationException {
|
||||
this(root, null, useServicesMechanism);
|
||||
public SAX2DOM(Node root, boolean overrideDefaultParser)
|
||||
throws ParserConfigurationException {
|
||||
this(root, null, overrideDefaultParser);
|
||||
}
|
||||
|
||||
public Node getDOM() {
|
||||
@ -306,18 +305,13 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
public void startDTD(String name, String publicId, String systemId)
|
||||
throws SAXException {}
|
||||
|
||||
private Document createDocument(boolean useServicesMechanism) throws ParserConfigurationException {
|
||||
private Document createDocument(boolean overrideDefaultParser)
|
||||
throws ParserConfigurationException {
|
||||
if (_factory == null) {
|
||||
if (useServicesMechanism) {
|
||||
_factory = DocumentBuilderFactory.newInstance();
|
||||
if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) {
|
||||
_internal = false;
|
||||
}
|
||||
} else {
|
||||
_factory = DocumentBuilderFactory.newInstance(
|
||||
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
|
||||
SAX2DOM.class.getClassLoader()
|
||||
);
|
||||
_factory = JdkXmlUtils.getDOMFactory(overrideDefaultParser);
|
||||
_internal = true;
|
||||
if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) {
|
||||
_internal = false;
|
||||
}
|
||||
}
|
||||
Document doc;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -98,7 +98,7 @@ public class TemplatesHandlerImpl
|
||||
_tfactory = tfactory;
|
||||
|
||||
// Instantiate XSLTC and get reference to parser object
|
||||
XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getJdkXmlFeatures());
|
||||
XSLTC xsltc = new XSLTC(tfactory.getJdkXmlFeatures());
|
||||
if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
|
||||
xsltc.setSecureProcessing(true);
|
||||
|
||||
|
||||
@ -140,9 +140,9 @@ public final class TemplatesImpl implements Templates, Serializable {
|
||||
private transient TransformerFactoryImpl _tfactory = null;
|
||||
|
||||
/**
|
||||
* A flag to determine whether the Service Mechanism is used
|
||||
* A flag to determine whether the system-default parser may be overridden
|
||||
*/
|
||||
private transient boolean _useServicesMechanism;
|
||||
private transient boolean _overrideDefaultParser;
|
||||
|
||||
/**
|
||||
* protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
|
||||
@ -239,7 +239,7 @@ public final class TemplatesImpl implements Templates, Serializable {
|
||||
_outputProperties = outputProperties;
|
||||
_indentNumber = indentNumber;
|
||||
_tfactory = tfactory;
|
||||
_useServicesMechanism = tfactory.useServicesMechnism();
|
||||
_overrideDefaultParser = tfactory.overrideDefaultParser();
|
||||
_accessExternalStylesheet = (String) tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
|
||||
}
|
||||
/**
|
||||
@ -322,8 +322,8 @@ public final class TemplatesImpl implements Templates, Serializable {
|
||||
/**
|
||||
* Return the state of the services mechanism feature.
|
||||
*/
|
||||
public boolean useServicesMechnism() {
|
||||
return _useServicesMechanism;
|
||||
public boolean overrideDefaultParser() {
|
||||
return _overrideDefaultParser;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -552,7 +552,7 @@ public final class TemplatesImpl implements Templates, Serializable {
|
||||
AbstractTranslet translet = (AbstractTranslet) _class[_transletIndex].newInstance();
|
||||
translet.postInitialization();
|
||||
translet.setTemplates(this);
|
||||
translet.setServicesMechnism(_useServicesMechanism);
|
||||
translet.setOverrideDefaultParser(_overrideDefaultParser);
|
||||
translet.setAllowedProtocols(_accessExternalStylesheet);
|
||||
if (_auxClasses != null) {
|
||||
translet.setAuxiliaryClasses(_auxClasses);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -24,11 +23,6 @@ package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.FactoryConfigurationError;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
@ -36,13 +30,13 @@ import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
|
||||
import com.sun.org.apache.xml.internal.utils.XMLReaderManager;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLFilterImpl;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
/**
|
||||
* skeleton extension of XMLFilterImpl for now.
|
||||
@ -53,7 +47,7 @@ public class TrAXFilter extends XMLFilterImpl {
|
||||
private Templates _templates;
|
||||
private TransformerImpl _transformer;
|
||||
private TransformerHandlerImpl _transformerHandler;
|
||||
private boolean _useServicesMechanism = true;
|
||||
private boolean _overrideDefaultParser;
|
||||
|
||||
public TrAXFilter(Templates templates) throws
|
||||
TransformerConfigurationException
|
||||
@ -61,7 +55,7 @@ public class TrAXFilter extends XMLFilterImpl {
|
||||
_templates = templates;
|
||||
_transformer = (TransformerImpl) templates.newTransformer();
|
||||
_transformerHandler = new TransformerHandlerImpl(_transformer);
|
||||
_useServicesMechanism = _transformer.useServicesMechnism();
|
||||
_overrideDefaultParser = _transformer.overrideDefaultParser();
|
||||
}
|
||||
|
||||
public Transformer getTransformer() {
|
||||
@ -69,36 +63,14 @@ public class TrAXFilter extends XMLFilterImpl {
|
||||
}
|
||||
|
||||
private void createParent() throws SAXException {
|
||||
XMLReader parent = null;
|
||||
try {
|
||||
SAXParserFactory pfactory = SAXParserFactory.newInstance();
|
||||
pfactory.setNamespaceAware(true);
|
||||
|
||||
if (_transformer.isSecureProcessing()) {
|
||||
try {
|
||||
pfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
}
|
||||
catch (SAXException e) {}
|
||||
}
|
||||
|
||||
SAXParser saxparser = pfactory.newSAXParser();
|
||||
parent = saxparser.getXMLReader();
|
||||
}
|
||||
catch (ParserConfigurationException e) {
|
||||
throw new SAXException(e);
|
||||
}
|
||||
catch (FactoryConfigurationError e) {
|
||||
throw new SAXException(e.toString());
|
||||
}
|
||||
|
||||
if (parent == null) {
|
||||
parent = XMLReaderFactory.createXMLReader();
|
||||
}
|
||||
XMLReader parent = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
|
||||
_transformer.isSecureProcessing());
|
||||
|
||||
// make this XMLReader the parent of this filter
|
||||
setParent(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parse (InputSource input) throws SAXException, IOException
|
||||
{
|
||||
XMLReader managedReader = null;
|
||||
@ -106,7 +78,7 @@ public class TrAXFilter extends XMLFilterImpl {
|
||||
try {
|
||||
if (getParent() == null) {
|
||||
try {
|
||||
managedReader = XMLReaderManager.getInstance(_useServicesMechanism)
|
||||
managedReader = XMLReaderManager.getInstance(_overrideDefaultParser)
|
||||
.getXMLReader();
|
||||
setParent(managedReader);
|
||||
} catch (SAXException e) {
|
||||
@ -118,7 +90,7 @@ public class TrAXFilter extends XMLFilterImpl {
|
||||
getParent().parse(input);
|
||||
} finally {
|
||||
if (managedReader != null) {
|
||||
XMLReaderManager.getInstance(_useServicesMechanism).releaseXMLReader(managedReader);
|
||||
XMLReaderManager.getInstance(_overrideDefaultParser).releaseXMLReader(managedReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,7 +21,6 @@
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
|
||||
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
|
||||
@ -56,15 +55,12 @@ import javax.xml.catalog.CatalogFeatures;
|
||||
import javax.xml.catalog.CatalogFeatures.Feature;
|
||||
import javax.xml.catalog.CatalogManager;
|
||||
import javax.xml.catalog.CatalogResolver;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.URIResolver;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
@ -79,17 +75,16 @@ import javax.xml.transform.stream.StreamSource;
|
||||
import jdk.xml.internal.JdkXmlFeatures;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLFilter;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
/**
|
||||
* Implementation of a JAXP1.1 TransformerFactory for Translets.
|
||||
* Implementation of a JAXP TransformerFactory for Translets.
|
||||
* @author G. Todd Miller
|
||||
* @author Morten Jorgensen
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
@SuppressWarnings("deprecation") //org.xml.sax.helpers.XMLReaderFactory
|
||||
public class TransformerFactoryImpl
|
||||
extends SAXTransformerFactory implements SourceLoader, ErrorListener
|
||||
{
|
||||
@ -215,11 +210,11 @@ public class TransformerFactoryImpl
|
||||
private boolean _isSecureMode = false;
|
||||
|
||||
/**
|
||||
* Indicates whether implementation parts should use
|
||||
* service loader (or similar).
|
||||
* Note the default value (false) is the safe option..
|
||||
* Indicates whether 3rd party parser may be used to override the system-default
|
||||
* Note the default value (false) is the safe option.
|
||||
* Note same as the old property useServicesMechanism
|
||||
*/
|
||||
private boolean _useServicesMechanism;
|
||||
private boolean _overrideDefaultParser;
|
||||
|
||||
/**
|
||||
* protocols allowed for external references set by the stylesheet
|
||||
@ -258,15 +253,6 @@ public class TransformerFactoryImpl
|
||||
* javax.xml.transform.sax.TransformerFactory implementation.
|
||||
*/
|
||||
public TransformerFactoryImpl() {
|
||||
this(true);
|
||||
}
|
||||
|
||||
public static TransformerFactory newTransformerFactoryNoServiceLoader() {
|
||||
return new TransformerFactoryImpl(false);
|
||||
}
|
||||
|
||||
private TransformerFactoryImpl(boolean useServicesMechanism) {
|
||||
this._useServicesMechanism = useServicesMechanism;
|
||||
|
||||
if (System.getSecurityManager() != null) {
|
||||
_isSecureMode = true;
|
||||
@ -274,6 +260,8 @@ public class TransformerFactoryImpl
|
||||
}
|
||||
|
||||
_xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
|
||||
_overrideDefaultParser = _xmlFeatures.getFeature(
|
||||
JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
|
||||
_xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
|
||||
_accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
|
||||
Property.ACCESS_EXTERNAL_DTD);
|
||||
@ -593,14 +581,20 @@ public class TransformerFactoryImpl
|
||||
JdkXmlFeatures.State.FSP, false);
|
||||
}
|
||||
}
|
||||
else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
|
||||
//in secure mode, let _useServicesMechanism be determined by the constructor
|
||||
if (!_isSecureMode)
|
||||
_useServicesMechanism = value;
|
||||
}
|
||||
else {
|
||||
if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
|
||||
// for compatibility, in secure mode, useServicesMechanism is determined by the constructor
|
||||
if (_isSecureMode) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_xmlFeatures != null &&
|
||||
_xmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
|
||||
if (name.equals(JdkXmlUtils.OVERRIDE_PARSER) ||
|
||||
name.equals(JdkXmlFeatures.ORACLE_FEATURE_SERVICE_MECHANISM)) {
|
||||
_overrideDefaultParser = _xmlFeatures.getFeature(
|
||||
JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -665,8 +659,8 @@ public class TransformerFactoryImpl
|
||||
/**
|
||||
* Return the state of the services mechanism feature.
|
||||
*/
|
||||
public boolean useServicesMechnism() {
|
||||
return _useServicesMechanism;
|
||||
public boolean overrideDefaultParser() {
|
||||
return _overrideDefaultParser;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -725,10 +719,9 @@ public class TransformerFactoryImpl
|
||||
throws TransformerConfigurationException {
|
||||
|
||||
String baseId;
|
||||
XMLReader reader;
|
||||
XMLReader reader = null;
|
||||
InputSource isource;
|
||||
|
||||
|
||||
/**
|
||||
* Fix for bugzilla bug 24187
|
||||
*/
|
||||
@ -747,24 +740,15 @@ public class TransformerFactoryImpl
|
||||
dom2sax.setContentHandler( _stylesheetPIHandler);
|
||||
dom2sax.parse();
|
||||
} else {
|
||||
if (source instanceof SAXSource) {
|
||||
reader = ((SAXSource)source).getXMLReader();
|
||||
}
|
||||
isource = SAXSource.sourceToInputSource(source);
|
||||
baseId = isource.getSystemId();
|
||||
|
||||
SAXParserFactory factory = FactoryImpl.getSAXFactory(_useServicesMechanism);
|
||||
factory.setNamespaceAware(true);
|
||||
|
||||
if (!_isNotSecureProcessing) {
|
||||
try {
|
||||
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
}
|
||||
catch (org.xml.sax.SAXException e) {}
|
||||
}
|
||||
|
||||
SAXParser jaxpParser = factory.newSAXParser();
|
||||
|
||||
reader = jaxpParser.getXMLReader();
|
||||
if (reader == null) {
|
||||
reader = XMLReaderFactory.createXMLReader();
|
||||
reader = JdkXmlUtils.getXMLReader(_overrideDefaultParser,
|
||||
!_isNotSecureProcessing);
|
||||
}
|
||||
|
||||
_stylesheetPIHandler.setBaseId(baseId);
|
||||
@ -780,7 +764,7 @@ public class TransformerFactoryImpl
|
||||
} catch (StopParseException e ) {
|
||||
// startElement encountered so do not parse further
|
||||
|
||||
} catch (javax.xml.parsers.ParserConfigurationException | org.xml.sax.SAXException | IOException e) {
|
||||
} catch (SAXException | IOException e) {
|
||||
throw new TransformerConfigurationException(
|
||||
"getAssociatedStylesheets failed", e);
|
||||
}
|
||||
@ -961,7 +945,7 @@ public class TransformerFactoryImpl
|
||||
}
|
||||
|
||||
// Create and initialize a stylesheet compiler
|
||||
final XSLTC xsltc = new XSLTC(_useServicesMechanism, _xmlFeatures);
|
||||
final XSLTC xsltc = new XSLTC(_xmlFeatures);
|
||||
if (_debug) xsltc.setDebug(true);
|
||||
if (_enableInlining)
|
||||
xsltc.setTemplateInlining(true);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,7 +21,6 @@
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOM;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOMCache;
|
||||
@ -100,8 +99,6 @@ public final class TransformerImpl extends Transformer
|
||||
|
||||
private final static String LEXICAL_HANDLER_PROPERTY =
|
||||
"http://xml.org/sax/properties/lexical-handler";
|
||||
private static final String NAMESPACE_FEATURE =
|
||||
"http://xml.org/sax/features/namespaces";
|
||||
|
||||
/**
|
||||
* Namespace prefixes feature for {@link XMLReader}.
|
||||
@ -198,15 +195,10 @@ public final class TransformerImpl extends Transformer
|
||||
private boolean _isSecureProcessing = false;
|
||||
|
||||
/**
|
||||
* Indicates whether implementation parts should use
|
||||
* service loader (or similar).
|
||||
* Note the default value (false) is the safe option..
|
||||
* Indicates whether 3rd party parser may be used to override the system-default
|
||||
*/
|
||||
private boolean _useServicesMechanism;
|
||||
/**
|
||||
* protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
|
||||
*/
|
||||
private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
|
||||
private boolean _overrideDefaultParser;
|
||||
|
||||
/**
|
||||
* protocols allowed for external DTD references in source file and/or stylesheet.
|
||||
*/
|
||||
@ -274,11 +266,10 @@ public final class TransformerImpl extends Transformer
|
||||
_propertiesClone = (Properties) _properties.clone();
|
||||
_indentNumber = indentNumber;
|
||||
_tfactory = tfactory;
|
||||
_useServicesMechanism = _tfactory.useServicesMechnism();
|
||||
_accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
|
||||
_overrideDefaultParser = _tfactory.overrideDefaultParser();
|
||||
_accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
|
||||
_securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
|
||||
_readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
|
||||
_readerManager = XMLReaderManager.getInstance(_overrideDefaultParser);
|
||||
_readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
|
||||
_readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
|
||||
_readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
|
||||
@ -315,15 +306,15 @@ public final class TransformerImpl extends Transformer
|
||||
/**
|
||||
* Return the state of the services mechanism feature.
|
||||
*/
|
||||
public boolean useServicesMechnism() {
|
||||
return _useServicesMechanism;
|
||||
public boolean overrideDefaultParser() {
|
||||
return _overrideDefaultParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the services mechanism feature.
|
||||
*/
|
||||
public void setServicesMechnism(boolean flag) {
|
||||
_useServicesMechanism = flag;
|
||||
public void setOverrideDefaultParser(boolean flag) {
|
||||
_overrideDefaultParser = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,7 +398,7 @@ public final class TransformerImpl extends Transformer
|
||||
// Get encoding using getProperty() to use defaults
|
||||
_encoding = (String) _properties.getProperty(OutputKeys.ENCODING);
|
||||
|
||||
_tohFactory = TransletOutputHandlerFactory.newInstance(_useServicesMechanism);
|
||||
_tohFactory = TransletOutputHandlerFactory.newInstance(_overrideDefaultParser);
|
||||
_tohFactory.setEncoding(_encoding);
|
||||
if (_method != null) {
|
||||
_tohFactory.setOutputMethod(_method);
|
||||
@ -577,7 +568,7 @@ public final class TransformerImpl extends Transformer
|
||||
if (_dtmManager == null) {
|
||||
_dtmManager =
|
||||
_tfactory.createNewDTMManagerInstance();
|
||||
_dtmManager.setServicesMechnism(_useServicesMechanism);
|
||||
_dtmManager.setOverrideDefaultParser(_overrideDefaultParser);
|
||||
}
|
||||
dom = (DOM)_dtmManager.getDTM(source, false, wsfilter, true,
|
||||
false, false, 0, hasIdCall);
|
||||
@ -752,7 +743,7 @@ public final class TransformerImpl extends Transformer
|
||||
|
||||
boolean supportCatalog = true;
|
||||
|
||||
DocumentBuilderFactory builderF = FactoryImpl.getDOMFactory(_useServicesMechanism);
|
||||
DocumentBuilderFactory builderF = JdkXmlUtils.getDOMFactory(_overrideDefaultParser);
|
||||
try {
|
||||
builderF.setFeature(XMLConstants.USE_CATALOG, _useCatalog);
|
||||
} catch (ParserConfigurationException e) {
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,7 +21,6 @@
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.XalanConstants;
|
||||
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
|
||||
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
@ -30,8 +29,6 @@ import java.io.Reader;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.catalog.CatalogFeatures;
|
||||
import javax.xml.catalog.CatalogFeatures.Feature;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.transform.Source;
|
||||
@ -42,13 +39,13 @@ import javax.xml.transform.stax.StAXSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import jdk.xml.internal.JdkXmlFeatures;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import jdk.xml.internal.SecuritySupport;
|
||||
import org.w3c.dom.Document;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
/**
|
||||
* @author Santiago Pericas-Geertsen
|
||||
@ -56,6 +53,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
|
||||
* Added Catalog Support for URI resolution
|
||||
*/
|
||||
public final class Util {
|
||||
private static final String property = "org.xml.sax.driver";
|
||||
|
||||
public static String baseName(String name) {
|
||||
return com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util.baseName(name);
|
||||
@ -88,54 +86,18 @@ public final class Util {
|
||||
try {
|
||||
XMLReader reader = sax.getXMLReader();
|
||||
|
||||
/*
|
||||
* Fix for bug 24695
|
||||
* According to JAXP 1.2 specification if a SAXSource
|
||||
* is created using a SAX InputSource the Transformer or
|
||||
* TransformerFactory creates a reader via the
|
||||
* XMLReaderFactory if setXMLReader is not used
|
||||
*/
|
||||
|
||||
if (reader == null) {
|
||||
try {
|
||||
reader= XMLReaderFactory.createXMLReader();
|
||||
try {
|
||||
reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
|
||||
xsltc.isSecureProcessing());
|
||||
} catch (SAXNotRecognizedException e) {
|
||||
XMLSecurityManager.printWarning(reader.getClass().getName(),
|
||||
XMLConstants.FEATURE_SECURE_PROCESSING, e);
|
||||
}
|
||||
} catch (Exception e ) {
|
||||
try {
|
||||
|
||||
//Incase there is an exception thrown
|
||||
// resort to JAXP
|
||||
SAXParserFactory parserFactory = FactoryImpl.getSAXFactory(xsltc.useServicesMechnism());
|
||||
parserFactory.setNamespaceAware(true);
|
||||
|
||||
if (xsltc.isSecureProcessing()) {
|
||||
try {
|
||||
parserFactory.setFeature(
|
||||
XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
}
|
||||
catch (org.xml.sax.SAXException se) {}
|
||||
}
|
||||
|
||||
reader = parserFactory.newSAXParser()
|
||||
.getXMLReader();
|
||||
|
||||
|
||||
} catch (ParserConfigurationException pce ) {
|
||||
throw new TransformerConfigurationException
|
||||
("ParserConfigurationException" ,pce);
|
||||
}
|
||||
}
|
||||
boolean overrideDefaultParser = xsltc.getFeature(
|
||||
JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
|
||||
reader = JdkXmlUtils.getXMLReader(overrideDefaultParser,
|
||||
xsltc.isSecureProcessing());
|
||||
} else {
|
||||
// compatibility for legacy applications
|
||||
reader.setFeature
|
||||
(JdkXmlUtils.NAMESPACES_FEATURE,true);
|
||||
reader.setFeature
|
||||
(JdkXmlUtils.NAMESPACE_PREFIXES_FEATURE,false);
|
||||
}
|
||||
reader.setFeature
|
||||
("http://xml.org/sax/features/namespaces",true);
|
||||
reader.setFeature
|
||||
("http://xml.org/sax/features/namespace-prefixes",false);
|
||||
|
||||
JdkXmlUtils.setXMLReaderPropertyIfSupport(reader, XMLConstants.ACCESS_EXTERNAL_DTD,
|
||||
xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD), true);
|
||||
@ -191,9 +153,6 @@ public final class Util {
|
||||
}catch (SAXNotSupportedException snse ) {
|
||||
throw new TransformerConfigurationException
|
||||
("SAXNotSupportedException ",snse);
|
||||
}catch (SAXException se ) {
|
||||
throw new TransformerConfigurationException
|
||||
("SAXException ",se);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -258,7 +258,8 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings
|
||||
SEND_PSVI,
|
||||
NAMESPACE_GROWTH,
|
||||
TOLERATE_DUPLICATES,
|
||||
XMLConstants.USE_CATALOG
|
||||
XMLConstants.USE_CATALOG,
|
||||
JdkXmlUtils.OVERRIDE_PARSER
|
||||
};
|
||||
addRecognizedFeatures(recognizedFeatures);
|
||||
|
||||
@ -272,6 +273,7 @@ public class DOMConfigurationImpl extends ParserConfigurationSettings
|
||||
setFeature(SEND_PSVI, true);
|
||||
setFeature(NAMESPACE_GROWTH, false);
|
||||
setFeature(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
|
||||
setFeature(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
|
||||
|
||||
// add default recognized properties
|
||||
final String[] recognizedProperties = {
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
DuplicateUnique = cvc-identity-constraint.4.1: Duplicerat unikt v\u00E4rde [{0}] har deklarerats f\u00F6r identitetsbegr\u00E4nsningen "{2}" f\u00F6r elementet "{1}".
|
||||
FieldMultipleMatch = cvc-identity-constraint.3: F\u00E4ltet "{0}" f\u00F6r identitetsbegr\u00E4nsningen "{1}" matchar flera v\u00E4rden inom omfattningen f\u00F6r v\u00E4ljaren. F\u00E4lt m\u00E5ste matcha unika v\u00E4rden.
|
||||
FixedDiffersFromActual = Elementets inneh\u00E5ll motsvarar inte v\u00E4rdet av attributet som anges som "fixed" i elementdeklarationen i schemat.
|
||||
KeyMatchesNillable = cvc-identity-constraint.4.2.3: Elementet "{0}" har nyckeln "{1}" som matchar ett element d\u00E4r nillable \u00E4r angett till sant.
|
||||
KeyMatchesNillable = cvc-identity-constraint.4.2.3: Elementet "{0}" har nyckeln "{1}" som matchar ett element d\u00E4r nullbar \u00E4r satt till sant.
|
||||
KeyNotEnoughValues = cvc-identity-constraint.4.2.1.b: Inte tillr\u00E4ckligt m\u00E5nga v\u00E4rden har angetts f\u00F6r identitetsbegr\u00E4nsningen <key name="{1}"> som har angetts f\u00F6r elementet "{0}".
|
||||
KeyNotFound = cvc-identity-constraint.4.3: Nyckeln ''{0}'' med v\u00E4rdet ''{1}'' hittades inte f\u00F6r identitetsbegr\u00E4nsningen f\u00F6r elementet ''{2}''.
|
||||
KeyRefOutOfScope = Fel vid id-begr\u00E4nsning: id-begr\u00E4nsning "{0}" har en nyckelreferens som refererar till nyckel eller unikt v\u00E4rde utanf\u00F6r definitionsomr\u00E5det.
|
||||
@ -125,11 +125,11 @@
|
||||
src-attribute.4 = src-attribute.4: Attributet ''{0}'' har b\u00E5de ett ''typ''-attribut och en anonym ''simpleType''-underordnad. Endast ett av dessa till\u00E5ts som attribut.
|
||||
src-attribute_group.2 = src-attribute_group.2: Snittet mellan jokertecken kan inte uttryckas f\u00F6r attributgruppen ''{0}''.
|
||||
src-attribute_group.3 = src-attribute_group.3: Cirkul\u00E4ra definitioner har identifierats f\u00F6r attributgruppen ''{0}''. Rekursivt efterf\u00F6ljande attributgruppreferenser leder s\u00E5 sm\u00E5ningom tillbaka till sig sj\u00E4lv.
|
||||
src-ct.1 = src-ct.1: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <complexContent> anv\u00E4nds m\u00E5ste bastyp vara complexType. ''{1}'' \u00E4r simpleType.
|
||||
src-ct.2.1 = src-ct.2.1: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <simpleContent> anv\u00E4nds m\u00E5ste bastyp vara complexType vars inneh\u00E5ll \u00E4r enkelt, eller, om det finns en angiven begr\u00E4nsning, komplex typ med blandat inneh\u00E5ll och t\u00F6mningsbar partikel, eller, om det finns ett angivet till\u00E4gg, enkel typ. ''{1}'' uppfyller inget av dessa villkor.
|
||||
src-ct.2.2 = src-ct.2.2: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om complexType med simpleContent begr\u00E4nsar complexType med blandat inneh\u00E5ll och t\u00F6mningsbar partikel m\u00E5ste det finnas en <simpleType> bland underordnade i <restriction>.
|
||||
src-ct.4 = src-ct.4: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Snittet mellan jokertecken kan inte uttryckas.
|
||||
src-ct.5 = src-ct.5: Fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Unionen mellan jokertecken kan inte uttryckas.
|
||||
src-ct.1 = src-ct.1: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <complexContent> anv\u00E4nds m\u00E5ste bastyp vara complexType. ''{1}'' \u00E4r simpleType.
|
||||
src-ct.2.1 = src-ct.2.1: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om <simpleContent> anv\u00E4nds m\u00E5ste bastyp vara complexType vars inneh\u00E5ll \u00E4r enkelt, eller, om det finns en angiven begr\u00E4nsning, komplex typ med blandat inneh\u00E5ll och t\u00F6mningsbar partikel, eller, om det finns ett angivet till\u00E4gg, enkel typ. ''{1}'' uppfyller inget av dessa villkor.
|
||||
src-ct.2.2 = src-ct.2.2: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Om complexType med simpleContent begr\u00E4nsar complexType med blandat inneh\u00E5ll och t\u00F6mningsbar partikel m\u00E5ste det finnas en <simpleType> bland underordnade i <restriction>.
|
||||
src-ct.4 = src-ct.4: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Snittet mellan jokertecken kan inte uttryckas.
|
||||
src-ct.5 = src-ct.5: Ett fel intr\u00E4ffade vid representationen av definition f\u00F6r typ ''{0}''. Unionen mellan jokertecken kan inte uttryckas.
|
||||
src-element.1 = src-element.1: B\u00E5da egenskaperna ''default'' och ''fixed'' kan inte samtidigt ing\u00E5 i elementdeklarationen ''{0}''. Anv\u00E4nd en av dem.
|
||||
src-element.2.1 = src-element.2.1: Antingen 'ref' eller 'name' m\u00E5ste anges i den lokala elementdeklarationen.
|
||||
src-element.2.2 = src-element.2.2: Eftersom ''{0}'' inneh\u00E5ller ett ''ref''-attribut m\u00E5ste inneh\u00E5llet matcha (annotation?). ''{1}'' hittades dock inte.
|
||||
|
||||
@ -76,6 +76,7 @@ import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.WeakHashMap;
|
||||
import javax.xml.XMLConstants;
|
||||
import jdk.xml.internal.JdkXmlFeatures;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import org.w3c.dom.DOMConfiguration;
|
||||
import org.w3c.dom.DOMError;
|
||||
@ -159,7 +160,7 @@ XSLoader, DOMConfiguration {
|
||||
protected static final String SCHEMA_DV_FACTORY =
|
||||
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
|
||||
|
||||
protected static final String USE_SERVICE_MECHANISM = Constants.ORACLE_FEATURE_SERVICE_MECHANISM;
|
||||
protected static final String OVERRIDE_PARSER = JdkXmlUtils.OVERRIDE_PARSER;
|
||||
|
||||
// recognized features:
|
||||
private static final String[] RECOGNIZED_FEATURES = {
|
||||
@ -174,7 +175,7 @@ XSLoader, DOMConfiguration {
|
||||
HONOUR_ALL_SCHEMALOCATIONS,
|
||||
NAMESPACE_GROWTH,
|
||||
TOLERATE_DUPLICATES,
|
||||
USE_SERVICE_MECHANISM,
|
||||
OVERRIDE_PARSER,
|
||||
XMLConstants.USE_CATALOG
|
||||
};
|
||||
|
||||
@ -312,18 +313,14 @@ XSLoader, DOMConfiguration {
|
||||
* @param sHandler
|
||||
* @param builder
|
||||
*/
|
||||
XMLSchemaLoader(XMLErrorReporter errorReporter,
|
||||
XSGrammarBucket grammarBucket,
|
||||
XMLSchemaLoader(XMLErrorReporter errorReporter, XSGrammarBucket grammarBucket,
|
||||
SubstitutionGroupHandler sHandler, CMBuilder builder) {
|
||||
this(null, errorReporter, null, grammarBucket, sHandler, builder);
|
||||
}
|
||||
|
||||
XMLSchemaLoader(SymbolTable symbolTable,
|
||||
XMLErrorReporter errorReporter,
|
||||
XMLEntityManager entityResolver,
|
||||
XSGrammarBucket grammarBucket,
|
||||
SubstitutionGroupHandler sHandler,
|
||||
CMBuilder builder) {
|
||||
XMLSchemaLoader(SymbolTable symbolTable, XMLErrorReporter errorReporter,
|
||||
XMLEntityManager entityResolver, XSGrammarBucket grammarBucket,
|
||||
SubstitutionGroupHandler sHandler, CMBuilder builder) {
|
||||
|
||||
// store properties and features in configuration
|
||||
fLoaderConfig.addRecognizedFeatures(RECOGNIZED_FEATURES);
|
||||
@ -1230,7 +1227,7 @@ XSLoader, DOMConfiguration {
|
||||
name.equals(HONOUR_ALL_SCHEMALOCATIONS) ||
|
||||
name.equals(NAMESPACE_GROWTH) ||
|
||||
name.equals(TOLERATE_DUPLICATES) ||
|
||||
name.equals(USE_SERVICE_MECHANISM)) {
|
||||
name.equals(OVERRIDE_PARSER)) {
|
||||
return true;
|
||||
|
||||
}
|
||||
@ -1309,7 +1306,7 @@ XSLoader, DOMConfiguration {
|
||||
v.add(HONOUR_ALL_SCHEMALOCATIONS);
|
||||
v.add(NAMESPACE_GROWTH);
|
||||
v.add(TOLERATE_DUPLICATES);
|
||||
v.add(USE_SERVICE_MECHANISM);
|
||||
v.add(OVERRIDE_PARSER);
|
||||
fRecognizedParameters = new DOMStringListImpl(v);
|
||||
}
|
||||
return fRecognizedParameters;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -264,7 +264,7 @@ public class XMLSchemaValidator
|
||||
private static final String XML_SECURITY_PROPERTY_MANAGER =
|
||||
Constants.XML_SECURITY_PROPERTY_MANAGER;
|
||||
|
||||
protected static final String USE_SERVICE_MECHANISM = Constants.ORACLE_FEATURE_SERVICE_MECHANISM;
|
||||
protected static final String OVERRIDE_PARSER = JdkXmlUtils.OVERRIDE_PARSER;
|
||||
|
||||
protected static final String USE_CATALOG = XMLConstants.USE_CATALOG;
|
||||
|
||||
@ -290,8 +290,8 @@ public class XMLSchemaValidator
|
||||
UNPARSED_ENTITY_CHECKING,
|
||||
NAMESPACE_GROWTH,
|
||||
TOLERATE_DUPLICATES,
|
||||
USE_SERVICE_MECHANISM,
|
||||
USE_CATALOG
|
||||
OVERRIDE_PARSER,
|
||||
USE_CATALOG,
|
||||
};
|
||||
|
||||
/** Feature defaults. */
|
||||
@ -322,7 +322,7 @@ public class XMLSchemaValidator
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
Boolean.TRUE,
|
||||
JdkXmlUtils.OVERRIDE_PARSER_DEFAULT,
|
||||
JdkXmlUtils.USE_CATALOG_DEFAULT
|
||||
};
|
||||
|
||||
|
||||
@ -304,7 +304,8 @@ public class SchemaParsingConfig extends BasicParserConfiguration
|
||||
ALLOW_JAVA_ENCODINGS, CONTINUE_AFTER_FATAL_ERROR,
|
||||
LOAD_EXTERNAL_DTD, NOTIFY_BUILTIN_REFS,
|
||||
NOTIFY_CHAR_REFS, GENERATE_SYNTHETIC_ANNOTATIONS,
|
||||
XMLConstants.USE_CATALOG
|
||||
XMLConstants.USE_CATALOG,
|
||||
JdkXmlUtils.OVERRIDE_PARSER
|
||||
};
|
||||
addRecognizedFeatures(recognizedFeatures);
|
||||
fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
|
||||
@ -319,6 +320,7 @@ public class SchemaParsingConfig extends BasicParserConfiguration
|
||||
fFeatures.put(NOTIFY_CHAR_REFS, Boolean.FALSE);
|
||||
fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
|
||||
fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
|
||||
fFeatures.put(JdkXmlUtils.OVERRIDE_PARSER, JdkXmlUtils.OVERRIDE_PARSER_DEFAULT);
|
||||
|
||||
// add default recognized properties
|
||||
final String[] recognizedProperties = {
|
||||
|
||||
@ -26,6 +26,7 @@ import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
|
||||
import com.sun.org.apache.xerces.internal.util.SAXLocatorWrapper;
|
||||
import com.sun.org.apache.xerces.internal.util.SymbolTable;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
|
||||
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
|
||||
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
|
||||
import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
@ -78,6 +79,7 @@ final class SchemaContentHandler implements ContentHandler {
|
||||
private final QName fAttributeQName = new QName();
|
||||
private final XMLAttributesImpl fAttributes = new XMLAttributesImpl();
|
||||
private final XMLString fTempString = new XMLString();
|
||||
private final XMLStringBuffer fStringBuffer = new XMLStringBuffer();
|
||||
|
||||
/**
|
||||
* <p>Constructs an SchemaContentHandler.</p>
|
||||
@ -103,6 +105,7 @@ final class SchemaContentHandler implements ContentHandler {
|
||||
*/
|
||||
public void startDocument() throws SAXException {
|
||||
fNeedPushNSContext = true;
|
||||
fNamespaceContext.reset();
|
||||
try {
|
||||
fSchemaDOMParser.startDocument(fSAXLocatorWrapper, null, fNamespaceContext, null);
|
||||
}
|
||||
@ -326,7 +329,11 @@ final class SchemaContentHandler implements ContentHandler {
|
||||
if (nsPrefix.length() > 0) {
|
||||
prefix = XMLSymbols.PREFIX_XMLNS;
|
||||
localpart = nsPrefix;
|
||||
rawname = fSymbolTable.addSymbol(prefix + ":" + localpart);
|
||||
fStringBuffer.clear();
|
||||
fStringBuffer.append(prefix);
|
||||
fStringBuffer.append(':');
|
||||
fStringBuffer.append(localpart);
|
||||
rawname = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
|
||||
}
|
||||
else {
|
||||
prefix = XMLSymbols.EMPTY_STRING;
|
||||
@ -334,7 +341,8 @@ final class SchemaContentHandler implements ContentHandler {
|
||||
rawname = XMLSymbols.PREFIX_XMLNS;
|
||||
}
|
||||
fAttributeQName.setValues(prefix, localpart, rawname, NamespaceContext.XMLNS_URI);
|
||||
fAttributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, nsURI);
|
||||
fAttributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol,
|
||||
(nsURI != null) ? nsURI : XMLSymbols.EMPTY_STRING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -115,7 +115,6 @@ import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
/**
|
||||
* The purpose of this class is to co-ordinate the construction of a
|
||||
@ -420,6 +419,8 @@ public class XSDHandler {
|
||||
private String fPrefer;
|
||||
private String fResolve;
|
||||
|
||||
private boolean fOverrideDefaultParser;
|
||||
|
||||
//************ Traversers **********
|
||||
XSDAttributeGroupTraverser fAttributeGroupTraverser;
|
||||
XSDAttributeTraverser fAttributeTraverser;
|
||||
@ -2237,7 +2238,8 @@ public class XSDHandler {
|
||||
XSDKey key = null;
|
||||
String schemaId = null;
|
||||
if (referType != XSDDescription.CONTEXT_PREPARSE) {
|
||||
schemaId = XMLEntityManager.expandSystemId(inputSource.getSystemId(), schemaSource.getBaseSystemId(), false);
|
||||
schemaId = XMLEntityManager.expandSystemId(inputSource.getSystemId(),
|
||||
schemaSource.getBaseSystemId(), false);
|
||||
key = new XSDKey(schemaId, referType, schemaNamespace);
|
||||
if ((schemaElement = fTraversed.get(key)) != null) {
|
||||
fLastSchemaWasDuplicate = true;
|
||||
@ -2253,14 +2255,9 @@ public class XSDHandler {
|
||||
catch (SAXException se) {}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
parser = XMLReaderFactory.createXMLReader();
|
||||
}
|
||||
// If something went wrong with the factory
|
||||
// just use our own SAX parser.
|
||||
catch (SAXException se) {
|
||||
parser = new SAXParser();
|
||||
}
|
||||
parser = JdkXmlUtils.getXMLReader(fOverrideDefaultParser,
|
||||
fSecurityManager.isSecureProcessing());
|
||||
|
||||
try {
|
||||
parser.setFeature(NAMESPACE_PREFIXES, true);
|
||||
namespacePrefixes = true;
|
||||
@ -3618,6 +3615,9 @@ public class XSDHandler {
|
||||
fAccessExternalSchema = fSecurityPropertyMgr.getValue(
|
||||
XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
|
||||
|
||||
fOverrideDefaultParser = componentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER);
|
||||
fSchemaParser.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
|
||||
fEntityManager.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
|
||||
// Passing the Catalog settings to the parser
|
||||
fUseCatalog = componentManager.getFeature(XMLConstants.USE_CATALOG);
|
||||
fSchemaParser.setFeature(XMLConstants.USE_CATALOG, fUseCatalog);
|
||||
|
||||
@ -48,6 +48,7 @@ import com.sun.org.apache.xerces.internal.xni.QName;
|
||||
import com.sun.org.apache.xerces.internal.xni.XMLString;
|
||||
import com.sun.org.apache.xerces.internal.xni.XNIException;
|
||||
import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.CDATASection;
|
||||
import org.w3c.dom.Comment;
|
||||
@ -382,9 +383,8 @@ final class DOMValidatorHelper implements ValidatorHelper, EntityState {
|
||||
}
|
||||
if (result.getNode() == null) {
|
||||
try {
|
||||
DocumentBuilderFactory factory = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
|
||||
DocumentBuilderFactory.newInstance() : new DocumentBuilderFactoryImpl();
|
||||
factory.setNamespaceAware(true);
|
||||
DocumentBuilderFactory factory = JdkXmlUtils.getDOMFactory(
|
||||
fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER));
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
result.setNode(builder.newDocument());
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
package com.sun.org.apache.xerces.internal.jaxp.validation;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl;
|
||||
import com.sun.org.apache.xerces.internal.impl.Constants;
|
||||
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
|
||||
import java.io.IOException;
|
||||
@ -41,6 +42,7 @@ import javax.xml.transform.sax.SAXTransformerFactory;
|
||||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stax.StAXResult;
|
||||
import javax.xml.transform.stax.StAXSource;
|
||||
import jdk.xml.internal.JdkXmlUtils;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@ -50,7 +52,6 @@ import org.xml.sax.SAXException;
|
||||
* @author <a href="mailto:Sunitha.Reddy@Sun.com">Sunitha Reddy</a>
|
||||
*/
|
||||
public final class StAXValidatorHelper implements ValidatorHelper {
|
||||
private static final String DEFAULT_TRANSFORMER_IMPL = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
|
||||
|
||||
/** Component manager. **/
|
||||
private XMLSchemaValidatorComponentManager fComponentManager;
|
||||
@ -71,10 +72,11 @@ public final class StAXValidatorHelper implements ValidatorHelper {
|
||||
|
||||
if( identityTransformer1==null ) {
|
||||
try {
|
||||
SAXTransformerFactory tf = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
|
||||
(SAXTransformerFactory)SAXTransformerFactory.newInstance()
|
||||
: (SAXTransformerFactory) TransformerFactory.newInstance(DEFAULT_TRANSFORMER_IMPL, StAXValidatorHelper.class.getClassLoader());
|
||||
XMLSecurityManager securityManager = (XMLSecurityManager)fComponentManager.getProperty(Constants.SECURITY_MANAGER);
|
||||
SAXTransformerFactory tf = JdkXmlUtils.getSAXTransformFactory(
|
||||
fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER));
|
||||
|
||||
XMLSecurityManager securityManager =
|
||||
(XMLSecurityManager)fComponentManager.getProperty(Constants.SECURITY_MANAGER);
|
||||
if (securityManager != null) {
|
||||
for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
|
||||
if (securityManager.isSet(limit.ordinal())){
|
||||
|
||||
@ -98,9 +98,6 @@ final class StreamValidatorHelper implements ValidatorHelper {
|
||||
private static final String VALIDATION_MANAGER
|
||||
= Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
|
||||
|
||||
private static final String DEFAULT_TRANSFORMER_IMPL
|
||||
= "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
|
||||
|
||||
/**
|
||||
* Property id: security manager.
|
||||
*/
|
||||
@ -141,12 +138,9 @@ final class StreamValidatorHelper implements ValidatorHelper {
|
||||
|
||||
if (result != null) {
|
||||
try {
|
||||
SAXTransformerFactory tf = fComponentManager.getFeature(
|
||||
Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
|
||||
(SAXTransformerFactory) SAXTransformerFactory.newInstance() :
|
||||
(SAXTransformerFactory) TransformerFactory.newInstance(
|
||||
DEFAULT_TRANSFORMER_IMPL,
|
||||
StreamValidatorHelper.class.getClassLoader());
|
||||
SAXTransformerFactory tf = JdkXmlUtils.getSAXTransformFactory(
|
||||
fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER));
|
||||
|
||||
identityTransformerHandler = tf.newTransformerHandler();
|
||||
} catch (TransformerConfigurationException e) {
|
||||
throw new TransformerFactoryConfigurationError(e);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -676,16 +676,14 @@ final class ValidatorHandlerImpl extends ValidatorHandler implements
|
||||
XMLReader reader = saxSource.getXMLReader();
|
||||
if( reader==null ) {
|
||||
// create one now
|
||||
SAXParserFactory spf = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
|
||||
SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
|
||||
spf.setNamespaceAware(true);
|
||||
reader = JdkXmlUtils.getXMLReader(fComponentManager.getFeature(JdkXmlUtils.OVERRIDE_PARSER),
|
||||
fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING));
|
||||
|
||||
try {
|
||||
spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
|
||||
fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING));
|
||||
reader = spf.newSAXParser().getXMLReader();
|
||||
// If this is a Xerces SAX parser, set the security manager if there is one
|
||||
if (reader instanceof com.sun.org.apache.xerces.internal.parsers.SAXParser) {
|
||||
XMLSecurityManager securityManager = (XMLSecurityManager) fComponentManager.getProperty(SECURITY_MANAGER);
|
||||
XMLSecurityManager securityManager =
|
||||
(XMLSecurityManager) fComponentManager.getProperty(SECURITY_MANAGER);
|
||||
if (securityManager != null) {
|
||||
try {
|
||||
reader.setProperty(SECURITY_MANAGER, securityManager);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user