Merge
This commit is contained in:
commit
794f1616f0
.hgtags.hgtags-top-repo
common
corba
hotspot
.hgtags
src
cpu
aarch64/vm
assembler_aarch64.hppglobalDefinitions_aarch64.hppmacroAssembler_aarch64.cppmacroAssembler_aarch64.hppstubGenerator_aarch64.cppvm_version_aarch64.cpp
ppc/vm
sparc/vm
x86/vm
zero/vm
os_cpu/solaris_sparc/vm
share
tools/hsdis
vm
c1
ci
classfile
interpreter
oops
opto
runtime
test/compiler
dependencies/MonomorphicObjectCall
intrinsics
jaxp
.hgtags
src/java.xml/share/classes
com/sun
org/apache
bcel/internal/util
xalan/internal
lib
utils
xsltc
xerces/internal
dom
impl
util
xinclude
xml/internal
dtm
resolver/readers
serialize
xpath/internal/compiler
xml/internal/stream/writers
javax/xml
stream
transform
validation
xpath
org/w3c/dom/bootstrap
jaxws
.hgtags
src
java.activation/share/classes/com/sun/activation/registries
java.xml.bind/share/classes/javax/xml/bind
jdk
2
.hgtags
2
.hgtags
@ -313,3 +313,5 @@ ff3fc75f3214ad7e03595be1b0d0f38d887b6f0e jdk9-b66
|
||||
5b500c93ce4822d47061cd518ff3f72d9d8cb5b5 jdk9-b68
|
||||
d69c968463f0ae5d0b45de3fc14fe65171b23948 jdk9-b69
|
||||
43d0179ee9de3bfffae3417f09e07eb6d8efc963 jdk9-b70
|
||||
f66c185284727f6e6ffd27e9c45ed2dd9da0a691 jdk9-b71
|
||||
61d2d0629b6dbf4c091dc86151ade1b3ef34fffe jdk9-b72
|
||||
|
@ -313,3 +313,5 @@ f546760134eb861fcfecd4ce611b0040b0d25a6a jdk9-b67
|
||||
70e4272790b6199e9ca89df2758ff9cb58ec4125 jdk9-b68
|
||||
1bcfd6b8726582cff5a42dbfc75903e36f9dd4fe jdk9-b69
|
||||
eed77fcd77711fcdba05f18fc22f37d86efb243c jdk9-b70
|
||||
c706ef5ea5da00078dc5e4334660315f7d99c15b jdk9-b71
|
||||
8582c35016fb6211b373810b6b172feccf9c483b jdk9-b72
|
||||
|
@ -4364,7 +4364,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1434614912
|
||||
DATE_WHEN_GENERATED=1435822080
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -42961,7 +42961,7 @@ $as_echo "$as_me: WARNING: X11 is not used, so --with-x is ignored" >&2;}
|
||||
if test "x$x_libraries" = xNONE; then
|
||||
if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/X11R6/lib"
|
||||
elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
x_libraries="$SYSROOT/usr/lib64"
|
||||
elif test -f "$SYSROOT/usr/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/lib"
|
||||
|
@ -113,7 +113,7 @@ AC_DEFUN_ONCE([LIB_SETUP_X11],
|
||||
if test "x$x_libraries" = xNONE; then
|
||||
if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/X11R6/lib"
|
||||
elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
x_libraries="$SYSROOT/usr/lib64"
|
||||
elif test -f "$SYSROOT/usr/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/lib"
|
||||
|
@ -1188,28 +1188,11 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
|
||||
OTHER_JDK="$OTHER/install/jdk"
|
||||
OTHER_JRE="$OTHER/install/jre"
|
||||
echo "Selecting install images for compare"
|
||||
elif [ -d "$THIS/deploy/jdk" -o -d "$THIS/deploy/images/jdk" ] \
|
||||
&& [ -d "$OTHER/deploy/jdk" -o -d "$OTHER/deploy/images/jdk" ]; then
|
||||
if [ -d "$THIS/deploy/images/jdk" ]; then
|
||||
THIS_JDK="$THIS/deploy/images/jdk"
|
||||
THIS_JRE="$THIS/deploy/images/jre"
|
||||
else
|
||||
THIS_JDK="$THIS/deploy/jdk"
|
||||
THIS_JRE="$THIS/deploy/jre"
|
||||
fi
|
||||
if [ -d "$OTHER/deploy/images/jdk" ]; then
|
||||
OTHER_JDK="$OTHER/deploy/images/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/images/jre"
|
||||
else
|
||||
OTHER_JDK="$OTHER/deploy/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/jre"
|
||||
fi
|
||||
echo "Selecting deploy images for compare"
|
||||
elif [ -d "$THIS/deploy/images/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
|
||||
THIS_JDK="$THIS/deploy/jdk"
|
||||
THIS_JRE="$THIS/deploy/jre"
|
||||
OTHER_JDK="$OTHER/deploy/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/jre"
|
||||
elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/deploy/images/jdk" ]; then
|
||||
THIS_JDK="$THIS/images/jdk"
|
||||
THIS_JRE="$THIS/images/jre"
|
||||
OTHER_JDK="$OTHER/deploy/images/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/images/jre"
|
||||
echo "Selecting deploy images for compare"
|
||||
elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
|
||||
THIS_JDK="$THIS/images/jdk"
|
||||
@ -1221,30 +1204,28 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
|
||||
echo "No common images found."
|
||||
exit 1
|
||||
fi
|
||||
echo " $THIS_JDK"
|
||||
echo " $OTHER_JDK"
|
||||
|
||||
if [ -d "$THIS/deploy/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \
|
||||
&& [ -d "$OTHER/deploy/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then
|
||||
if [ -d "$THIS/images/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \
|
||||
&& [ -d "$OTHER/images/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then
|
||||
if [ -d "$THIS/deploy/images/jdk-bundle" ]; then
|
||||
THIS_JDK_BUNDLE="$THIS/deploy/images/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/deploy/images/jre-bundle"
|
||||
else
|
||||
THIS_JDK_BUNDLE="$THIS/deploy/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/deploy/jre-bundle"
|
||||
THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
|
||||
fi
|
||||
if [ -d "$OTHER/deploy/images/jdk-bundle" ]; then
|
||||
OTHER_JDK_BUNDLE="$OTHER/deploy/images/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/deploy/images/jre-bundle"
|
||||
else
|
||||
OTHER_JDK_BUNDLE="$OTHER/deploy/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/deploy/jre-bundle"
|
||||
OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
|
||||
fi
|
||||
echo "Also comparing deploy macosx bundles"
|
||||
elif [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
|
||||
THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
|
||||
OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
|
||||
echo "Also comparing macosx bundles"
|
||||
echo " $THIS_JDK_BUNDLE"
|
||||
echo " $OTHER_JDK_BUNDLE"
|
||||
fi
|
||||
|
||||
if [ -d "$THIS/deploy/bundles" -o -d "$THIS/deploy/images/bundles" ] \
|
||||
@ -1262,19 +1243,21 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
|
||||
echo "Also comparing deploy javadoc bundles"
|
||||
fi
|
||||
|
||||
if [ -d "$THIS/deploy/JavaAppletPlugin.plugin" -o -d "$THIS/deploy/images/JavaAppletPlugin.plugin" ] \
|
||||
&& [ -d "$OTHER/deploy/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then
|
||||
if [ -d "$THIS/deploy/images/bundles" ]; then
|
||||
if [ -d "$THIS/images/JavaAppletPlugin.plugin" ] \
|
||||
&& [ -d "$OTHER/images/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then
|
||||
if [ -d "$THIS/images/JavaAppletPlugin.plugin" ]; then
|
||||
THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/images/JavaAppletPlugin.plugin"
|
||||
else
|
||||
THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin"
|
||||
else
|
||||
THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin"
|
||||
fi
|
||||
if [ -d "$OTHER/deploy/images/bundles" ]; then
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin"
|
||||
if [ -d "$OTHER/images/JavaAppletPlugin.plugin" ]; then
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/images/JavaAppletPlugin.plugin"
|
||||
else
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin"
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin"
|
||||
fi
|
||||
echo "Also comparing deploy applet image"
|
||||
echo " $THIS_DEPLOY_APPLET_PLUGIN_DIR"
|
||||
echo " $OTHER_DEPLOY_APPLET_PLUGIN_DIR"
|
||||
fi
|
||||
|
||||
if [ -d "$OTHER/images" ]; then
|
||||
|
@ -313,3 +313,5 @@ afc1e295c4bf83f9a5dd539c29914edd4a754a3f jdk9-b65
|
||||
8efad64f40eb8cd4df376c0a5275892eeb396bbd jdk9-b68
|
||||
de8acedcb5b5870f1dc54cba575aaa5d33897ea2 jdk9-b69
|
||||
e7cf01990ed366bd493080663259281e91ce223b jdk9-b70
|
||||
cd39ed501fb0504554a7f58ac6cf3dd2b64afec0 jdk9-b71
|
||||
f9f3706bd24c42c07cb260fe05730a749b8e52f4 jdk9-b72
|
||||
|
@ -65,7 +65,7 @@ import org.omg.CORBA.ValueMember;
|
||||
import sun.corba.Bridge;
|
||||
|
||||
/**
|
||||
* A ObjectStreamClass describes a class that can be serialized to a stream
|
||||
* An ObjectStreamClass describes a class that can be serialized to a stream
|
||||
* or a class that was serialized to a stream. It contains the name
|
||||
* and the serialVersionUID of the class.
|
||||
* <br>
|
||||
@ -788,9 +788,9 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
/* Compare the base class names of streamName and localName.
|
||||
*
|
||||
* @return Return true iff the base class name compare.
|
||||
* @parameter streamName Fully qualified class name.
|
||||
* @parameter localName Fully qualified class name.
|
||||
* @parameter pkgSeparator class names use either '.' or '/'.
|
||||
* @param streamName Fully qualified class name.
|
||||
* @param localName Fully qualified class name.
|
||||
* @param pkgSeparator class names use either '.' or '/'.
|
||||
*
|
||||
* Only compare base class name to allow package renaming.
|
||||
*/
|
||||
|
@ -656,9 +656,9 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
|
||||
/* Compare the base class names of streamName and localName.
|
||||
*
|
||||
* @return Return true iff the base class name compare.
|
||||
* @parameter streamName Fully qualified class name.
|
||||
* @parameter localName Fully qualified class name.
|
||||
* @parameter pkgSeparator class names use either '.' or '/'.
|
||||
* @param streamName Fully qualified class name.
|
||||
* @param localName Fully qualified class name.
|
||||
* @param pkgSeparator class names use either '.' or '/'.
|
||||
*
|
||||
* Only compare base class name to allow package renaming.
|
||||
*/
|
||||
|
@ -27,10 +27,10 @@ package org.omg.CORBA;
|
||||
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of <tt>Bounds</tt>.
|
||||
* This Helper class is used to facilitate the marshalling of {@code Bounds}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class BoundsHelper
|
||||
|
@ -28,10 +28,10 @@ package org.omg.CORBA.ORBPackage;
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of
|
||||
* <tt>ORBPackage/InvalidName</tt>.
|
||||
* {@code ORBPackage/InvalidName}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class InvalidNameHelper
|
||||
|
@ -28,10 +28,10 @@ package org.omg.CORBA.TypeCodePackage;
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of
|
||||
* <tt>TypeCodePackage/BadKind</tt>.
|
||||
* {@code TypeCodePackage/BadKind}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class BadKindHelper
|
||||
|
@ -28,10 +28,10 @@ package org.omg.CORBA.TypeCodePackage;
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of
|
||||
* <tt>TypeCodePackage/Bounds</tt>.
|
||||
* {@code TypeCodePackage/Bounds}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class BoundsHelper
|
||||
|
@ -473,3 +473,5 @@ d47dfabd16d48eb96a451edd1b61194a39ee0eb5 jdk9-b67
|
||||
11af3990d56c97b40318bc1f20608e86f051a3f7 jdk9-b68
|
||||
ff0929a59ced0e144201aa05819ae2e47d6f2c61 jdk9-b69
|
||||
8672e9264db30c21504063932dbc374eabc287a1 jdk9-b70
|
||||
07c6b035d68b0c41b1dcd442157b50b41a2551e9 jdk9-b71
|
||||
c1b2825ef47e75cb34dd18450d1c4280b7c5853c jdk9-b72
|
||||
|
@ -2270,17 +2270,21 @@ public:
|
||||
}
|
||||
|
||||
// CRC32 instructions
|
||||
#define INSN(NAME, sf, sz) \
|
||||
#define INSN(NAME, c, sf, sz) \
|
||||
void NAME(Register Rd, Register Rn, Register Rm) { \
|
||||
starti; \
|
||||
f(sf, 31), f(0b0011010110, 30, 21), f(0b0100, 15, 12), f(sz, 11, 10); \
|
||||
rf(Rm, 16), rf(Rn, 5), rf(Rd, 0); \
|
||||
f(sf, 31), f(0b0011010110, 30, 21), f(0b010, 15, 13), f(c, 12); \
|
||||
f(sz, 11, 10), rf(Rm, 16), rf(Rn, 5), rf(Rd, 0); \
|
||||
}
|
||||
|
||||
INSN(crc32b, 0, 0b00);
|
||||
INSN(crc32h, 0, 0b01);
|
||||
INSN(crc32w, 0, 0b10);
|
||||
INSN(crc32x, 1, 0b11);
|
||||
INSN(crc32b, 0, 0, 0b00);
|
||||
INSN(crc32h, 0, 0, 0b01);
|
||||
INSN(crc32w, 0, 0, 0b10);
|
||||
INSN(crc32x, 0, 1, 0b11);
|
||||
INSN(crc32cb, 1, 0, 0b00);
|
||||
INSN(crc32ch, 1, 0, 0b01);
|
||||
INSN(crc32cw, 1, 0, 0b10);
|
||||
INSN(crc32cx, 1, 1, 0b11);
|
||||
|
||||
#undef INSN
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2015, Red Hat Inc. 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
|
||||
@ -28,12 +28,6 @@
|
||||
|
||||
const int StackAlignmentInBytes = 16;
|
||||
|
||||
// Indicates whether the C calling conventions require that
|
||||
// 32-bit integer argument values are properly extended to 64 bits.
|
||||
// If set, SharedRuntime::c_calling_convention() must adapt
|
||||
// signatures accordingly.
|
||||
const bool CCallingConventionRequiresIntsAsLongs = true;
|
||||
|
||||
#define SUPPORTS_NATIVE_CX8
|
||||
|
||||
// The maximum B/BL offset range on AArch64 is 128MB.
|
||||
|
@ -2914,6 +2914,65 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len,
|
||||
ornw(crc, zr, crc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param crc register containing existing CRC (32-bit)
|
||||
* @param buf register pointing to input byte buffer (byte*)
|
||||
* @param len register containing number of bytes
|
||||
* @param table register that will contain address of CRC table
|
||||
* @param tmp scratch register
|
||||
*/
|
||||
void MacroAssembler::kernel_crc32c(Register crc, Register buf, Register len,
|
||||
Register table0, Register table1, Register table2, Register table3,
|
||||
Register tmp, Register tmp2, Register tmp3) {
|
||||
Label L_exit;
|
||||
Label CRC_by64_loop, CRC_by4_loop, CRC_by1_loop;
|
||||
|
||||
subs(len, len, 64);
|
||||
br(Assembler::GE, CRC_by64_loop);
|
||||
adds(len, len, 64-4);
|
||||
br(Assembler::GE, CRC_by4_loop);
|
||||
adds(len, len, 4);
|
||||
br(Assembler::GT, CRC_by1_loop);
|
||||
b(L_exit);
|
||||
|
||||
BIND(CRC_by4_loop);
|
||||
ldrw(tmp, Address(post(buf, 4)));
|
||||
subs(len, len, 4);
|
||||
crc32cw(crc, crc, tmp);
|
||||
br(Assembler::GE, CRC_by4_loop);
|
||||
adds(len, len, 4);
|
||||
br(Assembler::LE, L_exit);
|
||||
BIND(CRC_by1_loop);
|
||||
ldrb(tmp, Address(post(buf, 1)));
|
||||
subs(len, len, 1);
|
||||
crc32cb(crc, crc, tmp);
|
||||
br(Assembler::GT, CRC_by1_loop);
|
||||
b(L_exit);
|
||||
|
||||
align(CodeEntryAlignment);
|
||||
BIND(CRC_by64_loop);
|
||||
subs(len, len, 64);
|
||||
ldp(tmp, tmp3, Address(post(buf, 16)));
|
||||
crc32cx(crc, crc, tmp);
|
||||
crc32cx(crc, crc, tmp3);
|
||||
ldp(tmp, tmp3, Address(post(buf, 16)));
|
||||
crc32cx(crc, crc, tmp);
|
||||
crc32cx(crc, crc, tmp3);
|
||||
ldp(tmp, tmp3, Address(post(buf, 16)));
|
||||
crc32cx(crc, crc, tmp);
|
||||
crc32cx(crc, crc, tmp3);
|
||||
ldp(tmp, tmp3, Address(post(buf, 16)));
|
||||
crc32cx(crc, crc, tmp);
|
||||
crc32cx(crc, crc, tmp3);
|
||||
br(Assembler::GE, CRC_by64_loop);
|
||||
adds(len, len, 64-4);
|
||||
br(Assembler::GE, CRC_by4_loop);
|
||||
adds(len, len, 4);
|
||||
br(Assembler::GT, CRC_by1_loop);
|
||||
BIND(L_exit);
|
||||
return;
|
||||
}
|
||||
|
||||
SkipIfEqual::SkipIfEqual(
|
||||
MacroAssembler* masm, const bool* flag_addr, bool value) {
|
||||
_masm = masm;
|
||||
|
@ -967,6 +967,10 @@ public:
|
||||
void kernel_crc32(Register crc, Register buf, Register len,
|
||||
Register table0, Register table1, Register table2, Register table3,
|
||||
Register tmp, Register tmp2, Register tmp3);
|
||||
// CRC32 code for java.util.zip.CRC32C::updateBytes() instrinsic.
|
||||
void kernel_crc32c(Register crc, Register buf, Register len,
|
||||
Register table0, Register table1, Register table2, Register table3,
|
||||
Register tmp, Register tmp2, Register tmp3);
|
||||
|
||||
#undef VIRTUAL
|
||||
|
||||
|
@ -2356,6 +2356,47 @@ class StubGenerator: public StubCodeGenerator {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments:
|
||||
*
|
||||
* Inputs:
|
||||
* c_rarg0 - int crc
|
||||
* c_rarg1 - byte* buf
|
||||
* c_rarg2 - int length
|
||||
* c_rarg3 - int* table
|
||||
*
|
||||
* Ouput:
|
||||
* rax - int crc result
|
||||
*/
|
||||
address generate_updateBytesCRC32C() {
|
||||
assert(UseCRC32CIntrinsics, "what are we doing here?");
|
||||
|
||||
__ align(CodeEntryAlignment);
|
||||
StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32C");
|
||||
|
||||
address start = __ pc();
|
||||
|
||||
const Register crc = c_rarg0; // crc
|
||||
const Register buf = c_rarg1; // source java byte array address
|
||||
const Register len = c_rarg2; // length
|
||||
const Register table0 = c_rarg3; // crc_table address
|
||||
const Register table1 = c_rarg4;
|
||||
const Register table2 = c_rarg5;
|
||||
const Register table3 = c_rarg6;
|
||||
const Register tmp3 = c_rarg7;
|
||||
|
||||
BLOCK_COMMENT("Entry:");
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
__ kernel_crc32c(crc, buf, len,
|
||||
table0, table1, table2, table3, rscratch1, rscratch2, tmp3);
|
||||
|
||||
__ leave(); // required for proper stackwalking of RuntimeStub frame
|
||||
__ ret(lr);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments:
|
||||
*
|
||||
@ -2579,6 +2620,10 @@ class StubGenerator: public StubCodeGenerator {
|
||||
StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB");
|
||||
}
|
||||
|
||||
if (UseCRC32CIntrinsics) {
|
||||
StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C();
|
||||
}
|
||||
|
||||
// Safefetch stubs.
|
||||
generate_safefetch("SafeFetch32", sizeof(int), &StubRoutines::_safefetch32_entry,
|
||||
&StubRoutines::_safefetch32_fault_pc,
|
||||
|
@ -199,9 +199,12 @@ void VM_Version::get_processor_features() {
|
||||
UseCRC32Intrinsics = true;
|
||||
}
|
||||
|
||||
if (UseCRC32CIntrinsics) {
|
||||
if (!FLAG_IS_DEFAULT(UseCRC32CIntrinsics))
|
||||
warning("CRC32C intrinsics are not available on this CPU");
|
||||
if (auxv & HWCAP_CRC32) {
|
||||
if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, true);
|
||||
}
|
||||
} else if (UseCRC32CIntrinsics) {
|
||||
warning("CRC32C is not available on the CPU");
|
||||
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
|
||||
}
|
||||
|
||||
@ -214,34 +217,31 @@ void VM_Version::get_processor_features() {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
||||
if (!UseSHA) {
|
||||
if (UseSHA && (auxv & HWCAP_SHA1)) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA1Intrinsics) {
|
||||
warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA && (auxv & HWCAP_SHA2)) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA256Intrinsics) {
|
||||
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA512Intrinsics) {
|
||||
warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
} else {
|
||||
if (auxv & HWCAP_SHA1) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA1Intrinsics) {
|
||||
warning("SHA1 instruction is not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
|
||||
}
|
||||
if (auxv & HWCAP_SHA2) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA256Intrinsics) {
|
||||
warning("SHA256 instruction (for SHA-224 and SHA-256) is not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
}
|
||||
if (UseSHA512Intrinsics) {
|
||||
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
||||
// This machine allows unaligned memory accesses
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2012, 2013 SAP AG. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2012, 2015 SAP AG. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,12 +31,6 @@ const int BytesPerInstWord = 4;
|
||||
|
||||
const int StackAlignmentInBytes = 16;
|
||||
|
||||
// Indicates whether the C calling conventions require that
|
||||
// 32-bit integer argument values are properly extended to 64 bits.
|
||||
// If set, SharedRuntime::c_calling_convention() must adapt
|
||||
// signatures accordingly.
|
||||
const bool CCallingConventionRequiresIntsAsLongs = true;
|
||||
|
||||
#define SUPPORTS_NATIVE_CX8
|
||||
|
||||
// The PPC CPUs are NOT multiple-copy-atomic.
|
||||
|
@ -731,23 +731,8 @@ int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
|
||||
case T_SHORT:
|
||||
case T_INT:
|
||||
// We must cast ints to longs and use full 64 bit stack slots
|
||||
// here. We do the cast in GraphKit::gen_stub() and just guard
|
||||
// here against loosing that change.
|
||||
assert(CCallingConventionRequiresIntsAsLongs,
|
||||
"argument of type int should be promoted to type long");
|
||||
guarantee(i > 0 && sig_bt[i-1] == T_LONG,
|
||||
"argument of type (bt) should have been promoted to type (T_LONG,bt) for bt in "
|
||||
"{T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}");
|
||||
// Do not count halves.
|
||||
regs[i].set_bad();
|
||||
--arg;
|
||||
break;
|
||||
// here. Thus fall through, handle as long.
|
||||
case T_LONG:
|
||||
guarantee(sig_bt[i+1] == T_VOID ||
|
||||
sig_bt[i+1] == T_BOOLEAN || sig_bt[i+1] == T_CHAR ||
|
||||
sig_bt[i+1] == T_BYTE || sig_bt[i+1] == T_SHORT ||
|
||||
sig_bt[i+1] == T_INT,
|
||||
"expecting type (T_LONG,half) or type (T_LONG,bt) with bt in {T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}");
|
||||
case T_OBJECT:
|
||||
case T_ARRAY:
|
||||
case T_ADDRESS:
|
||||
@ -1273,7 +1258,7 @@ static void object_move(MacroAssembler* masm,
|
||||
static void int_move(MacroAssembler*masm,
|
||||
VMRegPair src, VMRegPair dst,
|
||||
Register r_caller_sp, Register r_temp) {
|
||||
assert(src.first()->is_valid() && src.second() == src.first()->next(), "incoming must be long-int");
|
||||
assert(src.first()->is_valid(), "incoming must be int");
|
||||
assert(dst.first()->is_valid() && dst.second() == dst.first()->next(), "outgoing must be long");
|
||||
|
||||
if (src.first()->is_stack()) {
|
||||
@ -1762,13 +1747,6 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
// the jni function will expect them. To figure out where they go
|
||||
// we convert the java signature to a C signature by inserting
|
||||
// the hidden arguments as arg[0] and possibly arg[1] (static method)
|
||||
//
|
||||
// Additionally, on ppc64 we must convert integers to longs in the C
|
||||
// signature. We do this in advance in order to have no trouble with
|
||||
// indexes into the bt-arrays.
|
||||
// So convert the signature and registers now, and adjust the total number
|
||||
// of in-arguments accordingly.
|
||||
int i2l_argcnt = convert_ints_to_longints_argcnt(total_in_args, in_sig_bt); // PPC64: pass ints as longs.
|
||||
|
||||
// Calculate the total number of C arguments and create arrays for the
|
||||
// signature and the outgoing registers.
|
||||
@ -1776,7 +1754,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
// some floating-point arguments must be passed in registers _and_
|
||||
// in stack locations.
|
||||
bool method_is_static = method->is_static();
|
||||
int total_c_args = i2l_argcnt;
|
||||
int total_c_args = total_in_args;
|
||||
|
||||
if (!is_critical_native) {
|
||||
int n_hidden_args = method_is_static ? 2 : 1;
|
||||
@ -1785,7 +1763,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
// No JNIEnv*, no this*, but unpacked arrays (base+length).
|
||||
for (int i = 0; i < total_in_args; i++) {
|
||||
if (in_sig_bt[i] == T_ARRAY) {
|
||||
total_c_args += 2; // PPC64: T_LONG, T_INT, T_ADDRESS (see convert_ints_to_longints and c_calling_convention)
|
||||
total_c_args++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1803,8 +1781,6 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
|
||||
int argc = 0;
|
||||
if (!is_critical_native) {
|
||||
convert_ints_to_longints(i2l_argcnt, total_in_args, in_sig_bt, in_regs); // PPC64: pass ints as longs.
|
||||
|
||||
out_sig_bt[argc++] = T_ADDRESS;
|
||||
if (method->is_static()) {
|
||||
out_sig_bt[argc++] = T_OBJECT;
|
||||
@ -1815,7 +1791,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
}
|
||||
} else {
|
||||
Thread* THREAD = Thread::current();
|
||||
in_elem_bt = NEW_RESOURCE_ARRAY(BasicType, i2l_argcnt);
|
||||
in_elem_bt = NEW_RESOURCE_ARRAY(BasicType, total_c_args);
|
||||
SignatureStream ss(method->signature());
|
||||
int o = 0;
|
||||
for (int i = 0; i < total_in_args ; i++, o++) {
|
||||
@ -1839,28 +1815,16 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
}
|
||||
} else {
|
||||
in_elem_bt[o] = T_VOID;
|
||||
switch(in_sig_bt[i]) { // PPC64: pass ints as longs.
|
||||
case T_BOOLEAN:
|
||||
case T_CHAR:
|
||||
case T_BYTE:
|
||||
case T_SHORT:
|
||||
case T_INT: in_elem_bt[++o] = T_VOID; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (in_sig_bt[i] != T_VOID) {
|
||||
assert(in_sig_bt[i] == ss.type(), "must match");
|
||||
ss.next();
|
||||
}
|
||||
}
|
||||
assert(i2l_argcnt==o, "must match");
|
||||
|
||||
convert_ints_to_longints(i2l_argcnt, total_in_args, in_sig_bt, in_regs); // PPC64: pass ints as longs.
|
||||
|
||||
for (int i = 0; i < total_in_args ; i++ ) {
|
||||
if (in_sig_bt[i] == T_ARRAY) {
|
||||
// Arrays are passed as int, elem* pair.
|
||||
out_sig_bt[argc++] = T_LONG; // PPC64: pass ints as longs.
|
||||
out_sig_bt[argc++] = T_INT;
|
||||
out_sig_bt[argc++] = T_ADDRESS;
|
||||
} else {
|
||||
@ -1921,7 +1885,8 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
case T_BYTE:
|
||||
case T_SHORT:
|
||||
case T_CHAR:
|
||||
case T_INT: /*single_slots++;*/ break; // PPC64: pass ints as longs.
|
||||
case T_INT:
|
||||
// Fall through.
|
||||
case T_ARRAY:
|
||||
case T_LONG: double_slots++; break;
|
||||
default: ShouldNotReachHere();
|
||||
@ -2019,7 +1984,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
|
||||
__ save_LR_CR(r_temp_1);
|
||||
__ generate_stack_overflow_check(frame_size_in_bytes); // Check before creating frame.
|
||||
__ mr(r_callers_sp, R1_SP); // Remember frame pointer.
|
||||
__ mr(r_callers_sp, R1_SP); // Remember frame pointer.
|
||||
__ push_frame(frame_size_in_bytes, r_temp_1); // Push the c2n adapter's frame.
|
||||
frame_done_pc = (intptr_t)__ pc();
|
||||
|
||||
@ -2098,24 +2063,16 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
case T_BYTE:
|
||||
case T_SHORT:
|
||||
case T_INT:
|
||||
guarantee(in > 0 && in_sig_bt[in-1] == T_LONG,
|
||||
"expecting type (T_LONG,bt) for bt in {T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}");
|
||||
// Move int and do sign extension.
|
||||
int_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1);
|
||||
break;
|
||||
case T_LONG:
|
||||
if (in_sig_bt[in+1] == T_VOID) {
|
||||
long_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1);
|
||||
} else {
|
||||
guarantee(in_sig_bt[in+1] == T_BOOLEAN || in_sig_bt[in+1] == T_CHAR ||
|
||||
in_sig_bt[in+1] == T_BYTE || in_sig_bt[in+1] == T_SHORT ||
|
||||
in_sig_bt[in+1] == T_INT,
|
||||
"expecting type (T_LONG,bt) for bt in {T_BOOLEAN, T_CHAR, T_BYTE, T_SHORT, T_INT}");
|
||||
int_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1);
|
||||
}
|
||||
long_move(masm, in_regs[in], out_regs[out], r_callers_sp, r_temp_1);
|
||||
break;
|
||||
case T_ARRAY:
|
||||
if (is_critical_native) {
|
||||
int body_arg = out;
|
||||
out -= 2; // Point to length arg. PPC64: pass ints as longs.
|
||||
out -= 1; // Point to length arg.
|
||||
unpack_array_argument(masm, in_regs[in], in_elem_bt[in], out_regs[body_arg], out_regs[out],
|
||||
r_callers_sp, r_temp_1, r_temp_2);
|
||||
break;
|
||||
@ -2187,7 +2144,6 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
|
||||
// Make sure that thread is non-volatile; it crosses a bunch of VM calls below.
|
||||
assert(R16_thread->is_nonvolatile(), "thread must be in non-volatile register");
|
||||
|
||||
|
||||
# if 0
|
||||
// DTrace method entry
|
||||
# endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,12 +30,6 @@ const int BytesPerInstWord = 4;
|
||||
|
||||
const int StackAlignmentInBytes = (2*wordSize);
|
||||
|
||||
// Indicates whether the C calling conventions require that
|
||||
// 32-bit integer argument values are properly extended to 64 bits.
|
||||
// If set, SharedRuntime::c_calling_convention() must adapt
|
||||
// signatures accordingly.
|
||||
const bool CCallingConventionRequiresIntsAsLongs = false;
|
||||
|
||||
#define SUPPORTS_NATIVE_CX8
|
||||
|
||||
// The expected size in bytes of a cache line, used to pad data structures.
|
||||
|
@ -329,39 +329,35 @@ void VM_Version::initialize() {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
||||
if (!UseSHA) {
|
||||
if (UseSHA && has_sha1()) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA1Intrinsics) {
|
||||
warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
} else {
|
||||
if (has_sha1()) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA1Intrinsics) {
|
||||
warning("SHA1 instruction is not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
|
||||
}
|
||||
if (has_sha256()) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA256Intrinsics) {
|
||||
warning("SHA256 instruction (for SHA-224 and SHA-256) is not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (has_sha512()) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA512Intrinsics) {
|
||||
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
if (UseSHA && has_sha256()) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
|
||||
}
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
} else if (UseSHA256Intrinsics) {
|
||||
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA && has_sha512()) {
|
||||
if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
|
||||
}
|
||||
} else if (UseSHA512Intrinsics) {
|
||||
warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
|
||||
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
|
||||
// SPARC T4 and above should have support for CRC32C instruction
|
||||
|
@ -27,12 +27,6 @@
|
||||
|
||||
const int StackAlignmentInBytes = 16;
|
||||
|
||||
// Indicates whether the C calling conventions require that
|
||||
// 32-bit integer argument values are properly extended to 64 bits.
|
||||
// If set, SharedRuntime::c_calling_convention() must adapt
|
||||
// signatures accordingly.
|
||||
const bool CCallingConventionRequiresIntsAsLongs = false;
|
||||
|
||||
#define SUPPORTS_NATIVE_CX8
|
||||
|
||||
// The expected size in bytes of a cache line, used to pad data structures.
|
||||
|
@ -23,6 +23,9 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#ifndef _WINDOWS
|
||||
#include "alloca.h"
|
||||
#endif
|
||||
#include "asm/macroAssembler.hpp"
|
||||
#include "asm/macroAssembler.inline.hpp"
|
||||
#include "code/debugInfoRec.hpp"
|
||||
@ -3511,6 +3514,250 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
}
|
||||
|
||||
|
||||
//------------------------------Montgomery multiplication------------------------
|
||||
//
|
||||
|
||||
#ifndef _WINDOWS
|
||||
|
||||
#define ASM_SUBTRACT
|
||||
|
||||
#ifdef ASM_SUBTRACT
|
||||
// Subtract 0:b from carry:a. Return carry.
|
||||
static unsigned long
|
||||
sub(unsigned long a[], unsigned long b[], unsigned long carry, long len) {
|
||||
long i = 0, cnt = len;
|
||||
unsigned long tmp;
|
||||
asm volatile("clc; "
|
||||
"0: ; "
|
||||
"mov (%[b], %[i], 8), %[tmp]; "
|
||||
"sbb %[tmp], (%[a], %[i], 8); "
|
||||
"inc %[i]; dec %[cnt]; "
|
||||
"jne 0b; "
|
||||
"mov %[carry], %[tmp]; sbb $0, %[tmp]; "
|
||||
: [i]"+r"(i), [cnt]"+r"(cnt), [tmp]"=&r"(tmp)
|
||||
: [a]"r"(a), [b]"r"(b), [carry]"r"(carry)
|
||||
: "memory");
|
||||
return tmp;
|
||||
}
|
||||
#else // ASM_SUBTRACT
|
||||
typedef int __attribute__((mode(TI))) int128;
|
||||
|
||||
// Subtract 0:b from carry:a. Return carry.
|
||||
static unsigned long
|
||||
sub(unsigned long a[], unsigned long b[], unsigned long carry, int len) {
|
||||
int128 tmp = 0;
|
||||
int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
tmp += a[i];
|
||||
tmp -= b[i];
|
||||
a[i] = tmp;
|
||||
tmp >>= 64;
|
||||
assert(-1 <= tmp && tmp <= 0, "invariant");
|
||||
}
|
||||
return tmp + carry;
|
||||
}
|
||||
#endif // ! ASM_SUBTRACT
|
||||
|
||||
// Multiply (unsigned) Long A by Long B, accumulating the double-
|
||||
// length result into the accumulator formed of T0, T1, and T2.
|
||||
#define MACC(A, B, T0, T1, T2) \
|
||||
do { \
|
||||
unsigned long hi, lo; \
|
||||
__asm__ ("mul %5; add %%rax, %2; adc %%rdx, %3; adc $0, %4" \
|
||||
: "=&d"(hi), "=a"(lo), "+r"(T0), "+r"(T1), "+g"(T2) \
|
||||
: "r"(A), "a"(B) : "cc"); \
|
||||
} while(0)
|
||||
|
||||
// As above, but add twice the double-length result into the
|
||||
// accumulator.
|
||||
#define MACC2(A, B, T0, T1, T2) \
|
||||
do { \
|
||||
unsigned long hi, lo; \
|
||||
__asm__ ("mul %5; add %%rax, %2; adc %%rdx, %3; adc $0, %4; " \
|
||||
"add %%rax, %2; adc %%rdx, %3; adc $0, %4" \
|
||||
: "=&d"(hi), "=a"(lo), "+r"(T0), "+r"(T1), "+g"(T2) \
|
||||
: "r"(A), "a"(B) : "cc"); \
|
||||
} while(0)
|
||||
|
||||
// Fast Montgomery multiplication. The derivation of the algorithm is
|
||||
// in A Cryptographic Library for the Motorola DSP56000,
|
||||
// Dusse and Kaliski, Proc. EUROCRYPT 90, pp. 230-237.
|
||||
|
||||
static void __attribute__((noinline))
|
||||
montgomery_multiply(unsigned long a[], unsigned long b[], unsigned long n[],
|
||||
unsigned long m[], unsigned long inv, int len) {
|
||||
unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
|
||||
int i;
|
||||
|
||||
assert(inv * n[0] == -1UL, "broken inverse in Montgomery multiply");
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
int j;
|
||||
for (j = 0; j < i; j++) {
|
||||
MACC(a[j], b[i-j], t0, t1, t2);
|
||||
MACC(m[j], n[i-j], t0, t1, t2);
|
||||
}
|
||||
MACC(a[i], b[0], t0, t1, t2);
|
||||
m[i] = t0 * inv;
|
||||
MACC(m[i], n[0], t0, t1, t2);
|
||||
|
||||
assert(t0 == 0, "broken Montgomery multiply");
|
||||
|
||||
t0 = t1; t1 = t2; t2 = 0;
|
||||
}
|
||||
|
||||
for (i = len; i < 2*len; i++) {
|
||||
int j;
|
||||
for (j = i-len+1; j < len; j++) {
|
||||
MACC(a[j], b[i-j], t0, t1, t2);
|
||||
MACC(m[j], n[i-j], t0, t1, t2);
|
||||
}
|
||||
m[i-len] = t0;
|
||||
t0 = t1; t1 = t2; t2 = 0;
|
||||
}
|
||||
|
||||
while (t0)
|
||||
t0 = sub(m, n, t0, len);
|
||||
}
|
||||
|
||||
// Fast Montgomery squaring. This uses asymptotically 25% fewer
|
||||
// multiplies so it should be up to 25% faster than Montgomery
|
||||
// multiplication. However, its loop control is more complex and it
|
||||
// may actually run slower on some machines.
|
||||
|
||||
static void __attribute__((noinline))
|
||||
montgomery_square(unsigned long a[], unsigned long n[],
|
||||
unsigned long m[], unsigned long inv, int len) {
|
||||
unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
|
||||
int i;
|
||||
|
||||
assert(inv * n[0] == -1UL, "broken inverse in Montgomery multiply");
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
int j;
|
||||
int end = (i+1)/2;
|
||||
for (j = 0; j < end; j++) {
|
||||
MACC2(a[j], a[i-j], t0, t1, t2);
|
||||
MACC(m[j], n[i-j], t0, t1, t2);
|
||||
}
|
||||
if ((i & 1) == 0) {
|
||||
MACC(a[j], a[j], t0, t1, t2);
|
||||
}
|
||||
for (; j < i; j++) {
|
||||
MACC(m[j], n[i-j], t0, t1, t2);
|
||||
}
|
||||
m[i] = t0 * inv;
|
||||
MACC(m[i], n[0], t0, t1, t2);
|
||||
|
||||
assert(t0 == 0, "broken Montgomery square");
|
||||
|
||||
t0 = t1; t1 = t2; t2 = 0;
|
||||
}
|
||||
|
||||
for (i = len; i < 2*len; i++) {
|
||||
int start = i-len+1;
|
||||
int end = start + (len - start)/2;
|
||||
int j;
|
||||
for (j = start; j < end; j++) {
|
||||
MACC2(a[j], a[i-j], t0, t1, t2);
|
||||
MACC(m[j], n[i-j], t0, t1, t2);
|
||||
}
|
||||
if ((i & 1) == 0) {
|
||||
MACC(a[j], a[j], t0, t1, t2);
|
||||
}
|
||||
for (; j < len; j++) {
|
||||
MACC(m[j], n[i-j], t0, t1, t2);
|
||||
}
|
||||
m[i-len] = t0;
|
||||
t0 = t1; t1 = t2; t2 = 0;
|
||||
}
|
||||
|
||||
while (t0)
|
||||
t0 = sub(m, n, t0, len);
|
||||
}
|
||||
|
||||
// Swap words in a longword.
|
||||
static unsigned long swap(unsigned long x) {
|
||||
return (x << 32) | (x >> 32);
|
||||
}
|
||||
|
||||
// Copy len longwords from s to d, word-swapping as we go. The
|
||||
// destination array is reversed.
|
||||
static void reverse_words(unsigned long *s, unsigned long *d, int len) {
|
||||
d += len;
|
||||
while(len-- > 0) {
|
||||
d--;
|
||||
*d = swap(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
// The threshold at which squaring is advantageous was determined
|
||||
// experimentally on an i7-3930K (Ivy Bridge) CPU @ 3.5GHz.
|
||||
#define MONTGOMERY_SQUARING_THRESHOLD 64
|
||||
|
||||
void SharedRuntime::montgomery_multiply(jint *a_ints, jint *b_ints, jint *n_ints,
|
||||
jint len, jlong inv,
|
||||
jint *m_ints) {
|
||||
assert(len % 2 == 0, "array length in montgomery_multiply must be even");
|
||||
int longwords = len/2;
|
||||
|
||||
// Make very sure we don't use so much space that the stack might
|
||||
// overflow. 512 jints corresponds to an 16384-bit integer and
|
||||
// will use here a total of 8k bytes of stack space.
|
||||
int total_allocation = longwords * sizeof (unsigned long) * 4;
|
||||
guarantee(total_allocation <= 8192, "must be");
|
||||
unsigned long *scratch = (unsigned long *)alloca(total_allocation);
|
||||
|
||||
// Local scratch arrays
|
||||
unsigned long
|
||||
*a = scratch + 0 * longwords,
|
||||
*b = scratch + 1 * longwords,
|
||||
*n = scratch + 2 * longwords,
|
||||
*m = scratch + 3 * longwords;
|
||||
|
||||
reverse_words((unsigned long *)a_ints, a, longwords);
|
||||
reverse_words((unsigned long *)b_ints, b, longwords);
|
||||
reverse_words((unsigned long *)n_ints, n, longwords);
|
||||
|
||||
::montgomery_multiply(a, b, n, m, (unsigned long)inv, longwords);
|
||||
|
||||
reverse_words(m, (unsigned long *)m_ints, longwords);
|
||||
}
|
||||
|
||||
void SharedRuntime::montgomery_square(jint *a_ints, jint *n_ints,
|
||||
jint len, jlong inv,
|
||||
jint *m_ints) {
|
||||
assert(len % 2 == 0, "array length in montgomery_square must be even");
|
||||
int longwords = len/2;
|
||||
|
||||
// Make very sure we don't use so much space that the stack might
|
||||
// overflow. 512 jints corresponds to an 16384-bit integer and
|
||||
// will use here a total of 6k bytes of stack space.
|
||||
int total_allocation = longwords * sizeof (unsigned long) * 3;
|
||||
guarantee(total_allocation <= 8192, "must be");
|
||||
unsigned long *scratch = (unsigned long *)alloca(total_allocation);
|
||||
|
||||
// Local scratch arrays
|
||||
unsigned long
|
||||
*a = scratch + 0 * longwords,
|
||||
*n = scratch + 1 * longwords,
|
||||
*m = scratch + 2 * longwords;
|
||||
|
||||
reverse_words((unsigned long *)a_ints, a, longwords);
|
||||
reverse_words((unsigned long *)n_ints, n, longwords);
|
||||
|
||||
if (len >= MONTGOMERY_SQUARING_THRESHOLD) {
|
||||
::montgomery_square(a, n, m, (unsigned long)inv, longwords);
|
||||
} else {
|
||||
::montgomery_multiply(a, a, n, m, (unsigned long)inv, longwords);
|
||||
}
|
||||
|
||||
reverse_words(m, (unsigned long *)m_ints, longwords);
|
||||
}
|
||||
|
||||
#endif // WINDOWS
|
||||
|
||||
#ifdef COMPILER2
|
||||
// This is here instead of runtime_x86_64.cpp because it uses SimpleRuntimeFrame
|
||||
//
|
||||
|
@ -4318,7 +4318,18 @@ class StubGenerator: public StubCodeGenerator {
|
||||
if (UseMulAddIntrinsic) {
|
||||
StubRoutines::_mulAdd = generate_mulAdd();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _WINDOWS
|
||||
if (UseMontgomeryMultiplyIntrinsic) {
|
||||
StubRoutines::_montgomeryMultiply
|
||||
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_multiply);
|
||||
}
|
||||
if (UseMontgomerySquareIntrinsic) {
|
||||
StubRoutines::_montgomerySquare
|
||||
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_square);
|
||||
}
|
||||
#endif // WINDOWS
|
||||
#endif // COMPILER2
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -692,10 +692,19 @@ void VM_Version::get_processor_features() {
|
||||
warning("SHA instructions are not available on this CPU");
|
||||
FLAG_SET_DEFAULT(UseSHA, false);
|
||||
}
|
||||
if (UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics) {
|
||||
warning("SHA intrinsics are not available on this CPU");
|
||||
|
||||
if (UseSHA1Intrinsics) {
|
||||
warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA256Intrinsics) {
|
||||
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
||||
}
|
||||
|
||||
if (UseSHA512Intrinsics) {
|
||||
warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
|
||||
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
||||
}
|
||||
|
||||
@ -813,6 +822,12 @@ void VM_Version::get_processor_features() {
|
||||
if (FLAG_IS_DEFAULT(UseMulAddIntrinsic)) {
|
||||
UseMulAddIntrinsic = true;
|
||||
}
|
||||
if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
|
||||
UseMontgomeryMultiplyIntrinsic = true;
|
||||
}
|
||||
if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
|
||||
UseMontgomerySquareIntrinsic = true;
|
||||
}
|
||||
#else
|
||||
if (UseMultiplyToLenIntrinsic) {
|
||||
if (!FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
|
||||
@ -820,6 +835,18 @@ void VM_Version::get_processor_features() {
|
||||
}
|
||||
FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, false);
|
||||
}
|
||||
if (UseMontgomeryMultiplyIntrinsic) {
|
||||
if (!FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
|
||||
warning("montgomeryMultiply intrinsic is not available in 32-bit VM");
|
||||
}
|
||||
FLAG_SET_DEFAULT(UseMontgomeryMultiplyIntrinsic, false);
|
||||
}
|
||||
if (UseMontgomerySquareIntrinsic) {
|
||||
if (!FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
|
||||
warning("montgomerySquare intrinsic is not available in 32-bit VM");
|
||||
}
|
||||
FLAG_SET_DEFAULT(UseMontgomerySquareIntrinsic, false);
|
||||
}
|
||||
if (UseSquareToLenIntrinsic) {
|
||||
if (!FLAG_IS_DEFAULT(UseSquareToLenIntrinsic)) {
|
||||
warning("squareToLen intrinsic is not available in 32-bit VM");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2009, 2015, Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,10 +28,4 @@
|
||||
|
||||
#include <ffi.h>
|
||||
|
||||
// Indicates whether the C calling conventions require that
|
||||
// 32-bit integer argument values are properly extended to 64 bits.
|
||||
// If set, SharedRuntime::c_calling_convention() must adapt
|
||||
// signatures accordingly.
|
||||
const bool CCallingConventionRequiresIntsAsLongs = false;
|
||||
|
||||
#endif // CPU_ZERO_VM_GLOBALDEFINITIONS_ZERO_HPP
|
||||
|
@ -191,7 +191,7 @@ public:
|
||||
return CPUVisitor::visit(nodeh, state);
|
||||
}
|
||||
|
||||
PICL(bool is_fujitsu) : _L1_data_cache_line_size(0), _L2_data_cache_line_size(0), _dl_handle(NULL) {
|
||||
PICL(bool is_fujitsu, bool is_sun4v) : _L1_data_cache_line_size(0), _L2_data_cache_line_size(0), _dl_handle(NULL) {
|
||||
if (!open_library()) {
|
||||
return;
|
||||
}
|
||||
@ -203,7 +203,7 @@ public:
|
||||
if (is_fujitsu) {
|
||||
cpu_class = "core";
|
||||
}
|
||||
CPUVisitor cpu_visitor(this, os::processor_count());
|
||||
CPUVisitor cpu_visitor(this, (is_sun4v && !is_fujitsu) ? 1 : os::processor_count());
|
||||
_picl_walk_tree_by_class(rooth, cpu_class, &cpu_visitor, PICL_visit_cpu_helper);
|
||||
if (cpu_visitor.l1_visitor()->is_assigned()) { // Is there a value?
|
||||
_L1_data_cache_line_size = cpu_visitor.l1_visitor()->value();
|
||||
@ -447,7 +447,7 @@ int VM_Version::platform_features(int features) {
|
||||
}
|
||||
|
||||
// Figure out cache line sizes using PICL
|
||||
PICL picl((features & sparc64_family_m) != 0);
|
||||
PICL picl((features & sparc64_family_m) != 0, (features & sun4v_m) != 0);
|
||||
_L1_data_cache_line_size = picl.L1_data_cache_line_size();
|
||||
_L2_data_cache_line_size = picl.L2_data_cache_line_size();
|
||||
|
||||
|
@ -70,7 +70,8 @@ CONFIGURE_ARGS= --host=$(MINGW) --target=$(MINGW)
|
||||
else #linux
|
||||
CPU = $(shell uname -m)
|
||||
ARCH1=$(CPU:x86_64=amd64)
|
||||
ARCH=$(ARCH1:i686=i386)
|
||||
ARCH2=$(ARCH1:i686=i386)
|
||||
ARCH=$(ARCH2:ppc64le=ppc64)
|
||||
ifdef LP64
|
||||
CFLAGS/sparcv9 += -m64
|
||||
CFLAGS/amd64 += -m64
|
||||
|
@ -3157,6 +3157,9 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope)
|
||||
// code for the inlined version will be different than the root
|
||||
// compiled version which could lead to monotonicity problems on
|
||||
// intel.
|
||||
if (CheckIntrinsics && !scope->method()->intrinsic_candidate()) {
|
||||
BAILOUT("failed to inline intrinsic, method not annotated");
|
||||
}
|
||||
|
||||
// Set up a stream so that appending instructions works properly.
|
||||
ciBytecodeStream s(scope->method());
|
||||
@ -3197,6 +3200,9 @@ GraphBuilder::GraphBuilder(Compilation* compilation, IRScope* scope)
|
||||
// result in the referent being marked live and the reference
|
||||
// object removed from the list of discovered references during
|
||||
// reference processing.
|
||||
if (CheckIntrinsics && !scope->method()->intrinsic_candidate()) {
|
||||
BAILOUT("failed to inline intrinsic, method not annotated");
|
||||
}
|
||||
|
||||
// Also we need intrinsic to prevent commoning reads from this field
|
||||
// across safepoint since GC can change its value.
|
||||
@ -3317,7 +3323,8 @@ bool GraphBuilder::try_inline(ciMethod* callee, bool holder_known, Bytecodes::Co
|
||||
}
|
||||
|
||||
// handle intrinsics
|
||||
if (callee->intrinsic_id() != vmIntrinsics::_none) {
|
||||
if (callee->intrinsic_id() != vmIntrinsics::_none &&
|
||||
(CheckIntrinsics ? callee->intrinsic_candidate() : true)) {
|
||||
if (try_inline_intrinsics(callee)) {
|
||||
print_inlining(callee, "intrinsic");
|
||||
return true;
|
||||
@ -4278,7 +4285,7 @@ void GraphBuilder::append_unsafe_CAS(ciMethod* callee) {
|
||||
assert(result_type->is_int(), "int result");
|
||||
Values* args = state()->pop_arguments(callee->arg_size());
|
||||
|
||||
// Pop off some args to speically handle, then push back
|
||||
// Pop off some args to specially handle, then push back
|
||||
Value newval = args->pop();
|
||||
Value cmpval = args->pop();
|
||||
Value offset = args->pop();
|
||||
|
@ -1185,7 +1185,6 @@ vmIntrinsics::ID BCEscapeAnalyzer::known_intrinsic() {
|
||||
vmIntrinsics::ID iid = method()->intrinsic_id();
|
||||
|
||||
if (iid == vmIntrinsics::_getClass ||
|
||||
iid == vmIntrinsics::_fillInStackTrace ||
|
||||
iid == vmIntrinsics::_hashCode)
|
||||
return iid;
|
||||
else
|
||||
@ -1199,10 +1198,6 @@ bool BCEscapeAnalyzer::compute_escape_for_intrinsic(vmIntrinsics::ID iid) {
|
||||
case vmIntrinsics::_getClass:
|
||||
_return_local = false;
|
||||
break;
|
||||
case vmIntrinsics::_fillInStackTrace:
|
||||
arg.set(0); // 'this'
|
||||
set_returned(arg);
|
||||
break;
|
||||
case vmIntrinsics::_hashCode:
|
||||
// initialized state is correct
|
||||
break;
|
||||
|
@ -178,9 +178,10 @@ class ciMethod : public ciMetadata {
|
||||
// Code size for inlining decisions.
|
||||
int code_size_for_inlining();
|
||||
|
||||
bool caller_sensitive() const { return get_Method()->caller_sensitive(); }
|
||||
bool force_inline() const { return get_Method()->force_inline(); }
|
||||
bool dont_inline() const { return get_Method()->dont_inline(); }
|
||||
bool caller_sensitive() const { return get_Method()->caller_sensitive(); }
|
||||
bool force_inline() const { return get_Method()->force_inline(); }
|
||||
bool dont_inline() const { return get_Method()->dont_inline(); }
|
||||
bool intrinsic_candidate() const { return get_Method()->intrinsic_candidate(); }
|
||||
|
||||
int comp_level();
|
||||
int highest_osr_comp_level();
|
||||
|
@ -1751,6 +1751,10 @@ ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_d
|
||||
if (_location != _in_method) break; // only allow for methods
|
||||
if (!privileged) break; // only allow in privileged code
|
||||
return _method_LambdaForm_Hidden;
|
||||
case vmSymbols::VM_SYMBOL_ENUM_NAME(jdk_internal_HotSpotIntrinsicCandidate_signature):
|
||||
if (_location != _in_method) break; // only allow for methods
|
||||
if (!privileged) break; // only allow in privileged code
|
||||
return _method_HotSpotIntrinsicCandidate;
|
||||
case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature):
|
||||
if (_location != _in_field) break; // only allow for fields
|
||||
if (!privileged) break; // only allow in privileged code
|
||||
@ -1790,6 +1794,8 @@ void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
|
||||
m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
|
||||
if (has_annotation(_method_LambdaForm_Hidden))
|
||||
m->set_hidden(true);
|
||||
if (has_annotation(_method_HotSpotIntrinsicCandidate) && !m->is_synthetic())
|
||||
m->set_intrinsic_candidate(true);
|
||||
}
|
||||
|
||||
void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
|
||||
@ -4131,9 +4137,78 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
|
||||
// (We used to do this lazily, but now we query it in Rewriter,
|
||||
// which is eagerly done for every method, so we might as well do it now,
|
||||
// when everything is fresh in memory.)
|
||||
if (Method::klass_id_for_intrinsics(this_klass()) != vmSymbols::NO_SID) {
|
||||
vmSymbols::SID klass_id = Method::klass_id_for_intrinsics(this_klass());
|
||||
if (klass_id != vmSymbols::NO_SID) {
|
||||
for (int j = 0; j < methods->length(); j++) {
|
||||
methods->at(j)->init_intrinsic_id();
|
||||
Method* method = methods->at(j);
|
||||
method->init_intrinsic_id();
|
||||
|
||||
if (CheckIntrinsics) {
|
||||
// Check if an intrinsic is defined for method 'method',
|
||||
// but the method is not annotated with @HotSpotIntrinsicCandidate.
|
||||
if (method->intrinsic_id() != vmIntrinsics::_none &&
|
||||
!method->intrinsic_candidate()) {
|
||||
tty->print("Compiler intrinsic is defined for method [%s], "
|
||||
"but the method is not annotated with @HotSpotIntrinsicCandidate.%s",
|
||||
method->name_and_sig_as_C_string(),
|
||||
NOT_DEBUG(" Method will not be inlined.") DEBUG_ONLY(" Exiting.")
|
||||
);
|
||||
tty->cr();
|
||||
DEBUG_ONLY(vm_exit(1));
|
||||
}
|
||||
// Check is the method 'method' is annotated with @HotSpotIntrinsicCandidate,
|
||||
// but there is no intrinsic available for it.
|
||||
if (method->intrinsic_candidate() &&
|
||||
method->intrinsic_id() == vmIntrinsics::_none) {
|
||||
tty->print("Method [%s] is annotated with @HotSpotIntrinsicCandidate, "
|
||||
"but no compiler intrinsic is defined for the method.%s",
|
||||
method->name_and_sig_as_C_string(),
|
||||
NOT_DEBUG("") DEBUG_ONLY(" Exiting.")
|
||||
);
|
||||
tty->cr();
|
||||
DEBUG_ONLY(vm_exit(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckIntrinsics) {
|
||||
// Check for orphan methods in the current class. A method m
|
||||
// of a class C is orphan if an intrinsic is defined for method m,
|
||||
// but class C does not declare m.
|
||||
|
||||
for (int id = vmIntrinsics::FIRST_ID; id < (int)vmIntrinsics::ID_LIMIT; id++) {
|
||||
if (id == vmIntrinsics::_compiledLambdaForm) {
|
||||
// The _compiledLamdbdaForm intrinsic is a special marker for bytecode
|
||||
// generated for the JVM from a LambdaForm and therefore no method
|
||||
// is defined for it.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (vmIntrinsics::class_for(vmIntrinsics::ID_from(id)) == klass_id) {
|
||||
// Check if the current class contains a method with the same
|
||||
// name, flags, signature.
|
||||
bool match = false;
|
||||
for (int j = 0; j < methods->length(); j++) {
|
||||
Method* method = methods->at(j);
|
||||
if (id == method->intrinsic_id()) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!match) {
|
||||
char buf[1000];
|
||||
tty->print("Compiler intrinsic is defined for method [%s], "
|
||||
"but the method is not available in class [%s].%s",
|
||||
vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID_from(id), buf, sizeof(buf)),
|
||||
this_klass->name()->as_C_string(),
|
||||
NOT_DEBUG("") DEBUG_ONLY(" Exiting.")
|
||||
);
|
||||
tty->cr();
|
||||
DEBUG_ONLY(vm_exit(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,6 +130,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||
_method_InjectedProfile,
|
||||
_method_LambdaForm_Compiled,
|
||||
_method_LambdaForm_Hidden,
|
||||
_method_HotSpotIntrinsicCandidate,
|
||||
_sun_misc_Contended,
|
||||
_field_Stable,
|
||||
_annotation_LIMIT
|
||||
|
@ -1707,8 +1707,7 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle met
|
||||
// - rest of the stack
|
||||
|
||||
if (!skip_fillInStackTrace_check) {
|
||||
if ((method->name() == vmSymbols::fillInStackTrace_name() ||
|
||||
method->name() == vmSymbols::fillInStackTrace0_name()) &&
|
||||
if (method->name() == vmSymbols::fillInStackTrace_name() &&
|
||||
throwable->is_a(method->method_holder())) {
|
||||
continue;
|
||||
}
|
||||
|
@ -258,6 +258,8 @@
|
||||
/* Type Annotations (JDK 8 and above) */ \
|
||||
template(type_annotations_name, "typeAnnotations") \
|
||||
\
|
||||
/* Intrinsic Annotation (JDK 9 and above) */ \
|
||||
template(jdk_internal_HotSpotIntrinsicCandidate_signature, "Ljdk/internal/HotSpotIntrinsicCandidate;") \
|
||||
\
|
||||
/* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */ \
|
||||
template(java_lang_invoke_CallSite, "java/lang/invoke/CallSite") \
|
||||
@ -345,7 +347,6 @@
|
||||
template(dispatch_name, "dispatch") \
|
||||
template(getSystemClassLoader_name, "getSystemClassLoader") \
|
||||
template(fillInStackTrace_name, "fillInStackTrace") \
|
||||
template(fillInStackTrace0_name, "fillInStackTrace0") \
|
||||
template(getCause_name, "getCause") \
|
||||
template(initCause_name, "initCause") \
|
||||
template(setProperty_name, "setProperty") \
|
||||
@ -635,7 +636,43 @@
|
||||
// The F_xx is one of the Flags enum; see below.
|
||||
//
|
||||
// for Emacs: (let ((c-backslash-column 120) (c-backslash-max-column 120)) (c-backslash-region (point) (point-max) nil t))
|
||||
//
|
||||
//
|
||||
// There are two types of intrinsic methods: (1) Library intrinsics and (2) bytecode intrinsics.
|
||||
//
|
||||
// (1) A library intrinsic method may be replaced with hand-crafted assembly code,
|
||||
// with hand-crafted compiler IR, or with a combination of the two. The semantics
|
||||
// of the replacement code may differ from the semantics of the replaced code.
|
||||
//
|
||||
// (2) Bytecode intrinsic methods are not replaced by special code, but they are
|
||||
// treated in some other special way by the compiler. For example, the compiler
|
||||
// may delay inlining for some String-related intrinsic methods (e.g., some methods
|
||||
// defined in the StringBuilder and StringBuffer classes, see
|
||||
// Compile::should_delay_string_inlining() for more details).
|
||||
//
|
||||
// Due to the difference between the semantics of an intrinsic method as defined
|
||||
// in the (Java) source code and the semantics of the method as defined
|
||||
// by the code in the VM, intrinsic methods must be explicitly marked.
|
||||
//
|
||||
// Intrinsic methods are marked by the jdk.internal.HotSpotIntrinsicCandidate
|
||||
// annotation. If CheckIntrinsics is enabled, the VM performs the following
|
||||
// checks when a class C is loaded: (1) all intrinsics defined by the VM for
|
||||
// class C are present in the loaded class file and are marked;
|
||||
// (2) an intrinsic is defined by the VM for all marked methods of class C.
|
||||
//
|
||||
// If a mismatch is detected for a method, the VM behaves differently depending
|
||||
// on the type of build. A fastdebug build exits and reports an error on a mismatch.
|
||||
// A product build will not replace an unmarked library intrinsic method with
|
||||
// hand-crafted code, that is, unmarked library intrinsics are treated as ordinary
|
||||
// methods in a product build. The special treatment of a bytecode intrinsic method
|
||||
// persists even if the method not marked.
|
||||
//
|
||||
// When adding an intrinsic for a method, please make sure to appropriately
|
||||
// annotate the method in the source code. The list below contains all
|
||||
// library intrinsics followed by bytecode intrinsics. Please also make sure to
|
||||
// add the declaration of the intrinsic to the approriate section of the list.
|
||||
#define VM_INTRINSICS_DO(do_intrinsic, do_class, do_name, do_signature, do_alias) \
|
||||
/* (1) Library intrinsics */ \
|
||||
do_intrinsic(_hashCode, java_lang_Object, hashCode_name, void_int_signature, F_R) \
|
||||
do_name( hashCode_name, "hashCode") \
|
||||
do_intrinsic(_getClass, java_lang_Object, getClass_name, void_class_signature, F_R) \
|
||||
@ -792,12 +829,12 @@
|
||||
\
|
||||
do_class(sun_nio_cs_iso8859_1_Encoder, "sun/nio/cs/ISO_8859_1$Encoder") \
|
||||
do_intrinsic(_encodeISOArray, sun_nio_cs_iso8859_1_Encoder, encodeISOArray_name, encodeISOArray_signature, F_S) \
|
||||
do_name( encodeISOArray_name, "encodeISOArray") \
|
||||
do_name( encodeISOArray_name, "implEncodeISOArray") \
|
||||
do_signature(encodeISOArray_signature, "([CI[BII)I") \
|
||||
\
|
||||
do_class(java_math_BigInteger, "java/math/BigInteger") \
|
||||
do_intrinsic(_multiplyToLen, java_math_BigInteger, multiplyToLen_name, multiplyToLen_signature, F_R) \
|
||||
do_name( multiplyToLen_name, "multiplyToLen") \
|
||||
do_intrinsic(_multiplyToLen, java_math_BigInteger, multiplyToLen_name, multiplyToLen_signature, F_S) \
|
||||
do_name( multiplyToLen_name, "implMultiplyToLen") \
|
||||
do_signature(multiplyToLen_signature, "([II[II[I)[I") \
|
||||
\
|
||||
do_intrinsic(_squareToLen, java_math_BigInteger, squareToLen_name, squareToLen_signature, F_S) \
|
||||
@ -808,6 +845,14 @@
|
||||
do_name( mulAdd_name, "implMulAdd") \
|
||||
do_signature(mulAdd_signature, "([I[IIII)I") \
|
||||
\
|
||||
do_intrinsic(_montgomeryMultiply, java_math_BigInteger, montgomeryMultiply_name, montgomeryMultiply_signature, F_S) \
|
||||
do_name( montgomeryMultiply_name, "implMontgomeryMultiply") \
|
||||
do_signature(montgomeryMultiply_signature, "([I[I[IIJ[I)[I") \
|
||||
\
|
||||
do_intrinsic(_montgomerySquare, java_math_BigInteger, montgomerySquare_name, montgomerySquare_signature, F_S) \
|
||||
do_name( montgomerySquare_name, "implMontgomerySquare") \
|
||||
do_signature(montgomerySquare_signature, "([I[IIJ[I)[I") \
|
||||
\
|
||||
/* java/lang/ref/Reference */ \
|
||||
do_intrinsic(_Reference_get, java_lang_ref_Reference, get_name, void_object_signature, F_R) \
|
||||
\
|
||||
@ -815,21 +860,21 @@
|
||||
do_class(com_sun_crypto_provider_aescrypt, "com/sun/crypto/provider/AESCrypt") \
|
||||
do_intrinsic(_aescrypt_encryptBlock, com_sun_crypto_provider_aescrypt, encryptBlock_name, byteArray_int_byteArray_int_signature, F_R) \
|
||||
do_intrinsic(_aescrypt_decryptBlock, com_sun_crypto_provider_aescrypt, decryptBlock_name, byteArray_int_byteArray_int_signature, F_R) \
|
||||
do_name( encryptBlock_name, "encryptBlock") \
|
||||
do_name( decryptBlock_name, "decryptBlock") \
|
||||
do_name( encryptBlock_name, "implEncryptBlock") \
|
||||
do_name( decryptBlock_name, "implDecryptBlock") \
|
||||
do_signature(byteArray_int_byteArray_int_signature, "([BI[BI)V") \
|
||||
\
|
||||
do_class(com_sun_crypto_provider_cipherBlockChaining, "com/sun/crypto/provider/CipherBlockChaining") \
|
||||
do_intrinsic(_cipherBlockChaining_encryptAESCrypt, com_sun_crypto_provider_cipherBlockChaining, encrypt_name, byteArray_int_int_byteArray_int_signature, F_R) \
|
||||
do_intrinsic(_cipherBlockChaining_decryptAESCrypt, com_sun_crypto_provider_cipherBlockChaining, decrypt_name, byteArray_int_int_byteArray_int_signature, F_R) \
|
||||
do_name( encrypt_name, "encrypt") \
|
||||
do_name( decrypt_name, "decrypt") \
|
||||
do_name( encrypt_name, "implEncrypt") \
|
||||
do_name( decrypt_name, "implDecrypt") \
|
||||
do_signature(byteArray_int_int_byteArray_int_signature, "([BII[BI)I") \
|
||||
\
|
||||
/* support for sun.security.provider.SHA */ \
|
||||
do_class(sun_security_provider_sha, "sun/security/provider/SHA") \
|
||||
do_intrinsic(_sha_implCompress, sun_security_provider_sha, implCompress_name, implCompress_signature, F_R) \
|
||||
do_name( implCompress_name, "implCompress") \
|
||||
do_name( implCompress_name, "implCompress0") \
|
||||
do_signature(implCompress_signature, "([BI)V") \
|
||||
\
|
||||
/* support for sun.security.provider.SHA2 */ \
|
||||
@ -843,7 +888,7 @@
|
||||
/* support for sun.security.provider.DigestBase */ \
|
||||
do_class(sun_security_provider_digestbase, "sun/security/provider/DigestBase") \
|
||||
do_intrinsic(_digestBase_implCompressMB, sun_security_provider_digestbase, implCompressMB_name, implCompressMB_signature, F_R) \
|
||||
do_name( implCompressMB_name, "implCompressMultiBlock") \
|
||||
do_name( implCompressMB_name, "implCompressMultiBlock0") \
|
||||
do_signature(implCompressMB_signature, "([BII)I") \
|
||||
\
|
||||
/* support for com.sun.crypto.provider.GHASH */ \
|
||||
@ -857,17 +902,18 @@
|
||||
do_intrinsic(_updateCRC32, java_util_zip_CRC32, update_name, int2_int_signature, F_SN) \
|
||||
do_name( update_name, "update") \
|
||||
do_intrinsic(_updateBytesCRC32, java_util_zip_CRC32, updateBytes_name, updateBytes_signature, F_SN) \
|
||||
do_name( updateBytes_name, "updateBytes") \
|
||||
do_name( updateBytes_name, "updateBytes0") \
|
||||
do_signature(updateBytes_signature, "(I[BII)I") \
|
||||
do_intrinsic(_updateByteBufferCRC32, java_util_zip_CRC32, updateByteBuffer_name, updateByteBuffer_signature, F_SN) \
|
||||
do_name( updateByteBuffer_name, "updateByteBuffer") \
|
||||
do_name( updateByteBuffer_name, "updateByteBuffer0") \
|
||||
do_signature(updateByteBuffer_signature, "(IJII)I") \
|
||||
\
|
||||
/* support for java.util.zip.CRC32C */ \
|
||||
do_class(java_util_zip_CRC32C, "java/util/zip/CRC32C") \
|
||||
do_intrinsic(_updateBytesCRC32C, java_util_zip_CRC32C, updateBytes_name, updateBytes_signature, F_S) \
|
||||
do_intrinsic(_updateDirectByteBufferCRC32C, java_util_zip_CRC32C, updateDirectByteBuffer_name, updateByteBuffer_signature, F_S) \
|
||||
do_name( updateDirectByteBuffer_name, "updateDirectByteBuffer") \
|
||||
do_intrinsic(_updateBytesCRC32C, java_util_zip_CRC32C, updateBytes_C_name, updateBytes_signature, F_S) \
|
||||
do_name( updateBytes_C_name, "updateBytes") \
|
||||
do_intrinsic(_updateDirectByteBufferCRC32C, java_util_zip_CRC32C, updateDirectByteBuffer_C_name, updateByteBuffer_signature, F_S) \
|
||||
do_name( updateDirectByteBuffer_C_name, "updateDirectByteBuffer") \
|
||||
\
|
||||
/* support for sun.misc.Unsafe */ \
|
||||
do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \
|
||||
@ -878,12 +924,6 @@
|
||||
do_intrinsic(_copyMemory, sun_misc_Unsafe, copyMemory_name, copyMemory_signature, F_RN) \
|
||||
do_name( copyMemory_name, "copyMemory") \
|
||||
do_signature(copyMemory_signature, "(Ljava/lang/Object;JLjava/lang/Object;JJ)V") \
|
||||
do_intrinsic(_park, sun_misc_Unsafe, park_name, park_signature, F_RN) \
|
||||
do_name( park_name, "park") \
|
||||
do_signature(park_signature, "(ZJ)V") \
|
||||
do_intrinsic(_unpark, sun_misc_Unsafe, unpark_name, unpark_signature, F_RN) \
|
||||
do_name( unpark_name, "unpark") \
|
||||
do_alias( unpark_signature, /*(LObject;)V*/ object_void_signature) \
|
||||
do_intrinsic(_loadFence, sun_misc_Unsafe, loadFence_name, loadFence_signature, F_RN) \
|
||||
do_name( loadFence_name, "loadFence") \
|
||||
do_alias( loadFence_signature, void_method_signature) \
|
||||
@ -1066,11 +1106,15 @@
|
||||
do_intrinsic(_getAndSetObject, sun_misc_Unsafe, getAndSetObject_name, getAndSetObject_signature, F_R)\
|
||||
do_name( getAndSetObject_name, "getAndSetObject") \
|
||||
do_signature(getAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
|
||||
/*== LAST_COMPILER_INLINE*/ \
|
||||
/*the compiler does have special inlining code for these; bytecode inline is just fine */ \
|
||||
\
|
||||
do_intrinsic(_fillInStackTrace, java_lang_Throwable, fillInStackTrace_name, void_throwable_signature, F_RNY) \
|
||||
\
|
||||
/* (2) Bytecode intrinsics */ \
|
||||
\
|
||||
do_intrinsic(_park, sun_misc_Unsafe, park_name, park_signature, F_RN) \
|
||||
do_name( park_name, "park") \
|
||||
do_signature(park_signature, "(ZJ)V") \
|
||||
do_intrinsic(_unpark, sun_misc_Unsafe, unpark_name, unpark_signature, F_RN) \
|
||||
do_name( unpark_name, "unpark") \
|
||||
do_alias( unpark_signature, /*(LObject;)V*/ object_void_signature) \
|
||||
do_intrinsic(_StringBuilder_void, java_lang_StringBuilder, object_initializer_name, void_method_signature, F_R) \
|
||||
do_intrinsic(_StringBuilder_int, java_lang_StringBuilder, object_initializer_name, int_void_signature, F_R) \
|
||||
do_intrinsic(_StringBuilder_String, java_lang_StringBuilder, object_initializer_name, string_void_signature, F_R) \
|
||||
|
@ -107,7 +107,7 @@ void Rewriter::make_constant_pool_cache(TRAPS) {
|
||||
// more complicated solution is required. A special return bytecode
|
||||
// is used only by Object.<init> to signal the finalization
|
||||
// registration point. Additionally local 0 must be preserved so it's
|
||||
// available to pass to the registration function. For simplicty we
|
||||
// available to pass to the registration function. For simplicity we
|
||||
// require that local 0 is never overwritten so it's available as an
|
||||
// argument for registration.
|
||||
|
||||
|
@ -82,7 +82,8 @@ class Method : public Metadata {
|
||||
_dont_inline = 1 << 3,
|
||||
_hidden = 1 << 4,
|
||||
_has_injected_profile = 1 << 5,
|
||||
_running_emcp = 1 << 6
|
||||
_running_emcp = 1 << 6,
|
||||
_intrinsic_candidate = 1 << 7
|
||||
};
|
||||
u1 _flags;
|
||||
|
||||
@ -815,6 +816,13 @@ class Method : public Metadata {
|
||||
_flags = x ? (_flags | _hidden) : (_flags & ~_hidden);
|
||||
}
|
||||
|
||||
bool intrinsic_candidate() {
|
||||
return (_flags & _intrinsic_candidate) != 0;
|
||||
}
|
||||
void set_intrinsic_candidate(bool x) {
|
||||
_flags = x ? (_flags | _intrinsic_candidate) : (_flags & ~_intrinsic_candidate);
|
||||
}
|
||||
|
||||
bool has_injected_profile() {
|
||||
return (_flags & _has_injected_profile) != 0;
|
||||
}
|
||||
|
@ -688,6 +688,12 @@
|
||||
product(bool, UseMulAddIntrinsic, false, \
|
||||
"Enables intrinsification of BigInteger.mulAdd()") \
|
||||
\
|
||||
product(bool, UseMontgomeryMultiplyIntrinsic, false, \
|
||||
"Enables intrinsification of BigInteger.montgomeryMultiply()") \
|
||||
\
|
||||
product(bool, UseMontgomerySquareIntrinsic, false, \
|
||||
"Enables intrinsification of BigInteger.montgomerySquare()") \
|
||||
\
|
||||
product(bool, UseTypeSpeculation, true, \
|
||||
"Speculatively propagate types from profiles") \
|
||||
\
|
||||
|
@ -976,8 +976,10 @@ void ConnectionGraph::process_call_arguments(CallNode *call) {
|
||||
strcmp(call->as_CallLeaf()->_name, "sha512_implCompressMB") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "multiplyToLen") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "squareToLen") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0)
|
||||
))) {
|
||||
strcmp(call->as_CallLeaf()->_name, "mulAdd") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "montgomery_multiply") == 0 ||
|
||||
strcmp(call->as_CallLeaf()->_name, "montgomery_square") == 0)
|
||||
))) {
|
||||
call->dump();
|
||||
fatal(err_msg_res("EA unexpected CallLeaf %s", call->as_CallLeaf()->_name));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
@ -118,19 +118,14 @@ void GraphKit::gen_stub(address C_function,
|
||||
// The C routines gets the base of thread-local storage passed in as an
|
||||
// extra argument. Not all calls need it, but its cheap to add here.
|
||||
for (uint pcnt = cnt; pcnt < parm_cnt; pcnt++, cnt++) {
|
||||
// Convert ints to longs if required.
|
||||
if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(pcnt)->isa_int()) {
|
||||
fields[cnt++] = TypeLong::LONG;
|
||||
fields[cnt] = Type::HALF; // must add an additional half for a long
|
||||
} else {
|
||||
fields[cnt] = jdomain->field_at(pcnt);
|
||||
}
|
||||
fields[cnt] = jdomain->field_at(pcnt);
|
||||
}
|
||||
|
||||
fields[cnt++] = TypeRawPtr::BOTTOM; // Thread-local storage
|
||||
// Also pass in the caller's PC, if asked for.
|
||||
if( return_pc )
|
||||
if (return_pc) {
|
||||
fields[cnt++] = TypeRawPtr::BOTTOM; // Return PC
|
||||
}
|
||||
|
||||
const TypeTuple* domain = TypeTuple::make(cnt,fields);
|
||||
// The C routine we are about to call cannot return an oop; it can block on
|
||||
@ -143,21 +138,22 @@ void GraphKit::gen_stub(address C_function,
|
||||
const Type **rfields = TypeTuple::fields(jrange->cnt() - TypeFunc::Parms);
|
||||
// Fixup oop returns
|
||||
int retval_ptr = retval->isa_oop_ptr();
|
||||
if( retval_ptr ) {
|
||||
if (retval_ptr) {
|
||||
assert( pass_tls, "Oop must be returned thru TLS" );
|
||||
// Fancy-jumps return address; others return void
|
||||
rfields[TypeFunc::Parms] = is_fancy_jump ? TypeRawPtr::BOTTOM : Type::TOP;
|
||||
|
||||
} else if( retval->isa_int() ) { // Returning any integer subtype?
|
||||
} else if (retval->isa_int()) { // Returning any integer subtype?
|
||||
// "Fatten" byte, char & short return types to 'int' to show that
|
||||
// the native C code can return values with junk high order bits.
|
||||
// We'll sign-extend it below later.
|
||||
rfields[TypeFunc::Parms] = TypeInt::INT; // It's "dirty" and needs sign-ext
|
||||
|
||||
} else if( jrange->cnt() >= TypeFunc::Parms+1 ) { // Else copy other types
|
||||
} else if (jrange->cnt() >= TypeFunc::Parms+1) { // Else copy other types
|
||||
rfields[TypeFunc::Parms] = jrange->field_at(TypeFunc::Parms);
|
||||
if( jrange->cnt() == TypeFunc::Parms+2 )
|
||||
if (jrange->cnt() == TypeFunc::Parms+2) {
|
||||
rfields[TypeFunc::Parms+1] = jrange->field_at(TypeFunc::Parms+1);
|
||||
}
|
||||
}
|
||||
const TypeTuple* range = TypeTuple::make(jrange->cnt(),rfields);
|
||||
|
||||
@ -181,14 +177,7 @@ void GraphKit::gen_stub(address C_function,
|
||||
// A little too aggressive on the parm copy; return address is not an input
|
||||
call->set_req(TypeFunc::ReturnAdr, top());
|
||||
for (; i < parm_cnt; i++) { // Regular input arguments
|
||||
// Convert ints to longs if required.
|
||||
if (CCallingConventionRequiresIntsAsLongs && jdomain->field_at(i)->isa_int()) {
|
||||
Node* int_as_long = _gvn.transform(new ConvI2LNode(map()->in(i)));
|
||||
call->init_req(cnt++, int_as_long); // long
|
||||
call->init_req(cnt++, top()); // half
|
||||
} else {
|
||||
call->init_req(cnt++, map()->in(i));
|
||||
}
|
||||
call->init_req(cnt++, map()->in(i));
|
||||
}
|
||||
|
||||
call->init_req( cnt++, thread );
|
||||
|
@ -297,6 +297,8 @@ class LibraryCallKit : public GraphKit {
|
||||
bool inline_multiplyToLen();
|
||||
bool inline_squareToLen();
|
||||
bool inline_mulAdd();
|
||||
bool inline_montgomeryMultiply();
|
||||
bool inline_montgomerySquare();
|
||||
|
||||
bool inline_profileBoolean();
|
||||
bool inline_isCompileConstant();
|
||||
@ -508,6 +510,13 @@ CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
|
||||
if (!UseMulAddIntrinsic) return NULL;
|
||||
break;
|
||||
|
||||
case vmIntrinsics::_montgomeryMultiply:
|
||||
if (!UseMontgomeryMultiplyIntrinsic) return NULL;
|
||||
break;
|
||||
case vmIntrinsics::_montgomerySquare:
|
||||
if (!UseMontgomerySquareIntrinsic) return NULL;
|
||||
break;
|
||||
|
||||
case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
|
||||
case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
|
||||
if (!UseAESIntrinsics) return NULL;
|
||||
@ -642,7 +651,8 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
|
||||
const int bci = kit.bci();
|
||||
|
||||
// Try to inline the intrinsic.
|
||||
if (kit.try_to_inline(_last_predicate)) {
|
||||
if ((CheckIntrinsics ? callee->intrinsic_candidate() : true) &&
|
||||
kit.try_to_inline(_last_predicate)) {
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
|
||||
}
|
||||
@ -663,7 +673,13 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
if (jvms->has_method()) {
|
||||
// Not a root compile.
|
||||
const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
|
||||
const char* msg;
|
||||
if (callee->intrinsic_candidate()) {
|
||||
msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
|
||||
} else {
|
||||
msg = is_virtual() ? "failed to inline (intrinsic, virtual), method not annotated"
|
||||
: "failed to inline (intrinsic), method not annotated";
|
||||
}
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, msg);
|
||||
} else {
|
||||
// Root compile
|
||||
@ -942,6 +958,11 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
||||
case vmIntrinsics::_mulAdd:
|
||||
return inline_mulAdd();
|
||||
|
||||
case vmIntrinsics::_montgomeryMultiply:
|
||||
return inline_montgomeryMultiply();
|
||||
case vmIntrinsics::_montgomerySquare:
|
||||
return inline_montgomerySquare();
|
||||
|
||||
case vmIntrinsics::_ghash_processBlocks:
|
||||
return inline_ghash_processBlocks();
|
||||
|
||||
@ -5244,7 +5265,7 @@ bool LibraryCallKit::inline_encodeISOArray() {
|
||||
|
||||
//-------------inline_multiplyToLen-----------------------------------
|
||||
bool LibraryCallKit::inline_multiplyToLen() {
|
||||
assert(UseMultiplyToLenIntrinsic, "not implementated on this platform");
|
||||
assert(UseMultiplyToLenIntrinsic, "not implemented on this platform");
|
||||
|
||||
address stubAddr = StubRoutines::multiplyToLen();
|
||||
if (stubAddr == NULL) {
|
||||
@ -5254,11 +5275,12 @@ bool LibraryCallKit::inline_multiplyToLen() {
|
||||
|
||||
assert(callee()->signature()->size() == 5, "multiplyToLen has 5 parameters");
|
||||
|
||||
Node* x = argument(1);
|
||||
Node* xlen = argument(2);
|
||||
Node* y = argument(3);
|
||||
Node* ylen = argument(4);
|
||||
Node* z = argument(5);
|
||||
// no receiver because it is a static method
|
||||
Node* x = argument(0);
|
||||
Node* xlen = argument(1);
|
||||
Node* y = argument(2);
|
||||
Node* ylen = argument(3);
|
||||
Node* z = argument(4);
|
||||
|
||||
const Type* x_type = x->Value(&_gvn);
|
||||
const Type* y_type = y->Value(&_gvn);
|
||||
@ -5437,6 +5459,121 @@ bool LibraryCallKit::inline_mulAdd() {
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------inline_montgomeryMultiply-----------------------------------
|
||||
bool LibraryCallKit::inline_montgomeryMultiply() {
|
||||
address stubAddr = StubRoutines::montgomeryMultiply();
|
||||
if (stubAddr == NULL) {
|
||||
return false; // Intrinsic's stub is not implemented on this platform
|
||||
}
|
||||
|
||||
assert(UseMontgomeryMultiplyIntrinsic, "not implemented on this platform");
|
||||
const char* stubName = "montgomery_square";
|
||||
|
||||
assert(callee()->signature()->size() == 7, "montgomeryMultiply has 7 parameters");
|
||||
|
||||
Node* a = argument(0);
|
||||
Node* b = argument(1);
|
||||
Node* n = argument(2);
|
||||
Node* len = argument(3);
|
||||
Node* inv = argument(4);
|
||||
Node* m = argument(6);
|
||||
|
||||
const Type* a_type = a->Value(&_gvn);
|
||||
const TypeAryPtr* top_a = a_type->isa_aryptr();
|
||||
const Type* b_type = b->Value(&_gvn);
|
||||
const TypeAryPtr* top_b = b_type->isa_aryptr();
|
||||
const Type* n_type = a->Value(&_gvn);
|
||||
const TypeAryPtr* top_n = n_type->isa_aryptr();
|
||||
const Type* m_type = a->Value(&_gvn);
|
||||
const TypeAryPtr* top_m = m_type->isa_aryptr();
|
||||
if (top_a == NULL || top_a->klass() == NULL ||
|
||||
top_b == NULL || top_b->klass() == NULL ||
|
||||
top_n == NULL || top_n->klass() == NULL ||
|
||||
top_m == NULL || top_m->klass() == NULL) {
|
||||
// failed array check
|
||||
return false;
|
||||
}
|
||||
|
||||
BasicType a_elem = a_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
|
||||
BasicType b_elem = b_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
|
||||
BasicType n_elem = n_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
|
||||
BasicType m_elem = m_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
|
||||
if (a_elem != T_INT || b_elem != T_INT || n_elem != T_INT || m_elem != T_INT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make the call
|
||||
{
|
||||
Node* a_start = array_element_address(a, intcon(0), a_elem);
|
||||
Node* b_start = array_element_address(b, intcon(0), b_elem);
|
||||
Node* n_start = array_element_address(n, intcon(0), n_elem);
|
||||
Node* m_start = array_element_address(m, intcon(0), m_elem);
|
||||
|
||||
Node* call = make_runtime_call(RC_LEAF,
|
||||
OptoRuntime::montgomeryMultiply_Type(),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
a_start, b_start, n_start, len, inv, top(),
|
||||
m_start);
|
||||
set_result(m);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LibraryCallKit::inline_montgomerySquare() {
|
||||
address stubAddr = StubRoutines::montgomerySquare();
|
||||
if (stubAddr == NULL) {
|
||||
return false; // Intrinsic's stub is not implemented on this platform
|
||||
}
|
||||
|
||||
assert(UseMontgomerySquareIntrinsic, "not implemented on this platform");
|
||||
const char* stubName = "montgomery_square";
|
||||
|
||||
assert(callee()->signature()->size() == 6, "montgomerySquare has 6 parameters");
|
||||
|
||||
Node* a = argument(0);
|
||||
Node* n = argument(1);
|
||||
Node* len = argument(2);
|
||||
Node* inv = argument(3);
|
||||
Node* m = argument(5);
|
||||
|
||||
const Type* a_type = a->Value(&_gvn);
|
||||
const TypeAryPtr* top_a = a_type->isa_aryptr();
|
||||
const Type* n_type = a->Value(&_gvn);
|
||||
const TypeAryPtr* top_n = n_type->isa_aryptr();
|
||||
const Type* m_type = a->Value(&_gvn);
|
||||
const TypeAryPtr* top_m = m_type->isa_aryptr();
|
||||
if (top_a == NULL || top_a->klass() == NULL ||
|
||||
top_n == NULL || top_n->klass() == NULL ||
|
||||
top_m == NULL || top_m->klass() == NULL) {
|
||||
// failed array check
|
||||
return false;
|
||||
}
|
||||
|
||||
BasicType a_elem = a_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
|
||||
BasicType n_elem = n_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
|
||||
BasicType m_elem = m_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
|
||||
if (a_elem != T_INT || n_elem != T_INT || m_elem != T_INT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make the call
|
||||
{
|
||||
Node* a_start = array_element_address(a, intcon(0), a_elem);
|
||||
Node* n_start = array_element_address(n, intcon(0), n_elem);
|
||||
Node* m_start = array_element_address(m, intcon(0), m_elem);
|
||||
|
||||
Node* call = make_runtime_call(RC_LEAF,
|
||||
OptoRuntime::montgomerySquare_Type(),
|
||||
stubAddr, stubName, TypePtr::BOTTOM,
|
||||
a_start, n_start, len, inv, top(),
|
||||
m_start);
|
||||
set_result(m);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate CRC32 for byte.
|
||||
|
@ -2941,13 +2941,6 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
|
||||
_igvn.register_new_node_with_optimizer(store_value);
|
||||
}
|
||||
|
||||
if (CCallingConventionRequiresIntsAsLongs &&
|
||||
// See StubRoutines::select_fill_function for types. FLOAT has been converted to INT.
|
||||
(t == T_FLOAT || t == T_INT || is_subword_type(t))) {
|
||||
store_value = new ConvI2LNode(store_value);
|
||||
_igvn.register_new_node_with_optimizer(store_value);
|
||||
}
|
||||
|
||||
Node* mem_phi = store->in(MemNode::Memory);
|
||||
Node* result_ctrl;
|
||||
Node* result_mem;
|
||||
@ -2957,9 +2950,6 @@ bool PhaseIdealLoop::intrinsify_fill(IdealLoopTree* lpt) {
|
||||
uint cnt = 0;
|
||||
call->init_req(TypeFunc::Parms + cnt++, from);
|
||||
call->init_req(TypeFunc::Parms + cnt++, store_value);
|
||||
if (CCallingConventionRequiresIntsAsLongs) {
|
||||
call->init_req(TypeFunc::Parms + cnt++, C->top());
|
||||
}
|
||||
#ifdef _LP64
|
||||
len = new ConvI2LNode(len);
|
||||
_igvn.register_new_node_with_optimizer(len);
|
||||
|
@ -779,18 +779,10 @@ const TypeFunc* OptoRuntime::generic_arraycopy_Type() {
|
||||
const TypeFunc* OptoRuntime::array_fill_Type() {
|
||||
const Type** fields;
|
||||
int argp = TypeFunc::Parms;
|
||||
if (CCallingConventionRequiresIntsAsLongs) {
|
||||
// create input type (domain): pointer, int, size_t
|
||||
fields = TypeTuple::fields(3 LP64_ONLY( + 2));
|
||||
fields[argp++] = TypePtr::NOTNULL;
|
||||
fields[argp++] = TypeLong::LONG;
|
||||
fields[argp++] = Type::HALF;
|
||||
} else {
|
||||
// create input type (domain): pointer, int, size_t
|
||||
fields = TypeTuple::fields(3 LP64_ONLY( + 1));
|
||||
fields[argp++] = TypePtr::NOTNULL;
|
||||
fields[argp++] = TypeInt::INT;
|
||||
}
|
||||
fields = TypeTuple::fields(3 LP64_ONLY( + 1));
|
||||
fields[argp++] = TypePtr::NOTNULL;
|
||||
fields[argp++] = TypeInt::INT;
|
||||
fields[argp++] = TypeX_X; // size in whatevers (size_t)
|
||||
LP64_ONLY(fields[argp++] = Type::HALF); // other half of long length
|
||||
const TypeTuple *domain = TypeTuple::make(argp, fields);
|
||||
@ -1010,6 +1002,53 @@ const TypeFunc* OptoRuntime::mulAdd_Type() {
|
||||
return TypeFunc::make(domain, range);
|
||||
}
|
||||
|
||||
const TypeFunc* OptoRuntime::montgomeryMultiply_Type() {
|
||||
// create input type (domain)
|
||||
int num_args = 7;
|
||||
int argcnt = num_args;
|
||||
const Type** fields = TypeTuple::fields(argcnt);
|
||||
int argp = TypeFunc::Parms;
|
||||
fields[argp++] = TypePtr::NOTNULL; // a
|
||||
fields[argp++] = TypePtr::NOTNULL; // b
|
||||
fields[argp++] = TypePtr::NOTNULL; // n
|
||||
fields[argp++] = TypeInt::INT; // len
|
||||
fields[argp++] = TypeLong::LONG; // inv
|
||||
fields[argp++] = Type::HALF;
|
||||
fields[argp++] = TypePtr::NOTNULL; // result
|
||||
assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
|
||||
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
|
||||
|
||||
// result type needed
|
||||
fields = TypeTuple::fields(1);
|
||||
fields[TypeFunc::Parms+0] = TypePtr::NOTNULL;
|
||||
|
||||
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
|
||||
return TypeFunc::make(domain, range);
|
||||
}
|
||||
|
||||
const TypeFunc* OptoRuntime::montgomerySquare_Type() {
|
||||
// create input type (domain)
|
||||
int num_args = 6;
|
||||
int argcnt = num_args;
|
||||
const Type** fields = TypeTuple::fields(argcnt);
|
||||
int argp = TypeFunc::Parms;
|
||||
fields[argp++] = TypePtr::NOTNULL; // a
|
||||
fields[argp++] = TypePtr::NOTNULL; // n
|
||||
fields[argp++] = TypeInt::INT; // len
|
||||
fields[argp++] = TypeLong::LONG; // inv
|
||||
fields[argp++] = Type::HALF;
|
||||
fields[argp++] = TypePtr::NOTNULL; // result
|
||||
assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
|
||||
const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
|
||||
|
||||
// result type needed
|
||||
fields = TypeTuple::fields(1);
|
||||
fields[TypeFunc::Parms+0] = TypePtr::NOTNULL;
|
||||
|
||||
const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
|
||||
return TypeFunc::make(domain, range);
|
||||
}
|
||||
|
||||
// GHASH block processing
|
||||
const TypeFunc* OptoRuntime::ghash_processBlocks_Type() {
|
||||
int argcnt = 4;
|
||||
|
@ -311,6 +311,8 @@ private:
|
||||
static const TypeFunc* digestBase_implCompressMB_Type();
|
||||
|
||||
static const TypeFunc* multiplyToLen_Type();
|
||||
static const TypeFunc* montgomeryMultiply_Type();
|
||||
static const TypeFunc* montgomerySquare_Type();
|
||||
|
||||
static const TypeFunc* squareToLen_Type();
|
||||
|
||||
|
@ -728,7 +728,8 @@ public:
|
||||
"Control whether AES instructions can be used on x86/x64") \
|
||||
\
|
||||
product(bool, UseSHA, false, \
|
||||
"Control whether SHA instructions can be used on SPARC") \
|
||||
"Control whether SHA instructions can be used " \
|
||||
"on SPARC and on ARM") \
|
||||
\
|
||||
product(bool, UseGHASHIntrinsics, false, \
|
||||
"Use intrinsics for GHASH versions of crypto") \
|
||||
@ -837,13 +838,16 @@ public:
|
||||
"Use intrinsics for AES versions of crypto") \
|
||||
\
|
||||
product(bool, UseSHA1Intrinsics, false, \
|
||||
"Use intrinsics for SHA-1 crypto hash function") \
|
||||
"Use intrinsics for SHA-1 crypto hash function. " \
|
||||
"Requires that UseSHA is enabled.") \
|
||||
\
|
||||
product(bool, UseSHA256Intrinsics, false, \
|
||||
"Use intrinsics for SHA-224 and SHA-256 crypto hash functions") \
|
||||
"Use intrinsics for SHA-224 and SHA-256 crypto hash functions. " \
|
||||
"Requires that UseSHA is enabled.") \
|
||||
\
|
||||
product(bool, UseSHA512Intrinsics, false, \
|
||||
"Use intrinsics for SHA-384 and SHA-512 crypto hash functions") \
|
||||
"Use intrinsics for SHA-384 and SHA-512 crypto hash functions. " \
|
||||
"Requires that UseSHA is enabled.") \
|
||||
\
|
||||
product(bool, UseCRC32Intrinsics, false, \
|
||||
"use intrinsics for java.util.zip.CRC32") \
|
||||
@ -4124,7 +4128,16 @@ public:
|
||||
\
|
||||
product_pd(bool, PreserveFramePointer, \
|
||||
"Use the FP register for holding the frame pointer " \
|
||||
"and not as a general purpose register.")
|
||||
"and not as a general purpose register.") \
|
||||
\
|
||||
diagnostic(bool, CheckIntrinsics, trueInDebug, \
|
||||
"When a class C is loaded, check that " \
|
||||
"(1) all intrinsics defined by the VM for class C are present "\
|
||||
"in the loaded class file and are marked with the " \
|
||||
"@HotSpotIntrinsicCandidate annotation and also that " \
|
||||
"(2) there is an intrinsic registered for all loaded methods " \
|
||||
"that are annotated with the @HotSpotIntrinsicCandidate " \
|
||||
"annotation.")
|
||||
|
||||
/*
|
||||
* Macros for factoring of globals
|
||||
|
@ -2642,71 +2642,6 @@ JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* threa
|
||||
GC_locker::unlock_critical(thread);
|
||||
JRT_END
|
||||
|
||||
int SharedRuntime::convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt) {
|
||||
int argcnt = in_args_count;
|
||||
if (CCallingConventionRequiresIntsAsLongs) {
|
||||
for (int in = 0; in < in_args_count; in++) {
|
||||
BasicType bt = in_sig_bt[in];
|
||||
switch (bt) {
|
||||
case T_BOOLEAN:
|
||||
case T_CHAR:
|
||||
case T_BYTE:
|
||||
case T_SHORT:
|
||||
case T_INT:
|
||||
argcnt++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assert(0, "This should not be needed on this platform");
|
||||
}
|
||||
|
||||
return argcnt;
|
||||
}
|
||||
|
||||
void SharedRuntime::convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
|
||||
BasicType*& in_sig_bt, VMRegPair*& in_regs) {
|
||||
if (CCallingConventionRequiresIntsAsLongs) {
|
||||
VMRegPair *new_in_regs = NEW_RESOURCE_ARRAY(VMRegPair, i2l_argcnt);
|
||||
BasicType *new_in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, i2l_argcnt);
|
||||
|
||||
int argcnt = 0;
|
||||
for (int in = 0; in < in_args_count; in++, argcnt++) {
|
||||
BasicType bt = in_sig_bt[in];
|
||||
VMRegPair reg = in_regs[in];
|
||||
switch (bt) {
|
||||
case T_BOOLEAN:
|
||||
case T_CHAR:
|
||||
case T_BYTE:
|
||||
case T_SHORT:
|
||||
case T_INT:
|
||||
// Convert (bt) to (T_LONG,bt).
|
||||
new_in_sig_bt[argcnt] = T_LONG;
|
||||
new_in_sig_bt[argcnt+1] = bt;
|
||||
assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
|
||||
new_in_regs[argcnt].set2(reg.first());
|
||||
new_in_regs[argcnt+1].set_bad();
|
||||
argcnt++;
|
||||
break;
|
||||
default:
|
||||
// No conversion needed.
|
||||
new_in_sig_bt[argcnt] = bt;
|
||||
new_in_regs[argcnt] = reg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(argcnt == i2l_argcnt, "must match");
|
||||
|
||||
in_regs = new_in_regs;
|
||||
in_sig_bt = new_in_sig_bt;
|
||||
in_args_count = i2l_argcnt;
|
||||
} else {
|
||||
assert(0, "This should not be needed on this platform");
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Java-Java calling convention
|
||||
// (what you use when Java calls Java)
|
||||
|
@ -145,6 +145,12 @@ class SharedRuntime: AllStatic {
|
||||
static double dsqrt(double f);
|
||||
#endif
|
||||
|
||||
// Montgomery multiplication
|
||||
static void montgomery_multiply(jint *a_ints, jint *b_ints, jint *n_ints,
|
||||
jint len, jlong inv, jint *m_ints);
|
||||
static void montgomery_square(jint *a_ints, jint *n_ints,
|
||||
jint len, jlong inv, jint *m_ints);
|
||||
|
||||
#ifdef __SOFTFP__
|
||||
// C++ compiler generates soft float instructions as well as passing
|
||||
// float and double in registers.
|
||||
|
@ -143,6 +143,8 @@ address StubRoutines::_updateBytesCRC32C = NULL;
|
||||
address StubRoutines::_multiplyToLen = NULL;
|
||||
address StubRoutines::_squareToLen = NULL;
|
||||
address StubRoutines::_mulAdd = NULL;
|
||||
address StubRoutines::_montgomeryMultiply = NULL;
|
||||
address StubRoutines::_montgomerySquare = NULL;
|
||||
|
||||
double (* StubRoutines::_intrinsic_log )(double) = NULL;
|
||||
double (* StubRoutines::_intrinsic_log10 )(double) = NULL;
|
||||
|
@ -202,6 +202,8 @@ class StubRoutines: AllStatic {
|
||||
static address _multiplyToLen;
|
||||
static address _squareToLen;
|
||||
static address _mulAdd;
|
||||
static address _montgomeryMultiply;
|
||||
static address _montgomerySquare;
|
||||
|
||||
// These are versions of the java.lang.Math methods which perform
|
||||
// the same operations as the intrinsic version. They are used for
|
||||
@ -366,6 +368,8 @@ class StubRoutines: AllStatic {
|
||||
static address multiplyToLen() {return _multiplyToLen; }
|
||||
static address squareToLen() {return _squareToLen; }
|
||||
static address mulAdd() {return _mulAdd; }
|
||||
static address montgomeryMultiply() { return _montgomeryMultiply; }
|
||||
static address montgomerySquare() { return _montgomerySquare; }
|
||||
|
||||
static address select_fill_function(BasicType t, bool aligned, const char* &name);
|
||||
|
||||
|
@ -34,6 +34,7 @@ import jdk.test.lib.*;
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
* java.base/jdk.internal
|
||||
* @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java
|
||||
* @run main TestMonomorphicObjectCall
|
||||
*/
|
||||
|
@ -25,25 +25,33 @@
|
||||
|
||||
package java.lang;
|
||||
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
|
||||
/**
|
||||
* Slightly modified version of java.lang.Object that replaces
|
||||
* finalize() by finalizeObject() to avoid overriding in subclasses.
|
||||
*/
|
||||
public class Object {
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public Object() {}
|
||||
|
||||
private static native void registerNatives();
|
||||
static {
|
||||
registerNatives();
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public final native Class<?> getClass();
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
public native int hashCode();
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
return (this == obj);
|
||||
}
|
||||
|
||||
@HotSpotIntrinsicCandidate
|
||||
protected native Object clone() throws CloneNotSupportedException;
|
||||
|
||||
public String toString() {
|
||||
|
@ -0,0 +1,277 @@
|
||||
//
|
||||
// Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
// Copyright (c) 2015, Red Hat Inc. 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.
|
||||
//
|
||||
//
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8130150
|
||||
* @library /testlibrary
|
||||
* @summary Verify that the Montgomery multiply intrinsic works and correctly checks its arguments.
|
||||
*/
|
||||
|
||||
public class MontgomeryMultiplyTest {
|
||||
|
||||
static final MethodHandles.Lookup lookup = MethodHandles.lookup();
|
||||
|
||||
static final MethodHandle montgomeryMultiplyHandle, montgomerySquareHandle;
|
||||
static final MethodHandle bigIntegerConstructorHandle;
|
||||
static final Field bigIntegerMagField;
|
||||
|
||||
static {
|
||||
// Use reflection to gain access to the methods we want to test.
|
||||
try {
|
||||
Method m = BigInteger.class.getDeclaredMethod("montgomeryMultiply",
|
||||
/*a*/int[].class, /*b*/int[].class, /*n*/int[].class, /*len*/int.class,
|
||||
/*inv*/long.class, /*product*/int[].class);
|
||||
m.setAccessible(true);
|
||||
montgomeryMultiplyHandle = lookup.unreflect(m);
|
||||
|
||||
m = BigInteger.class.getDeclaredMethod("montgomerySquare",
|
||||
/*a*/int[].class, /*n*/int[].class, /*len*/int.class,
|
||||
/*inv*/long.class, /*product*/int[].class);
|
||||
m.setAccessible(true);
|
||||
montgomerySquareHandle = lookup.unreflect(m);
|
||||
|
||||
Constructor c
|
||||
= BigInteger.class.getDeclaredConstructor(int.class, int[].class);
|
||||
c.setAccessible(true);
|
||||
bigIntegerConstructorHandle = lookup.unreflectConstructor(c);
|
||||
|
||||
bigIntegerMagField = BigInteger.class.getDeclaredField("mag");
|
||||
bigIntegerMagField.setAccessible(true);
|
||||
|
||||
} catch (Throwable ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke either BigInteger.montgomeryMultiply or BigInteger.montgomerySquare.
|
||||
int[] montgomeryMultiply(int[] a, int[] b, int[] n, int len, long inv,
|
||||
int[] product) throws Throwable {
|
||||
int[] result =
|
||||
(a == b) ? (int[]) montgomerySquareHandle.invokeExact(a, n, len, inv, product)
|
||||
: (int[]) montgomeryMultiplyHandle.invokeExact(a, b, n, len, inv, product);
|
||||
return Arrays.copyOf(result, len);
|
||||
}
|
||||
|
||||
// Invoke the private constructor BigInteger(int[]).
|
||||
BigInteger newBigInteger(int[] val) throws Throwable {
|
||||
return (BigInteger) bigIntegerConstructorHandle.invokeExact(1, val);
|
||||
}
|
||||
|
||||
// Get the private field BigInteger.mag
|
||||
int[] mag(BigInteger n) {
|
||||
try {
|
||||
return (int[]) bigIntegerMagField.get(n);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Montgomery multiplication
|
||||
// Calculate a * b * r^-1 mod n)
|
||||
//
|
||||
// R is a power of the word size
|
||||
// N' = R^-1 mod N
|
||||
//
|
||||
// T := ab
|
||||
// m := (T mod R)N' mod R [so 0 <= m < R]
|
||||
// t := (T + mN)/R
|
||||
// if t >= N then return t - N else return t
|
||||
//
|
||||
BigInteger montgomeryMultiply(BigInteger a, BigInteger b, BigInteger N,
|
||||
int len, BigInteger n_prime)
|
||||
throws Throwable {
|
||||
BigInteger T = a.multiply(b);
|
||||
BigInteger R = BigInteger.ONE.shiftLeft(len*32);
|
||||
BigInteger mask = R.subtract(BigInteger.ONE);
|
||||
BigInteger m = (T.and(mask)).multiply(n_prime);
|
||||
m = m.and(mask); // i.e. m.mod(R)
|
||||
T = T.add(m.multiply(N));
|
||||
T = T.shiftRight(len*32); // i.e. T.divide(R)
|
||||
if (T.compareTo(N) > 0) {
|
||||
T = T.subtract(N);
|
||||
}
|
||||
return T;
|
||||
}
|
||||
|
||||
// Call the Montgomery multiply intrinsic.
|
||||
BigInteger montgomeryMultiply(int[] a_words, int[] b_words, int[] n_words,
|
||||
int len, BigInteger inv)
|
||||
throws Throwable {
|
||||
BigInteger t = montgomeryMultiply(
|
||||
newBigInteger(a_words),
|
||||
newBigInteger(b_words),
|
||||
newBigInteger(n_words),
|
||||
len, inv);
|
||||
return t;
|
||||
}
|
||||
|
||||
// Check that the Montgomery multiply intrinsic returns the same
|
||||
// result as the longhand calculation.
|
||||
void check(int[] a_words, int[] b_words, int[] n_words, int len, BigInteger inv)
|
||||
throws Throwable {
|
||||
BigInteger n = newBigInteger(n_words);
|
||||
BigInteger slow = montgomeryMultiply(a_words, b_words, n_words, len, inv);
|
||||
BigInteger fast
|
||||
= newBigInteger(montgomeryMultiply
|
||||
(a_words, b_words, n_words, len, inv.longValue(), null));
|
||||
// The intrinsic may not return the same value as the longhand
|
||||
// calculation but they must have the same residue mod N.
|
||||
if (!slow.mod(n).equals(fast.mod(n))) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
Random rnd = new Random(0);
|
||||
|
||||
// Return a random value of length <= bits in an array of even length
|
||||
int[] random_val(int bits) {
|
||||
int len = (bits+63)/64; // i.e. length in longs
|
||||
int[] val = new int[len*2];
|
||||
for (int i = 0; i < val.length; i++)
|
||||
val[i] = rnd.nextInt();
|
||||
int leadingZeros = 64 - (bits & 64);
|
||||
if (leadingZeros >= 32) {
|
||||
val[0] = 0;
|
||||
val[1] &= ~(-1l << (leadingZeros & 31));
|
||||
} else {
|
||||
val[0] &= ~(-1l << leadingZeros);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
void testOneLength(int lenInBits, int lenInInts) throws Throwable {
|
||||
BigInteger mod = new BigInteger(lenInBits, 2, rnd);
|
||||
BigInteger r = BigInteger.ONE.shiftLeft(lenInInts * 32);
|
||||
BigInteger n_prime = mod.modInverse(r).negate();
|
||||
|
||||
// Make n.length even, padding with a zero if necessary
|
||||
int[] n = mag(mod);
|
||||
if (n.length < lenInInts) {
|
||||
int[] x = new int[lenInInts];
|
||||
System.arraycopy(n, 0, x, lenInInts-n.length, n.length);
|
||||
n = x;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
// multiply
|
||||
check(random_val(lenInBits), random_val(lenInBits), n, lenInInts, n_prime);
|
||||
// square
|
||||
int[] tmp = random_val(lenInBits);
|
||||
check(tmp, tmp, n, lenInInts, n_prime);
|
||||
}
|
||||
}
|
||||
|
||||
// Test the Montgomery multiply intrinsic with a bunch of random
|
||||
// values of varying lengths. Do this for long enough that the
|
||||
// caller of the intrinsic is C2-compiled.
|
||||
void testResultValues() throws Throwable {
|
||||
// Test a couple of interesting edge cases.
|
||||
testOneLength(1024, 32);
|
||||
testOneLength(1025, 34);
|
||||
for (int j = 10; j > 0; j--) {
|
||||
// Construct a random prime whose length in words is even
|
||||
int lenInBits = rnd.nextInt(2048) + 64;
|
||||
int lenInInts = (lenInBits + 63)/64*2;
|
||||
testOneLength(lenInBits, lenInInts);
|
||||
}
|
||||
}
|
||||
|
||||
// Range checks
|
||||
void testOneMontgomeryMultiplyCheck(int[] a, int[] b, int[] n, int len, long inv,
|
||||
int[] product, Class klass) {
|
||||
try {
|
||||
montgomeryMultiply(a, b, n, len, inv, product);
|
||||
} catch (Throwable ex) {
|
||||
if (klass.isAssignableFrom(ex.getClass()))
|
||||
return;
|
||||
throw new RuntimeException(klass + " expected, " + ex + " was thrown");
|
||||
}
|
||||
throw new RuntimeException(klass + " expected, was not thrown");
|
||||
}
|
||||
|
||||
void testOneMontgomeryMultiplyCheck(int[] a, int[] b, BigInteger n, int len, BigInteger inv,
|
||||
Class klass) {
|
||||
testOneMontgomeryMultiplyCheck(a, b, mag(n), len, inv.longValue(), null, klass);
|
||||
}
|
||||
|
||||
void testOneMontgomeryMultiplyCheck(int[] a, int[] b, BigInteger n, int len, BigInteger inv,
|
||||
int[] product, Class klass) {
|
||||
testOneMontgomeryMultiplyCheck(a, b, mag(n), len, inv.longValue(), product, klass);
|
||||
}
|
||||
|
||||
void testMontgomeryMultiplyChecks() {
|
||||
int[] blah = random_val(40);
|
||||
int[] small = random_val(39);
|
||||
BigInteger mod = new BigInteger(40*32 , 2, rnd);
|
||||
BigInteger r = BigInteger.ONE.shiftLeft(40*32);
|
||||
BigInteger n_prime = mod.modInverse(r).negate();
|
||||
|
||||
// Length out of range: square
|
||||
testOneMontgomeryMultiplyCheck(blah, blah, mod, 41, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(blah, blah, mod, 0, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(blah, blah, mod, -1, n_prime, IllegalArgumentException.class);
|
||||
// As above, but for multiply
|
||||
testOneMontgomeryMultiplyCheck(blah, blah.clone(), mod, 41, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(blah, blah.clone(), mod, 0, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(blah, blah.clone(), mod, 0, n_prime, IllegalArgumentException.class);
|
||||
|
||||
// Length odd
|
||||
testOneMontgomeryMultiplyCheck(small, small, mod, 39, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(small, small, mod, 0, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(small, small, mod, -1, n_prime, IllegalArgumentException.class);
|
||||
// As above, but for multiply
|
||||
testOneMontgomeryMultiplyCheck(small, small.clone(), mod, 39, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(small, small.clone(), mod, 0, n_prime, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(small, small.clone(), mod, -1, n_prime, IllegalArgumentException.class);
|
||||
|
||||
// array too small
|
||||
testOneMontgomeryMultiplyCheck(blah, blah, mod, 40, n_prime, small, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(blah, blah.clone(), mod, 40, n_prime, small, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(small, blah, mod, 40, n_prime, blah, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(blah, small, mod, 40, n_prime, blah, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(blah, blah, mod, 40, n_prime, small, IllegalArgumentException.class);
|
||||
testOneMontgomeryMultiplyCheck(small, small, mod, 40, n_prime, blah, IllegalArgumentException.class);
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
new MontgomeryMultiplyTest().testMontgomeryMultiplyChecks();
|
||||
new MontgomeryMultiplyTest().testResultValues();
|
||||
} catch (Throwable ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -47,16 +47,12 @@ public class SHAOptionsBase extends CommandLineOptionTest {
|
||||
// expressions, not just a plain strings.
|
||||
protected static final String SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE
|
||||
= "SHA instructions are not available on this CPU";
|
||||
protected static final String SHA1_INSTRUCTION_IS_NOT_AVAILABLE
|
||||
= "SHA1 instruction is not available on this CPU\\.";
|
||||
protected static final String SHA256_INSTRUCTION_IS_NOT_AVAILABLE
|
||||
= "SHA256 instruction \\(for SHA-224 and SHA-256\\) "
|
||||
+ "is not available on this CPU\\.";
|
||||
protected static final String SHA512_INSTRUCTION_IS_NOT_AVAILABLE
|
||||
= "SHA512 instruction \\(for SHA-384 and SHA-512\\) "
|
||||
+ "is not available on this CPU\\.";
|
||||
protected static final String SHA_INTRINSICS_ARE_NOT_AVAILABLE
|
||||
= "SHA intrinsics are not available on this CPU";
|
||||
protected static final String SHA1_INTRINSICS_ARE_NOT_AVAILABLE
|
||||
= "Intrinsics for SHA-1 crypto hash functions not available on this CPU.";
|
||||
protected static final String SHA256_INTRINSICS_ARE_NOT_AVAILABLE
|
||||
= "Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.";
|
||||
protected static final String SHA512_INTRINSICS_ARE_NOT_AVAILABLE
|
||||
= "Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.";
|
||||
|
||||
private final TestCase[] testCases;
|
||||
|
||||
@ -71,33 +67,23 @@ public class SHAOptionsBase extends CommandLineOptionTest {
|
||||
* instructions required by the option are not supported.
|
||||
*/
|
||||
protected static String getWarningForUnsupportedCPU(String optionName) {
|
||||
if (Platform.isSparc() || Platform.isAArch64()) {
|
||||
if (Platform.isSparc() || Platform.isAArch64() ||
|
||||
Platform.isX64() || Platform.isX86()) {
|
||||
switch (optionName) {
|
||||
case SHAOptionsBase.USE_SHA_OPTION:
|
||||
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
|
||||
case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
|
||||
return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
|
||||
case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
|
||||
return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
|
||||
case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
|
||||
return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
|
||||
default:
|
||||
throw new Error("Unexpected option " + optionName);
|
||||
}
|
||||
} else if (Platform.isX64() || Platform.isX86()) {
|
||||
switch (optionName) {
|
||||
case SHAOptionsBase.USE_SHA_OPTION:
|
||||
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
|
||||
case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
|
||||
case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
|
||||
case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
|
||||
return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;
|
||||
default:
|
||||
throw new Error("Unexpected option " + optionName);
|
||||
case SHAOptionsBase.USE_SHA_OPTION:
|
||||
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
|
||||
case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
|
||||
return SHAOptionsBase.SHA1_INTRINSICS_ARE_NOT_AVAILABLE;
|
||||
case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
|
||||
return SHAOptionsBase.SHA256_INTRINSICS_ARE_NOT_AVAILABLE;
|
||||
case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
|
||||
return SHAOptionsBase.SHA512_INTRINSICS_ARE_NOT_AVAILABLE;
|
||||
default:
|
||||
throw new Error("Unexpected option " + optionName);
|
||||
}
|
||||
} else {
|
||||
throw new Error("Support for CPUs other then X86 or SPARC is not "
|
||||
+ "implemented.");
|
||||
throw new Error("Support for CPUs different fromn X86, SPARC, and AARCH64 "
|
||||
+ "is not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,18 +64,20 @@ public class GenericTestCaseForSupportedCPU extends
|
||||
SHAOptionsBase.USE_SHA_OPTION, true),
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
|
||||
|
||||
// Verify that it is possible to enable the tested option and disable
|
||||
// all SHA intrinsics via -UseSHA without any warnings.
|
||||
CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
|
||||
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||
}, shouldPassMessage, String.format("It should be able to "
|
||||
+ "enable option '%s' even if %s was passed to JVM",
|
||||
optionName, CommandLineOptionTest.prepareBooleanFlag(
|
||||
SHAOptionsBase.USE_SHA_OPTION, false)),
|
||||
ExitCode.OK,
|
||||
CommandLineOptionTest.prepareBooleanFlag(
|
||||
SHAOptionsBase.USE_SHA_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||
if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) {
|
||||
// Verify that if -XX:-UseSHA is passed to the JVM, it is not possible
|
||||
// to enable the tested option and a warning is printed.
|
||||
CommandLineOptionTest.verifySameJVMStartup(
|
||||
new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) },
|
||||
null,
|
||||
shouldPassMessage,
|
||||
String.format("Enabling option '%s' should not be possible and should result in a warning if %s was passed to JVM",
|
||||
optionName,
|
||||
CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false)),
|
||||
ExitCode.OK,
|
||||
CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,14 +49,22 @@ public class GenericTestCaseForUnsupportedAArch64CPU extends
|
||||
}, shouldPassMessage, shouldPassMessage, ExitCode.OK,
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
|
||||
|
||||
shouldPassMessage = String.format("JVM should start with '-XX:+"
|
||||
+ "%s' flag, but output should contain warning.", optionName);
|
||||
// Verify that when the tested option is explicitly enabled, then
|
||||
// a warning will occur in VM output.
|
||||
CommandLineOptionTest.verifySameJVMStartup(new String[] {
|
||||
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||
}, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||
shouldPassMessage = String.format("If JVM is started with '-XX:-"
|
||||
+ "%s' '-XX:+%s', output should contain warning.",
|
||||
SHAOptionsBase.USE_SHA_OPTION, optionName);
|
||||
|
||||
// Verify that when the tested option is enabled, then
|
||||
// a warning will occur in VM output if UseSHA is disabled.
|
||||
if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) {
|
||||
CommandLineOptionTest.verifySameJVMStartup(
|
||||
new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) },
|
||||
null,
|
||||
shouldPassMessage,
|
||||
shouldPassMessage,
|
||||
ExitCode.OK,
|
||||
CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,6 +48,19 @@ public class GenericTestCaseForUnsupportedSparcCPU extends
|
||||
SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
|
||||
}, shouldPassMessage, shouldPassMessage, ExitCode.OK,
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, false));
|
||||
|
||||
// Verify that when the tested option is enabled, then
|
||||
// a warning will occur in VM output if UseSHA is disabled.
|
||||
if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) {
|
||||
CommandLineOptionTest.verifySameJVMStartup(
|
||||
new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) },
|
||||
null,
|
||||
shouldPassMessage,
|
||||
shouldPassMessage,
|
||||
ExitCode.OK,
|
||||
CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false),
|
||||
CommandLineOptionTest.prepareBooleanFlag(optionName, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -313,3 +313,5 @@ d5963ccce28d7a3e96ee3e2dc8a8676e61699b70 jdk9-b66
|
||||
82aae947938ec9b0119fdd78a616d0b7263072ee jdk9-b68
|
||||
f844a908d3308f47d73cf64e87c98d37d5d76ce8 jdk9-b69
|
||||
42180703e0a362c1de7cdbf61d2cbc6609e678c4 jdk9-b70
|
||||
a3200b88f259f904876b9ab13fd4c4ec2726f8ba jdk9-b71
|
||||
81e85f3b6174314155991048767452a9931e12e2 jdk9-b72
|
||||
|
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
package com.sun.org.apache.bcel.internal.util;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Apache" and "Apache Software Foundation" and
|
||||
* "Apache BCEL" must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* "Apache BCEL", nor may "Apache" appear in their name, without
|
||||
* prior written permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* Java interpreter replacement, i.e., wrapper that uses its own ClassLoader
|
||||
* to modify/generate classes as they're requested. You can take this as a template
|
||||
* for your own applications.<br>
|
||||
* Call this wrapper with
|
||||
* <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper <real.class.name> [arguments]</pre>
|
||||
* <p>
|
||||
* To use your own class loader you can set the "bcel.classloader" system property
|
||||
* which defaults to "com.sun.org.apache.bcel.internal.util.ClassLoader", e.g., with
|
||||
* <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper -Dbcel.classloader=foo.MyLoader <real.class.name> [arguments]</pre>
|
||||
* </p>
|
||||
*
|
||||
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
|
||||
* @see ClassLoader
|
||||
*/
|
||||
public class JavaWrapper {
|
||||
private java.lang.ClassLoader loader;
|
||||
|
||||
private static java.lang.ClassLoader getClassLoader() {
|
||||
String s = SecuritySupport.getSystemProperty("bcel.classloader");
|
||||
|
||||
if((s == null) || "".equals(s))
|
||||
s = "com.sun.org.apache.bcel.internal.util.ClassLoader";
|
||||
|
||||
try {
|
||||
return (java.lang.ClassLoader)Class.forName(s).newInstance();
|
||||
} catch(Exception e) {
|
||||
throw new RuntimeException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public JavaWrapper(java.lang.ClassLoader loader) {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
public JavaWrapper() {
|
||||
this(getClassLoader());
|
||||
}
|
||||
|
||||
/** Runs the _main method of the given class with the arguments passed in argv
|
||||
*
|
||||
* @param class_name the fully qualified class name
|
||||
* @param argv the arguments just as you would pass them directly
|
||||
*/
|
||||
public void runMain(String class_name, String[] argv) throws ClassNotFoundException
|
||||
{
|
||||
Class cl = loader.loadClass(class_name);
|
||||
Method method = null;
|
||||
|
||||
try {
|
||||
method = cl.getMethod("_main", new Class[] { argv.getClass() });
|
||||
|
||||
/* Method _main is sane ?
|
||||
*/
|
||||
int m = method.getModifiers();
|
||||
Class r = method.getReturnType();
|
||||
|
||||
if(!(Modifier.isPublic(m) && Modifier.isStatic(m)) ||
|
||||
Modifier.isAbstract(m) || (r != Void.TYPE))
|
||||
throw new NoSuchMethodException();
|
||||
} catch(NoSuchMethodException no) {
|
||||
System.out.println("In class " + class_name +
|
||||
": public static void _main(String[] argv) is not defined");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
method.invoke(null, new Object[] { argv });
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/** Default _main method used as wrapper, expects the fully qualified class name
|
||||
* of the real class as the first argument.
|
||||
*/
|
||||
public static void _main(String[] argv) throws Exception {
|
||||
/* Expects class name as first argument, other arguments are by-passed.
|
||||
*/
|
||||
if(argv.length == 0) {
|
||||
System.out.println("Missing class name.");
|
||||
return;
|
||||
}
|
||||
|
||||
String class_name = argv[0];
|
||||
String[] new_argv = new String[argv.length - 1];
|
||||
System.arraycopy(argv, 1, new_argv, 0, new_argv.length);
|
||||
|
||||
JavaWrapper wrapper = new JavaWrapper();
|
||||
wrapper.runMain(class_name, new_argv);
|
||||
}
|
||||
}
|
@ -22,20 +22,16 @@
|
||||
*/
|
||||
package com.sun.org.apache.xalan.internal.lib;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.extensions.ExpressionContext;
|
||||
import com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck;
|
||||
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 com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentFragment;
|
||||
@ -275,102 +271,6 @@ public class Extensions
|
||||
return tokenize(toTokenize, " \t\n\r");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Node of basic debugging information from the
|
||||
* EnvironmentCheck utility about the Java environment.
|
||||
*
|
||||
* <p>Simply calls the {@link com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck}
|
||||
* utility to grab info about the Java environment and CLASSPATH,
|
||||
* etc., and then returns the resulting Node. Stylesheets can
|
||||
* then maniuplate this data or simply xsl:copy-of the Node. Note
|
||||
* that we first attempt to load the more advanced
|
||||
* org.apache.env.Which utility by reflection; only if that fails
|
||||
* to we still use the internal version. Which is available from
|
||||
* <a href="http://xml.apache.org/commons/">http://xml.apache.org/commons/</a>.</p>
|
||||
*
|
||||
* <p>We throw a WrappedRuntimeException in the unlikely case
|
||||
* that reading information from the environment throws us an
|
||||
* exception. (Is this really the best thing to do?)</p>
|
||||
*
|
||||
* @param myContext an <code>ExpressionContext</code> passed in by the
|
||||
* extension mechanism. This must be an XPathContext.
|
||||
* @return a Node as described above.
|
||||
*/
|
||||
public static Node checkEnvironment(ExpressionContext myContext)
|
||||
{
|
||||
|
||||
Document factoryDocument = getDocument();
|
||||
|
||||
Node resultNode = null;
|
||||
try
|
||||
{
|
||||
// First use reflection to try to load Which, which is a
|
||||
// better version of EnvironmentCheck
|
||||
resultNode = checkEnvironmentUsingWhich(myContext, factoryDocument);
|
||||
|
||||
if (null != resultNode)
|
||||
return resultNode;
|
||||
|
||||
// If reflection failed, fallback to our internal EnvironmentCheck
|
||||
EnvironmentCheck envChecker = new EnvironmentCheck();
|
||||
Hashtable h = envChecker.getEnvironmentHash();
|
||||
resultNode = factoryDocument.createElement("checkEnvironmentExtension");
|
||||
envChecker.appendEnvironmentReport(resultNode, factoryDocument, h);
|
||||
envChecker = null;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(e);
|
||||
}
|
||||
|
||||
return resultNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private worker method to attempt to use org.apache.env.Which.
|
||||
*
|
||||
* @param myContext an <code>ExpressionContext</code> passed in by the
|
||||
* extension mechanism. This must be an XPathContext.
|
||||
* @param factoryDocument providing createElement services, etc.
|
||||
* @return a Node with environment info; null if any error
|
||||
*/
|
||||
private static Node checkEnvironmentUsingWhich(ExpressionContext myContext,
|
||||
Document factoryDocument)
|
||||
{
|
||||
final String WHICH_CLASSNAME = "org.apache.env.Which";
|
||||
final String WHICH_METHODNAME = "which";
|
||||
final Class WHICH_METHOD_ARGS[] = { java.util.Hashtable.class,
|
||||
java.lang.String.class,
|
||||
java.lang.String.class };
|
||||
try
|
||||
{
|
||||
// Use reflection to try to find xml-commons utility 'Which'
|
||||
Class clazz = ObjectFactory.findProviderClass(WHICH_CLASSNAME, true);
|
||||
if (null == clazz)
|
||||
return null;
|
||||
|
||||
// Fully qualify names since this is the only method they're used in
|
||||
java.lang.reflect.Method method = clazz.getMethod(WHICH_METHODNAME, WHICH_METHOD_ARGS);
|
||||
Hashtable report = new Hashtable();
|
||||
|
||||
// Call the method with our Hashtable, common options, and ignore return value
|
||||
Object[] methodArgs = { report, "XmlCommons;Xalan;Xerces;Crimson;Ant", "" };
|
||||
Object returnValue = method.invoke(null, methodArgs);
|
||||
|
||||
// Create a parent to hold the report and append hash to it
|
||||
Node resultNode = factoryDocument.createElement("checkEnvironmentExtension");
|
||||
com.sun.org.apache.xml.internal.utils.Hashtree2Node.appendHashToNode(report, "whichReport",
|
||||
resultNode, factoryDocument);
|
||||
|
||||
return resultNode;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
// Simply return null; no need to report error
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an instance of DOM Document
|
||||
*/
|
||||
|
@ -121,22 +121,7 @@ public class ObjectFactory {
|
||||
public static Object newInstance(String className, boolean doFallback)
|
||||
throws ConfigurationError
|
||||
{
|
||||
if (System.getSecurityManager()!=null) {
|
||||
return newInstance(className, null, doFallback);
|
||||
} else {
|
||||
return newInstance(className,
|
||||
findClassLoader (), doFallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of a class using the specified ClassLoader
|
||||
*/
|
||||
static Object newInstance(String className, ClassLoader cl,
|
||||
boolean doFallback)
|
||||
throws ConfigurationError
|
||||
{
|
||||
// assert(className != null);
|
||||
ClassLoader cl = System.getSecurityManager()!=null ? null : findClassLoader();
|
||||
try{
|
||||
Class providerClass = findProviderClass(className, cl, doFallback);
|
||||
Object instance = providerClass.newInstance();
|
||||
|
@ -1,171 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: Compile.java,v 1.2.4.1 2005/08/31 11:24:13 pvedula Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.cmdline;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt.GetOpt;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt.GetOptsException;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
* @author G. Todd Miller
|
||||
* @author Morten Jorgensen
|
||||
*/
|
||||
public final class Compile {
|
||||
|
||||
// Versioning numbers for the compiler -v option output
|
||||
private static int VERSION_MAJOR = 1;
|
||||
private static int VERSION_MINOR = 4;
|
||||
private static int VERSION_DELTA = 0;
|
||||
|
||||
|
||||
|
||||
// This variable should be set to false to prevent any methods in this
|
||||
// class from calling System.exit(). As this is a command-line tool,
|
||||
// calling System.exit() is normally OK, but we also want to allow for
|
||||
// this class being used in other ways as well.
|
||||
private static boolean _allowExit = true;
|
||||
|
||||
|
||||
public static void printUsage() {
|
||||
System.err.println("XSLTC version " +
|
||||
VERSION_MAJOR + "." + VERSION_MINOR +
|
||||
((VERSION_DELTA > 0) ? ("." + VERSION_DELTA) : ("")) + "\n" +
|
||||
new ErrorMsg(ErrorMsg.COMPILE_USAGE_STR));
|
||||
if (_allowExit) System.exit(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method implements the command line compiler. See the USAGE_STRING
|
||||
* constant for a description. It may make sense to move the command-line
|
||||
* handling to a separate package (ie. make one xsltc.cmdline.Compiler
|
||||
* class that contains this main() method and one xsltc.cmdline.Transform
|
||||
* class that contains the DefaultRun stuff).
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
boolean inputIsURL = false;
|
||||
boolean useStdIn = false;
|
||||
boolean classNameSet = false;
|
||||
final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv");
|
||||
if (args.length < 1) printUsage();
|
||||
|
||||
final XSLTC xsltc = new XSLTC(true, new FeatureManager());
|
||||
xsltc.init();
|
||||
|
||||
int c;
|
||||
while ((c = getopt.getNextOption()) != -1) {
|
||||
switch(c) {
|
||||
case 'i':
|
||||
useStdIn = true;
|
||||
break;
|
||||
case 'o':
|
||||
xsltc.setClassName(getopt.getOptionArg());
|
||||
classNameSet = true;
|
||||
break;
|
||||
case 'd':
|
||||
xsltc.setDestDirectory(getopt.getOptionArg());
|
||||
break;
|
||||
case 'p':
|
||||
xsltc.setPackageName(getopt.getOptionArg());
|
||||
break;
|
||||
case 'j':
|
||||
xsltc.setJarFileName(getopt.getOptionArg());
|
||||
break;
|
||||
case 'x':
|
||||
xsltc.setDebug(true);
|
||||
break;
|
||||
case 'u':
|
||||
inputIsURL = true;
|
||||
break;
|
||||
case 's':
|
||||
_allowExit = false;
|
||||
break;
|
||||
case 'n':
|
||||
xsltc.setTemplateInlining(true); // used to be 'false'
|
||||
break;
|
||||
case 'v':
|
||||
// fall through to case h
|
||||
case 'h':
|
||||
default:
|
||||
printUsage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean compileOK;
|
||||
|
||||
if (useStdIn) {
|
||||
if (!classNameSet) {
|
||||
System.err.println(new ErrorMsg(ErrorMsg.COMPILE_STDIN_ERR));
|
||||
if (_allowExit) System.exit(-1);
|
||||
}
|
||||
compileOK = xsltc.compile(System.in, xsltc.getClassName());
|
||||
}
|
||||
else {
|
||||
// Generate a vector containg URLs for all stylesheets specified
|
||||
final String[] stylesheetNames = getopt.getCmdArgs();
|
||||
final Vector stylesheetVector = new Vector();
|
||||
for (int i = 0; i < stylesheetNames.length; i++) {
|
||||
final String name = stylesheetNames[i];
|
||||
URL url;
|
||||
if (inputIsURL)
|
||||
url = new URL(name);
|
||||
else
|
||||
url = (new File(name)).toURI().toURL();
|
||||
stylesheetVector.addElement(url);
|
||||
}
|
||||
compileOK = xsltc.compile(stylesheetVector);
|
||||
}
|
||||
|
||||
// Compile the stylesheet and output class/jar file(s)
|
||||
if (compileOK) {
|
||||
xsltc.printWarnings();
|
||||
if (xsltc.getJarFileName() != null) xsltc.outputToJar();
|
||||
if (_allowExit) System.exit(0);
|
||||
}
|
||||
else {
|
||||
xsltc.printWarnings();
|
||||
xsltc.printErrors();
|
||||
if (_allowExit) System.exit(-1);
|
||||
}
|
||||
}
|
||||
catch (GetOptsException ex) {
|
||||
System.err.println(ex);
|
||||
printUsage(); // exits with code '-1'
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (_allowExit) System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,292 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: Transform.java,v 1.2.4.1 2005/09/12 09:07:33 pvedula Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.cmdline;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOMEnhancedForDTM;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.StripFilter;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.dom.DOMWSFilter;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.dom.XSLTCDTMManager;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.Constants;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.Parameter;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTMWSFilter;
|
||||
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Vector;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.transform.sax.SAXSource;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
* @author G. Todd Miller
|
||||
* @author Morten Jorgensen
|
||||
*/
|
||||
final public class Transform {
|
||||
|
||||
private SerializationHandler _handler;
|
||||
|
||||
private String _fileName;
|
||||
private String _className;
|
||||
private String _jarFileSrc;
|
||||
private boolean _isJarFileSpecified = false;
|
||||
private Vector _params = null;
|
||||
private boolean _uri, _debug;
|
||||
private int _iterations;
|
||||
|
||||
public Transform(String className, String fileName,
|
||||
boolean uri, boolean debug, int iterations) {
|
||||
_fileName = fileName;
|
||||
_className = className;
|
||||
_uri = uri;
|
||||
_debug = debug;
|
||||
_iterations = iterations;
|
||||
}
|
||||
|
||||
public String getFileName(){return _fileName;}
|
||||
public String getClassName(){return _className;}
|
||||
|
||||
public void setParameters(Vector params) {
|
||||
_params = params;
|
||||
}
|
||||
|
||||
private void setJarFileInputSrc(boolean flag, String jarFile) {
|
||||
// TODO: at this time we do not do anything with this
|
||||
// information, attempts to add the jarfile to the CLASSPATH
|
||||
// were successful via System.setProperty, but the effects
|
||||
// were not visible to the running JVM. For now we add jarfile
|
||||
// to CLASSPATH in the wrapper script that calls this program.
|
||||
_isJarFileSpecified = flag;
|
||||
// TODO verify jarFile exists...
|
||||
_jarFileSrc = jarFile;
|
||||
}
|
||||
|
||||
private void doTransform() {
|
||||
try {
|
||||
final Class clazz = ObjectFactory.findProviderClass(_className, true);
|
||||
final AbstractTranslet translet = (AbstractTranslet)clazz.newInstance();
|
||||
translet.postInitialization();
|
||||
|
||||
// Create a SAX parser and get the XMLReader object it uses
|
||||
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
try {
|
||||
factory.setFeature(Constants.NAMESPACE_FEATURE,true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
factory.setNamespaceAware(true);
|
||||
}
|
||||
final SAXParser parser = factory.newSAXParser();
|
||||
final XMLReader reader = parser.getXMLReader();
|
||||
|
||||
// Set the DOM's DOM builder as the XMLReader's SAX2 content handler
|
||||
XSLTCDTMManager dtmManager =
|
||||
XSLTCDTMManager.createNewDTMManagerInstance();
|
||||
|
||||
DTMWSFilter wsfilter;
|
||||
if (translet != null && translet instanceof StripFilter) {
|
||||
wsfilter = new DOMWSFilter(translet);
|
||||
} else {
|
||||
wsfilter = null;
|
||||
}
|
||||
|
||||
final DOMEnhancedForDTM dom =
|
||||
(DOMEnhancedForDTM)dtmManager.getDTM(
|
||||
new SAXSource(reader, new InputSource(_fileName)),
|
||||
false, wsfilter, true, false, translet.hasIdCall());
|
||||
|
||||
dom.setDocumentURI(_fileName);
|
||||
translet.prepassDocument(dom);
|
||||
|
||||
// Pass global parameters
|
||||
int n = _params.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Parameter param = (Parameter) _params.elementAt(i);
|
||||
translet.addParameter(param._name, param._value);
|
||||
}
|
||||
|
||||
// Transform the document
|
||||
TransletOutputHandlerFactory tohFactory =
|
||||
TransletOutputHandlerFactory.newInstance();
|
||||
tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
|
||||
tohFactory.setEncoding(translet._encoding);
|
||||
tohFactory.setOutputMethod(translet._method);
|
||||
|
||||
if (_iterations == -1) {
|
||||
translet.transform(dom, tohFactory.getSerializationHandler());
|
||||
}
|
||||
else if (_iterations > 0) {
|
||||
long mm = System.currentTimeMillis();
|
||||
for (int i = 0; i < _iterations; i++) {
|
||||
translet.transform(dom,
|
||||
tohFactory.getSerializationHandler());
|
||||
}
|
||||
mm = System.currentTimeMillis() - mm;
|
||||
|
||||
System.err.println("\n<!--");
|
||||
System.err.println(" transform = "
|
||||
+ (((double) mm) / ((double) _iterations))
|
||||
+ " ms");
|
||||
System.err.println(" throughput = "
|
||||
+ (1000.0 / (((double) mm)
|
||||
/ ((double) _iterations)))
|
||||
+ " tps");
|
||||
System.err.println("-->");
|
||||
}
|
||||
}
|
||||
catch (TransletException e) {
|
||||
if (_debug) e.printStackTrace();
|
||||
System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+
|
||||
e.getMessage());
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
if (_debug) e.printStackTrace();
|
||||
System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+
|
||||
e.getMessage());
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
if (_debug) e.printStackTrace();
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.FILE_NOT_FOUND_ERR, _fileName);
|
||||
System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+
|
||||
err.toString());
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
if (_debug) e.printStackTrace();
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, _fileName);
|
||||
System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+
|
||||
err.toString());
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
if (_debug) e.printStackTrace();
|
||||
ErrorMsg err= new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR,_className);
|
||||
System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+
|
||||
err.toString());
|
||||
}
|
||||
catch (UnknownHostException e) {
|
||||
if (_debug) e.printStackTrace();
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, _fileName);
|
||||
System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+
|
||||
err.toString());
|
||||
}
|
||||
catch (SAXException e) {
|
||||
Exception ex = e.getException();
|
||||
if (_debug) {
|
||||
if (ex != null) ex.printStackTrace();
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.err.print(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY));
|
||||
if (ex != null)
|
||||
System.err.println(ex.getMessage());
|
||||
else
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (_debug) e.printStackTrace();
|
||||
System.err.println(new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)+
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void printUsage() {
|
||||
System.err.println(new ErrorMsg(ErrorMsg.TRANSFORM_USAGE_STR));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
if (args.length > 0) {
|
||||
int i;
|
||||
int iterations = -1;
|
||||
boolean uri = false, debug = false;
|
||||
boolean isJarFileSpecified = false;
|
||||
String jarFile = null;
|
||||
|
||||
// Parse options starting with '-'
|
||||
for (i = 0; i < args.length && args[i].charAt(0) == '-'; i++) {
|
||||
if (args[i].equals("-u")) {
|
||||
uri = true;
|
||||
}
|
||||
else if (args[i].equals("-x")) {
|
||||
debug = true;
|
||||
}
|
||||
else if (args[i].equals("-j")) {
|
||||
isJarFileSpecified = true;
|
||||
jarFile = args[++i];
|
||||
}
|
||||
else if (args[i].equals("-n")) {
|
||||
try {
|
||||
iterations = Integer.parseInt(args[++i]);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
else {
|
||||
printUsage();
|
||||
}
|
||||
}
|
||||
|
||||
// Enough arguments left ?
|
||||
if (args.length - i < 2) printUsage();
|
||||
|
||||
// Get document file and class name
|
||||
Transform handler = new Transform(args[i+1], args[i], uri,
|
||||
debug, iterations);
|
||||
handler.setJarFileInputSrc(isJarFileSpecified, jarFile);
|
||||
|
||||
// Parse stylesheet parameters
|
||||
Vector params = new Vector();
|
||||
for (i += 2; i < args.length; i++) {
|
||||
final int equal = args[i].indexOf('=');
|
||||
if (equal > 0) {
|
||||
final String name = args[i].substring(0, equal);
|
||||
final String value = args[i].substring(equal+1);
|
||||
params.addElement(new Parameter(name, value));
|
||||
}
|
||||
else {
|
||||
printUsage();
|
||||
}
|
||||
}
|
||||
|
||||
if (i == args.length) {
|
||||
handler.setParameters(params);
|
||||
handler.doTransform();
|
||||
}
|
||||
} else {
|
||||
printUsage();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
258
jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/GetOpt.java
258
jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt/GetOpt.java
@ -1,258 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: GetOpt.java,v 1.2.4.1 2005/08/31 11:46:04 pvedula Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
|
||||
|
||||
/**
|
||||
* GetOpt is a Java equivalent to the C getopt() library function
|
||||
* discussed in man page getopt(3C). It provides command line
|
||||
* parsing for Java applications. It supports the most rules of the
|
||||
* command line standard (see man page intro(1)) including stacked
|
||||
* options such as '-sxm' (which is equivalent to -s -x -m); it
|
||||
* handles special '--' option that signifies the end of options.
|
||||
* Additionally this implementation of getopt will check for
|
||||
* mandatory arguments to options such as in the case of
|
||||
* '-d <file>' it will throw a MissingOptArgException if the
|
||||
* option argument '<file>' is not included on the commandline.
|
||||
* getopt(3C) does not check for this.
|
||||
* @author G Todd Miller
|
||||
*/
|
||||
public class GetOpt{
|
||||
public GetOpt(String[] args, String optString){
|
||||
theOptions = new ArrayList();
|
||||
int currOptIndex = 0;
|
||||
theCmdArgs = new ArrayList();
|
||||
theOptionMatcher = new OptionMatcher(optString);
|
||||
// fill in the options list
|
||||
for(int i=0; i<args.length; i++){
|
||||
String token = args[i];
|
||||
int tokenLength = token.length();
|
||||
if(token.equals("--")){ // end of opts
|
||||
currOptIndex = i+1; // set index of first operand
|
||||
break; // end of options
|
||||
}
|
||||
else if(token.startsWith("-") && tokenLength == 2){
|
||||
// simple option token such as '-s' found
|
||||
theOptions.add(new Option(token.charAt(1)));
|
||||
}
|
||||
else if(token.startsWith("-") && tokenLength > 2){
|
||||
// stacked options found, such as '-shm'
|
||||
// iterate thru the tokens after the dash and
|
||||
// add them to theOptions list
|
||||
for(int j=1; j<tokenLength; j++){
|
||||
theOptions.add(new Option(token.charAt(j)));
|
||||
}
|
||||
}
|
||||
else if(!token.startsWith("-")){
|
||||
// case 1- there are not options stored yet therefore
|
||||
// this must be an command argument, not an option argument
|
||||
if(theOptions.size() == 0){
|
||||
currOptIndex = i;
|
||||
break; // stop processing options
|
||||
}
|
||||
else {
|
||||
// case 2-
|
||||
// there are options stored, check to see if
|
||||
// this arg belong to the last arg stored
|
||||
int indexoflast=0;
|
||||
indexoflast = theOptions.size()-1;
|
||||
Option op = (Option)theOptions.get(indexoflast);
|
||||
char opLetter = op.getArgLetter();
|
||||
if(!op.hasArg() && theOptionMatcher.hasArg(opLetter)){
|
||||
op.setArg(token);
|
||||
}
|
||||
else{
|
||||
// case 3 -
|
||||
// the last option stored does not take
|
||||
// an argument, so again, this argument
|
||||
// must be a command argument, not
|
||||
// an option argument
|
||||
currOptIndex = i;
|
||||
break; // end of options
|
||||
}
|
||||
}
|
||||
}// end option does not start with "-"
|
||||
} // end for args loop
|
||||
|
||||
// attach an iterator to list of options
|
||||
theOptionsIterator = theOptions.listIterator();
|
||||
|
||||
// options are done, now fill out cmd arg list with remaining args
|
||||
for(int i=currOptIndex; i<args.length; i++){
|
||||
String token = args[i];
|
||||
theCmdArgs.add(token);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* debugging routine to print out all options collected
|
||||
*/
|
||||
public void printOptions(){
|
||||
for(ListIterator it=theOptions.listIterator(); it.hasNext();){
|
||||
Option opt = (Option)it.next();
|
||||
System.out.print("OPT =" + opt.getArgLetter());
|
||||
String arg = opt.getArgument();
|
||||
if(arg != null){
|
||||
System.out.print(" " + arg);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the next option found in the commandline. Distinguishes
|
||||
* between two bad cases, one case is when an illegal option
|
||||
* is found, and then other case is when an option takes an
|
||||
* argument but no argument was found for that option.
|
||||
* If the option found was not declared in the optString, then
|
||||
* an IllegalArgumentException will be thrown (case 1).
|
||||
* If the next option found has been declared to take an argument,
|
||||
* and no such argument exists, then a MissingOptArgException
|
||||
* is thrown (case 2).
|
||||
* @param none
|
||||
* @return int - the next option found.
|
||||
* @throws IllegalArgumentException, MissingOptArgException.
|
||||
*/
|
||||
public int getNextOption() throws IllegalArgumentException,
|
||||
MissingOptArgException
|
||||
{
|
||||
int retval = -1;
|
||||
if(theOptionsIterator.hasNext()){
|
||||
theCurrentOption = (Option)theOptionsIterator.next();
|
||||
char c = theCurrentOption.getArgLetter();
|
||||
boolean shouldHaveArg = theOptionMatcher.hasArg(c);
|
||||
String arg = theCurrentOption.getArgument();
|
||||
if(!theOptionMatcher.match(c)) {
|
||||
ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR,
|
||||
new Character(c));
|
||||
throw (new IllegalArgumentException(msg.toString()));
|
||||
}
|
||||
else if(shouldHaveArg && (arg == null)) {
|
||||
ErrorMsg msg = new ErrorMsg(ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR,
|
||||
new Character(c));
|
||||
throw (new MissingOptArgException(msg.toString()));
|
||||
}
|
||||
retval = c;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the argument for the current parsed option. For example,
|
||||
* in case of '-d <file>', if current option parsed is 'd' then
|
||||
* getOptionArg() would return '<file>'.
|
||||
* @return String - argument for current parsed option.
|
||||
* @param none
|
||||
*/
|
||||
public String getOptionArg(){
|
||||
String retval = null;
|
||||
String tmp = theCurrentOption.getArgument();
|
||||
char c = theCurrentOption.getArgLetter();
|
||||
if(theOptionMatcher.hasArg(c)){
|
||||
retval = tmp;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets list of the commandline arguments. For example, in command
|
||||
* such as 'cmd -s -d file file2 file3 file4' with the usage
|
||||
* 'cmd [-s] [-d <file>] <file>...', getCmdArgs() would return
|
||||
* the list {file2, file3, file4}.
|
||||
* @return String[] - list of command arguments that may appear
|
||||
* after options and option arguments.
|
||||
* @params none
|
||||
*/
|
||||
public String[] getCmdArgs(){
|
||||
String[] retval = new String[theCmdArgs.size()];
|
||||
int i=0;
|
||||
for(ListIterator it=theCmdArgs.listIterator(); it.hasNext();){
|
||||
retval[i++] = (String)it.next();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
private Option theCurrentOption = null;
|
||||
private ListIterator theOptionsIterator;
|
||||
private List theOptions = null;
|
||||
private List theCmdArgs = null;
|
||||
private OptionMatcher theOptionMatcher = null;
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
//
|
||||
// Inner Classes
|
||||
//
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// inner class to model an option
|
||||
class Option{
|
||||
private char theArgLetter;
|
||||
private String theArgument = null;
|
||||
public Option(char argLetter) { theArgLetter = argLetter; }
|
||||
public void setArg(String arg) {
|
||||
theArgument = arg;
|
||||
}
|
||||
public boolean hasArg() { return (theArgument != null); }
|
||||
public char getArgLetter() { return theArgLetter; }
|
||||
public String getArgument() { return theArgument; }
|
||||
} // end class Option
|
||||
|
||||
|
||||
// inner class to query optString for a possible option match,
|
||||
// and whether or not a given legal option takes an argument.
|
||||
//
|
||||
class OptionMatcher{
|
||||
public OptionMatcher(String optString){
|
||||
theOptString = optString;
|
||||
}
|
||||
public boolean match(char c){
|
||||
boolean retval = false;
|
||||
if(theOptString.indexOf(c) != -1){
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
public boolean hasArg(char c){
|
||||
boolean retval = false;
|
||||
int index = theOptString.indexOf(c)+1;
|
||||
if (index == theOptString.length()){
|
||||
// reached end of theOptString
|
||||
retval = false;
|
||||
}
|
||||
else if(theOptString.charAt(index) == ':'){
|
||||
retval = true;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
private String theOptString = null;
|
||||
} // end class OptionMatcher
|
||||
}// end class GetOpt
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: GetOptsException.java,v 1.2.4.1 2005/08/31 11:47:06 pvedula Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt;
|
||||
|
||||
/**
|
||||
* @author G Todd Miller
|
||||
*/
|
||||
public class GetOptsException extends Exception{
|
||||
static final long serialVersionUID = 8736874967183039804L;
|
||||
public GetOptsException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: IllegalArgumentException.java,v 1.2.4.1 2005/08/31 11:47:56 pvedula Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt;
|
||||
|
||||
|
||||
class IllegalArgumentException extends GetOptsException{
|
||||
static final long serialVersionUID = 8642122427294793651L;
|
||||
public IllegalArgumentException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: MissingOptArgException.java,v 1.2.4.1 2005/08/31 11:49:21 pvedula Exp $
|
||||
*/
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt;
|
||||
|
||||
|
||||
/**
|
||||
* @author G Todd Miller
|
||||
*/
|
||||
class MissingOptArgException extends GetOptsException{
|
||||
static final long serialVersionUID = -1972471465394544822L;
|
||||
public MissingOptArgException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -1,455 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: SmartTransformerFactoryImpl.java,v 1.2.4.1 2005/09/14 09:57:13 pvedula Exp $
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
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.URIResolver;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.sax.SAXTransformerFactory;
|
||||
import javax.xml.transform.sax.TemplatesHandler;
|
||||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import org.xml.sax.XMLFilter;
|
||||
|
||||
/**
|
||||
* Implementation of a transformer factory that uses an XSLTC
|
||||
* transformer factory for the creation of Templates objects
|
||||
* and uses the Xalan processor transformer factory for the
|
||||
* creation of Transformer objects.
|
||||
* @author G. Todd Miller
|
||||
*/
|
||||
public class SmartTransformerFactoryImpl extends SAXTransformerFactory
|
||||
{
|
||||
/**
|
||||
* <p>Name of class as a constant to use for debugging.</p>
|
||||
*/
|
||||
private static final String CLASS_NAME = "SmartTransformerFactoryImpl";
|
||||
|
||||
private SAXTransformerFactory _xsltcFactory = null;
|
||||
private SAXTransformerFactory _xalanFactory = null;
|
||||
private SAXTransformerFactory _currFactory = null;
|
||||
private ErrorListener _errorlistener = null;
|
||||
private URIResolver _uriresolver = null;
|
||||
|
||||
/**
|
||||
* <p>State of secure processing feature.</p>
|
||||
*/
|
||||
private boolean featureSecureProcessing = false;
|
||||
|
||||
/**
|
||||
* implementation of the SmartTransformerFactory. This factory
|
||||
* uses com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory
|
||||
* to return Templates objects; and uses
|
||||
* com.sun.org.apache.xalan.internal.processor.TransformerFactory
|
||||
* to return Transformer objects.
|
||||
*/
|
||||
public SmartTransformerFactoryImpl() { }
|
||||
|
||||
private void createXSLTCTransformerFactory() {
|
||||
_xsltcFactory = new TransformerFactoryImpl();
|
||||
_currFactory = _xsltcFactory;
|
||||
}
|
||||
|
||||
private void createXalanTransformerFactory() {
|
||||
final String xalanMessage =
|
||||
"com.sun.org.apache.xalan.internal.xsltc.trax.SmartTransformerFactoryImpl "+
|
||||
"could not create an "+
|
||||
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl.";
|
||||
// try to create instance of Xalan factory...
|
||||
try {
|
||||
Class xalanFactClass = ObjectFactory.findProviderClass(
|
||||
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl",
|
||||
true);
|
||||
_xalanFactory = (SAXTransformerFactory)
|
||||
xalanFactClass.newInstance();
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
System.err.println(xalanMessage);
|
||||
}
|
||||
catch (InstantiationException e) {
|
||||
System.err.println(xalanMessage);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
System.err.println(xalanMessage);
|
||||
}
|
||||
_currFactory = _xalanFactory;
|
||||
}
|
||||
|
||||
public void setErrorListener(ErrorListener listener)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
_errorlistener = listener;
|
||||
}
|
||||
|
||||
public ErrorListener getErrorListener() {
|
||||
return _errorlistener;
|
||||
}
|
||||
|
||||
public Object getAttribute(String name)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
// GTM: NB: 'debug' should change to something more unique...
|
||||
if ((name.equals("translet-name")) || (name.equals("debug"))) {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
return _xsltcFactory.getAttribute(name);
|
||||
}
|
||||
else {
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
return _xalanFactory.getAttribute(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAttribute(String name, Object value)
|
||||
throws IllegalArgumentException {
|
||||
// GTM: NB: 'debug' should change to something more unique...
|
||||
if ((name.equals("translet-name")) || (name.equals("debug"))) {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
_xsltcFactory.setAttribute(name, value);
|
||||
}
|
||||
else {
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
_xalanFactory.setAttribute(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set a feature for this <code>SmartTransformerFactory</code> and <code>Transformer</code>s
|
||||
* or <code>Template</code>s created by this factory.</p>
|
||||
*
|
||||
* <p>
|
||||
* Feature names are fully qualified {@link java.net.URI}s.
|
||||
* Implementations may define their own features.
|
||||
* An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the
|
||||
* <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
|
||||
* It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
|
||||
* </p>
|
||||
*
|
||||
* <p>See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.</p>
|
||||
*
|
||||
* @param name Feature name.
|
||||
* @param value Is feature state <code>true</code> or <code>false</code>.
|
||||
*
|
||||
* @throws TransformerConfigurationException if this <code>TransformerFactory</code>
|
||||
* or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature.
|
||||
* @throws NullPointerException If the <code>name</code> parameter is null.
|
||||
*/
|
||||
public void setFeature(String name, boolean value)
|
||||
throws TransformerConfigurationException {
|
||||
|
||||
// feature name cannot be null
|
||||
if (name == null) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
|
||||
throw new NullPointerException(err.toString());
|
||||
}
|
||||
// secure processing?
|
||||
else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
||||
featureSecureProcessing = value;
|
||||
// all done processing feature
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// unknown feature
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
|
||||
throw new TransformerConfigurationException(err.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* javax.xml.transform.sax.TransformerFactory implementation.
|
||||
* Look up the value of a feature (to see if it is supported).
|
||||
* This method must be updated as the various methods and features of this
|
||||
* class are implemented.
|
||||
*
|
||||
* @param name The feature name
|
||||
* @return 'true' if feature is supported, 'false' if not
|
||||
*/
|
||||
public boolean getFeature(String name) {
|
||||
// All supported features should be listed here
|
||||
String[] features = {
|
||||
DOMSource.FEATURE,
|
||||
DOMResult.FEATURE,
|
||||
SAXSource.FEATURE,
|
||||
SAXResult.FEATURE,
|
||||
StreamSource.FEATURE,
|
||||
StreamResult.FEATURE
|
||||
};
|
||||
|
||||
// feature name cannot be null
|
||||
if (name == null) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
|
||||
throw new NullPointerException(err.toString());
|
||||
}
|
||||
|
||||
// Inefficient, but it really does not matter in a function like this
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
if (name.equals(features[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
// secure processing?
|
||||
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
||||
return featureSecureProcessing;
|
||||
}
|
||||
|
||||
// unknown feature
|
||||
return false;
|
||||
}
|
||||
|
||||
public URIResolver getURIResolver() {
|
||||
return _uriresolver;
|
||||
}
|
||||
|
||||
public void setURIResolver(URIResolver resolver) {
|
||||
_uriresolver = resolver;
|
||||
}
|
||||
|
||||
public Source getAssociatedStylesheet(Source source, String media,
|
||||
String title, String charset)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_currFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
return _currFactory.getAssociatedStylesheet(source, media,
|
||||
title, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Transformer object that copies the input document to the
|
||||
* result. Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
* @return A Transformer object.
|
||||
*/
|
||||
public Transformer newTransformer()
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
_currFactory = _xalanFactory;
|
||||
return _currFactory.newTransformer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Transformer object that from the input stylesheet
|
||||
* Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
* @param source the stylesheet.
|
||||
* @return A Transformer object.
|
||||
*/
|
||||
public Transformer newTransformer(Source source) throws
|
||||
TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
_currFactory = _xalanFactory;
|
||||
return _currFactory.newTransformer(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Templates object that from the input stylesheet
|
||||
* Uses the com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
* @param source the stylesheet.
|
||||
* @return A Templates object.
|
||||
*/
|
||||
public Templates newTemplates(Source source)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
_currFactory = _xsltcFactory;
|
||||
return _currFactory.newTemplates(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a TemplatesHandler object that can process SAX ContentHandler
|
||||
* events into a Templates object. Uses the
|
||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public TemplatesHandler newTemplatesHandler()
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xsltcFactory.newTemplatesHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
||||
* events based on a copy transformer.
|
||||
* Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
*/
|
||||
public TransformerHandler newTransformerHandler()
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xalanFactory.newTransformerHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
||||
* events based on a transformer specified by the stylesheet Source.
|
||||
* Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
*/
|
||||
public TransformerHandler newTransformerHandler(Source src)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xalanFactory.newTransformerHandler(src);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
||||
* events based on a transformer specified by the stylesheet Source.
|
||||
* Uses com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public TransformerHandler newTransformerHandler(Templates templates)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xsltcFactory.newTransformerHandler(templates);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create an XMLFilter that uses the given source as the
|
||||
* transformation instructions. Uses
|
||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public XMLFilter newXMLFilter(Source src)
|
||||
throws TransformerConfigurationException {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
Templates templates = _xsltcFactory.newTemplates(src);
|
||||
if (templates == null ) return null;
|
||||
return newXMLFilter(templates);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an XMLFilter that uses the given source as the
|
||||
* transformation instructions. Uses
|
||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public XMLFilter newXMLFilter(Templates templates)
|
||||
throws TransformerConfigurationException {
|
||||
try {
|
||||
return new com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter(templates);
|
||||
}
|
||||
catch(TransformerConfigurationException e1) {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
ErrorListener errorListener = _xsltcFactory.getErrorListener();
|
||||
if(errorListener != null) {
|
||||
try {
|
||||
errorListener.fatalError(e1);
|
||||
return null;
|
||||
}
|
||||
catch( TransformerException e2) {
|
||||
new TransformerConfigurationException(e2);
|
||||
}
|
||||
}
|
||||
throw e1;
|
||||
}
|
||||
}
|
||||
}
|
@ -371,11 +371,7 @@ public class CoreDOMImplementationImpl
|
||||
// to restrict the number of validation handlers being
|
||||
// requested
|
||||
if(freeValidatorIndex < 0) {
|
||||
return (RevalidationHandler) (ObjectFactory
|
||||
.newInstance(
|
||||
"com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator",
|
||||
ObjectFactory.findClassLoader(),
|
||||
true));
|
||||
return new com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator();
|
||||
}
|
||||
// return first available validator
|
||||
RevalidationHandler val = validators[freeValidatorIndex];
|
||||
@ -384,11 +380,7 @@ public class CoreDOMImplementationImpl
|
||||
}
|
||||
else if(schemaType == XMLGrammarDescription.XML_DTD) {
|
||||
if(freeDTDValidatorIndex < 0) {
|
||||
return (RevalidationHandler) (ObjectFactory
|
||||
.newInstance(
|
||||
"com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator",
|
||||
ObjectFactory.findClassLoader(),
|
||||
true));
|
||||
return new com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator();
|
||||
}
|
||||
// return first available validator
|
||||
RevalidationHandler val = dtdValidators[freeDTDValidatorIndex];
|
||||
|
@ -638,7 +638,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
// set preference for redirection
|
||||
followRedirects = httpInputSource.getFollowHTTPRedirects();
|
||||
if (!followRedirects) {
|
||||
setInstanceFollowRedirects(urlConnection, followRedirects);
|
||||
urlConnection.setInstanceFollowRedirects(followRedirects);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2192,20 +2192,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
|
||||
} // expandSystemIdStrictOn(String,String):String
|
||||
|
||||
/**
|
||||
* Attempt to set whether redirects will be followed for an <code>HttpURLConnection</code>.
|
||||
* This may fail on earlier JDKs which do not support setting this preference.
|
||||
*/
|
||||
public static void setInstanceFollowRedirects(HttpURLConnection urlCon, boolean followRedirects) {
|
||||
try {
|
||||
Method method = HttpURLConnection.class.getMethod("setInstanceFollowRedirects", new Class[] {Boolean.TYPE});
|
||||
method.invoke(urlCon, new Object[] {followRedirects ? Boolean.TRUE : Boolean.FALSE});
|
||||
}
|
||||
// setInstanceFollowRedirects doesn't exist.
|
||||
catch (Exception exc) {}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for expandSystemId(String,String,boolean):String
|
||||
*/
|
||||
|
@ -845,13 +845,7 @@ public class DOMUtil {
|
||||
*/
|
||||
public static DOMException createDOMException(short code, Throwable cause) {
|
||||
DOMException de = new DOMException(code, cause != null ? cause.getMessage() : null);
|
||||
if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
|
||||
try {
|
||||
ThrowableMethods.fgThrowableInitCauseMethod.invoke(de, new Object [] {cause});
|
||||
}
|
||||
// Something went wrong. There's not much we can do about it.
|
||||
catch (Exception e) {}
|
||||
}
|
||||
if (cause != null) de.initCause(cause);
|
||||
return de;
|
||||
}
|
||||
|
||||
@ -860,42 +854,8 @@ public class DOMUtil {
|
||||
*/
|
||||
public static LSException createLSException(short code, Throwable cause) {
|
||||
LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
|
||||
if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
|
||||
try {
|
||||
ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
|
||||
}
|
||||
// Something went wrong. There's not much we can do about it.
|
||||
catch (Exception e) {}
|
||||
}
|
||||
if (cause != null) lse.initCause(cause);
|
||||
return lse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of methods from java.lang.Throwable.
|
||||
*/
|
||||
static class ThrowableMethods {
|
||||
|
||||
// Method: java.lang.Throwable.initCause(java.lang.Throwable)
|
||||
private static java.lang.reflect.Method fgThrowableInitCauseMethod = null;
|
||||
|
||||
// Flag indicating whether or not Throwable methods available.
|
||||
private static boolean fgThrowableMethodsAvailable = false;
|
||||
|
||||
private ThrowableMethods() {}
|
||||
|
||||
// Attempt to get methods for java.lang.Throwable on class initialization.
|
||||
static {
|
||||
try {
|
||||
fgThrowableInitCauseMethod = Throwable.class.getMethod("initCause", new Class [] {Throwable.class});
|
||||
fgThrowableMethodsAvailable = true;
|
||||
}
|
||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot use java.lang.Throwable.initCause(java.lang.Throwable).
|
||||
catch (Exception exc) {
|
||||
fgThrowableInitCauseMethod = null;
|
||||
fgThrowableMethodsAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // class DOMUtil
|
||||
|
2
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeTextReader.java
2
jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/xinclude/XIncludeTextReader.java
@ -140,7 +140,7 @@ public class XIncludeTextReader {
|
||||
// set preference for redirection
|
||||
boolean followRedirects = httpInputSource.getFollowHTTPRedirects();
|
||||
if (!followRedirects) {
|
||||
XMLEntityManager.setInstanceFollowRedirects(urlConnection, followRedirects);
|
||||
urlConnection.setInstanceFollowRedirects(followRedirects);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,63 +323,5 @@ public class DTMException extends RuntimeException {
|
||||
super.printStackTrace(s);
|
||||
} catch (Throwable e) {}
|
||||
|
||||
boolean isJdk14OrHigher = false;
|
||||
try {
|
||||
Throwable.class.getMethod("getCause", (Class[]) null);
|
||||
isJdk14OrHigher = true;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
// The printStackTrace method of the Throwable class in jdk 1.4
|
||||
// and higher will include the cause when printing the backtrace.
|
||||
// The following code is only required when using jdk 1.3 or lower
|
||||
if (!isJdk14OrHigher) {
|
||||
Throwable exception = getException();
|
||||
|
||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||
s.println("---------");
|
||||
|
||||
try {
|
||||
if (exception instanceof DTMException) {
|
||||
String locInfo =
|
||||
((DTMException) exception)
|
||||
.getLocationAsString();
|
||||
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
}
|
||||
|
||||
exception.printStackTrace(s);
|
||||
} catch (Throwable e) {
|
||||
s.println("Could not print stack trace...");
|
||||
}
|
||||
|
||||
try {
|
||||
Method meth =
|
||||
((Object) exception).getClass().getMethod("getException",
|
||||
(Class[]) null);
|
||||
|
||||
if (null != meth) {
|
||||
Throwable prev = exception;
|
||||
|
||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
||||
|
||||
if (prev == exception) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
exception = null;
|
||||
}
|
||||
} catch (InvocationTargetException ite) {
|
||||
exception = null;
|
||||
} catch (IllegalAccessException iae) {
|
||||
exception = null;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
exception = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -348,8 +348,7 @@ public class DTMManagerDefault extends DTMManager
|
||||
if (haveXercesParser) {
|
||||
// IncrementalSAXSource_Xerces to avoid threading.
|
||||
try {
|
||||
coParser =(IncrementalSAXSource)
|
||||
Class.forName("com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces").newInstance();
|
||||
coParser = new com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces();
|
||||
} catch( Exception ex ) {
|
||||
ex.printStackTrace();
|
||||
coParser=null;
|
||||
|
@ -87,6 +87,9 @@ public class IncrementalSAXSource_Xerces
|
||||
{
|
||||
try
|
||||
{
|
||||
// This should be cleaned up and the use of reflection
|
||||
// removed - see JDK-8129880
|
||||
|
||||
// Xerces-2 incremental parsing support (as of Beta 3)
|
||||
// ContentHandlers still get set on fIncrementalParser (to get
|
||||
// conversion from XNI events to SAX events), but
|
||||
|
@ -233,7 +233,13 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
||||
}
|
||||
parser.parse(new InputSource(is), spHandler);
|
||||
} else {
|
||||
Parser parser = (Parser) ReflectUtil.forName(parserClass).newInstance();
|
||||
Class<?> c = ReflectUtil.forName(parserClass);
|
||||
if (!Parser.class.isAssignableFrom(c)) {
|
||||
throw new ClassCastException(parserClass
|
||||
+ " cannot be cast to "
|
||||
+ Parser.class.getName());
|
||||
}
|
||||
Parser parser = (Parser) c.newInstance();
|
||||
parser.setDocumentHandler(this);
|
||||
if (bResolver != null) {
|
||||
parser.setEntityResolver(bResolver);
|
||||
|
32
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java
32
jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/BaseMarkupSerializer.java
@ -1220,37 +1220,13 @@ public abstract class BaseMarkupSerializer
|
||||
if ( internal != null && internal.length() > 0 )
|
||||
_printer.printText( internal );
|
||||
endDTD();
|
||||
}
|
||||
// DOM Level 1 -- does implementation have methods?
|
||||
catch (NoSuchMethodError nsme) {
|
||||
Class docTypeClass = docType.getClass();
|
||||
|
||||
String docTypePublicId = null;
|
||||
String docTypeSystemId = null;
|
||||
try {
|
||||
java.lang.reflect.Method getPublicId = docTypeClass.getMethod("getPublicId", (Class[]) null);
|
||||
if (getPublicId.getReturnType().equals(String.class)) {
|
||||
docTypePublicId = (String)getPublicId.invoke(docType, (Object[]) null);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
java.lang.reflect.Method getSystemId = docTypeClass.getMethod("getSystemId", (Class[]) null);
|
||||
if (getSystemId.getReturnType().equals(String.class)) {
|
||||
docTypeSystemId = (String)getSystemId.invoke(docType, (Object[]) null);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
_printer.enterDTD();
|
||||
_docTypePublicId = docTypePublicId;
|
||||
_docTypeSystemId = docTypeSystemId;
|
||||
_docTypePublicId = null;
|
||||
_docTypeSystemId = null;
|
||||
endDTD();
|
||||
}
|
||||
|
||||
serializeDTD(docType.getName());
|
||||
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.ProcessingInstruction;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.ls.LSException;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
import org.w3c.dom.ls.LSSerializer;
|
||||
@ -1030,15 +1029,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
private String _getXmlVersion(Node node) {
|
||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||
? (Document) node : node.getOwnerDocument();
|
||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
||||
if (doc != null) {
|
||||
try {
|
||||
return (String) DocumentMethods.fgDocumentGetXmlVersionMethod.invoke(doc, (Object[]) null);
|
||||
return doc.getXmlVersion();
|
||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||
catch (VirtualMachineError vme) {
|
||||
catch (VirtualMachineError | ThreadDeath vme) {
|
||||
throw vme;
|
||||
} // ThreadDeath should always be re-thrown
|
||||
catch (ThreadDeath td) {
|
||||
throw td;
|
||||
} // Ignore all other exceptions and errors
|
||||
catch (Throwable t) {
|
||||
}
|
||||
@ -1049,15 +1045,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
private String _getInputEncoding(Node node) {
|
||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||
? (Document) node : node.getOwnerDocument();
|
||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
||||
if (doc != null) {
|
||||
try {
|
||||
return (String) DocumentMethods.fgDocumentGetInputEncodingMethod.invoke(doc, (Object[]) null);
|
||||
return doc.getInputEncoding();
|
||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||
catch (VirtualMachineError vme) {
|
||||
catch (VirtualMachineError | ThreadDeath vme) {
|
||||
throw vme;
|
||||
} // ThreadDeath should always be re-thrown
|
||||
catch (ThreadDeath td) {
|
||||
throw td;
|
||||
} // Ignore all other exceptions and errors
|
||||
catch (Throwable t) {
|
||||
}
|
||||
@ -1068,15 +1061,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
private String _getXmlEncoding(Node node) {
|
||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||
? (Document) node : node.getOwnerDocument();
|
||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
||||
if (doc != null) {
|
||||
try {
|
||||
return (String) DocumentMethods.fgDocumentGetXmlEncodingMethod.invoke(doc, (Object[]) null);
|
||||
return doc.getXmlEncoding();
|
||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||
catch (VirtualMachineError vme) {
|
||||
catch (VirtualMachineError | ThreadDeath vme) {
|
||||
throw vme;
|
||||
} // ThreadDeath should always be re-thrown
|
||||
catch (ThreadDeath td) {
|
||||
throw td;
|
||||
} // Ignore all other exceptions and errors
|
||||
catch (Throwable t) {
|
||||
}
|
||||
@ -1084,42 +1074,4 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of DOM Level 3 methods from org.w3c.dom.Document.
|
||||
*/
|
||||
static class DocumentMethods {
|
||||
|
||||
// Method: org.w3c.dom.Document.getXmlVersion()
|
||||
private static java.lang.reflect.Method fgDocumentGetXmlVersionMethod = null;
|
||||
|
||||
// Method: org.w3c.dom.Document.getInputEncoding()
|
||||
private static java.lang.reflect.Method fgDocumentGetInputEncodingMethod = null;
|
||||
|
||||
// Method: org.w3c.dom.Document.getXmlEncoding()
|
||||
private static java.lang.reflect.Method fgDocumentGetXmlEncodingMethod = null;
|
||||
|
||||
// Flag indicating whether or not Document methods are available.
|
||||
private static boolean fgDocumentMethodsAvailable = false;
|
||||
|
||||
private DocumentMethods() {
|
||||
}
|
||||
|
||||
// Attempt to get methods for org.w3c.dom.Document on class initialization.
|
||||
static {
|
||||
try {
|
||||
fgDocumentGetXmlVersionMethod = Document.class.getMethod("getXmlVersion", new Class[]{});
|
||||
fgDocumentGetInputEncodingMethod = Document.class.getMethod("getInputEncoding", new Class[]{});
|
||||
fgDocumentGetXmlEncodingMethod = Document.class.getMethod("getXmlEncoding", new Class[]{});
|
||||
fgDocumentMethodsAvailable = true;
|
||||
} // ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot retrieve the methods.
|
||||
catch (Exception exc) {
|
||||
fgDocumentGetXmlVersionMethod = null;
|
||||
fgDocumentGetInputEncodingMethod = null;
|
||||
fgDocumentGetXmlEncodingMethod = null;
|
||||
fgDocumentMethodsAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //DOMSerializerImpl
|
||||
|
@ -26,6 +26,8 @@ import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import com.sun.org.apache.xerces.internal.util.EncodingMap;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
/**
|
||||
* This class represents an encoding.
|
||||
@ -37,9 +39,6 @@ import com.sun.org.apache.xerces.internal.util.EncodingMap;
|
||||
*/
|
||||
public class EncodingInfo {
|
||||
|
||||
// An array to hold the argument for a method of Charset, CharsetEncoder or CharToByteConverter.
|
||||
private Object [] fArgsForMethod = null;
|
||||
|
||||
// name of encoding as registered with IANA;
|
||||
// preferably a MIME name, but aliases are fine too.
|
||||
String ianaName;
|
||||
@ -47,15 +46,7 @@ public class EncodingInfo {
|
||||
int lastPrintable;
|
||||
|
||||
// The CharsetEncoder with which we test unusual characters.
|
||||
Object fCharsetEncoder = null;
|
||||
|
||||
// The CharToByteConverter with which we test unusual characters.
|
||||
Object fCharToByteConverter = null;
|
||||
|
||||
// Is the converter null because it can't be instantiated
|
||||
// for some reason (perhaps we're running with insufficient authority as
|
||||
// an applet?
|
||||
boolean fHaveTriedCToB = false;
|
||||
CharsetEncoder fCharsetEncoder = null;
|
||||
|
||||
// Is the charset encoder usable or available.
|
||||
boolean fHaveTriedCharsetEncoder = false;
|
||||
@ -118,16 +109,12 @@ public class EncodingInfo {
|
||||
private boolean isPrintable0(char ch) {
|
||||
|
||||
// Attempt to get a CharsetEncoder for this encoding.
|
||||
if (fCharsetEncoder == null && CharsetMethods.fgNIOCharsetAvailable && !fHaveTriedCharsetEncoder) {
|
||||
if (fArgsForMethod == null) {
|
||||
fArgsForMethod = new Object [1];
|
||||
}
|
||||
if (fCharsetEncoder == null && !fHaveTriedCharsetEncoder) {
|
||||
// try and create the CharsetEncoder
|
||||
try {
|
||||
fArgsForMethod[0] = javaName;
|
||||
Object charset = CharsetMethods.fgCharsetForNameMethod.invoke(null, fArgsForMethod);
|
||||
if (((Boolean) CharsetMethods.fgCharsetCanEncodeMethod.invoke(charset, (Object[]) null)).booleanValue()) {
|
||||
fCharsetEncoder = CharsetMethods.fgCharsetNewEncoderMethod.invoke(charset, (Object[]) null);
|
||||
Charset charset = java.nio.charset.Charset.forName(javaName);
|
||||
if (charset.canEncode()) {
|
||||
fCharsetEncoder = charset.newEncoder();
|
||||
}
|
||||
// This charset cannot be used for encoding, don't try it again...
|
||||
else {
|
||||
@ -142,8 +129,7 @@ public class EncodingInfo {
|
||||
// Attempt to use the CharsetEncoder to determine whether the character is printable.
|
||||
if (fCharsetEncoder != null) {
|
||||
try {
|
||||
fArgsForMethod[0] = new Character(ch);
|
||||
return ((Boolean) CharsetMethods.fgCharsetEncoderCanEncodeMethod.invoke(fCharsetEncoder, fArgsForMethod)).booleanValue();
|
||||
return fCharsetEncoder.canEncode(ch);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// obviously can't use this charset encoder; possibly a JDK bug
|
||||
@ -152,39 +138,7 @@ public class EncodingInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// As a last resort try to use a sun.io.CharToByteConverter to
|
||||
// determine whether this character is printable. We will always
|
||||
// reach here on JDK 1.3 or below.
|
||||
if (fCharToByteConverter == null) {
|
||||
if (fHaveTriedCToB || !CharToByteConverterMethods.fgConvertersAvailable) {
|
||||
// forget it; nothing we can do...
|
||||
return false;
|
||||
}
|
||||
if (fArgsForMethod == null) {
|
||||
fArgsForMethod = new Object [1];
|
||||
}
|
||||
// try and create the CharToByteConverter
|
||||
try {
|
||||
fArgsForMethod[0] = javaName;
|
||||
fCharToByteConverter = CharToByteConverterMethods.fgGetConverterMethod.invoke(null, fArgsForMethod);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// don't try it again...
|
||||
fHaveTriedCToB = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
try {
|
||||
fArgsForMethod[0] = new Character(ch);
|
||||
return ((Boolean) CharToByteConverterMethods.fgCanConvertMethod.invoke(fCharToByteConverter, fArgsForMethod)).booleanValue();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// obviously can't use this converter; probably some kind of
|
||||
// security restriction
|
||||
fCharToByteConverter = null;
|
||||
fHaveTriedCToB = false;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// is this an encoding name recognized by this JDK?
|
||||
@ -194,82 +148,4 @@ public class EncodingInfo {
|
||||
String s = new String(bTest, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of methods from java.nio.charset.Charset and java.nio.charset.CharsetEncoder.
|
||||
*/
|
||||
static class CharsetMethods {
|
||||
|
||||
// Method: java.nio.charset.Charset.forName(java.lang.String)
|
||||
private static java.lang.reflect.Method fgCharsetForNameMethod = null;
|
||||
|
||||
// Method: java.nio.charset.Charset.canEncode()
|
||||
private static java.lang.reflect.Method fgCharsetCanEncodeMethod = null;
|
||||
|
||||
// Method: java.nio.charset.Charset.newEncoder()
|
||||
private static java.lang.reflect.Method fgCharsetNewEncoderMethod = null;
|
||||
|
||||
// Method: java.nio.charset.CharsetEncoder.canEncode(char)
|
||||
private static java.lang.reflect.Method fgCharsetEncoderCanEncodeMethod = null;
|
||||
|
||||
// Flag indicating whether or not java.nio.charset.* is available.
|
||||
private static boolean fgNIOCharsetAvailable = false;
|
||||
|
||||
private CharsetMethods() {}
|
||||
|
||||
// Attempt to get methods for Charset and CharsetEncoder on class initialization.
|
||||
static {
|
||||
try {
|
||||
Class charsetClass = Class.forName("java.nio.charset.Charset");
|
||||
Class charsetEncoderClass = Class.forName("java.nio.charset.CharsetEncoder");
|
||||
fgCharsetForNameMethod = charsetClass.getMethod("forName", new Class [] {String.class});
|
||||
fgCharsetCanEncodeMethod = charsetClass.getMethod("canEncode", new Class [] {});
|
||||
fgCharsetNewEncoderMethod = charsetClass.getMethod("newEncoder", new Class [] {});
|
||||
fgCharsetEncoderCanEncodeMethod = charsetEncoderClass.getMethod("canEncode", new Class [] {Character.TYPE});
|
||||
fgNIOCharsetAvailable = true;
|
||||
}
|
||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot use java.nio.charset.*.
|
||||
catch (Exception exc) {
|
||||
fgCharsetForNameMethod = null;
|
||||
fgCharsetCanEncodeMethod = null;
|
||||
fgCharsetEncoderCanEncodeMethod = null;
|
||||
fgCharsetNewEncoderMethod = null;
|
||||
fgNIOCharsetAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of methods from sun.io.CharToByteConverter.
|
||||
*/
|
||||
static class CharToByteConverterMethods {
|
||||
|
||||
// Method: sun.io.CharToByteConverter.getConverter(java.lang.String)
|
||||
private static java.lang.reflect.Method fgGetConverterMethod = null;
|
||||
|
||||
// Method: sun.io.CharToByteConverter.canConvert(char)
|
||||
private static java.lang.reflect.Method fgCanConvertMethod = null;
|
||||
|
||||
// Flag indicating whether or not sun.io.CharToByteConverter is available.
|
||||
private static boolean fgConvertersAvailable = false;
|
||||
|
||||
private CharToByteConverterMethods() {}
|
||||
|
||||
// Attempt to get methods for char to byte converter on class initialization.
|
||||
static {
|
||||
try {
|
||||
Class clazz = Class.forName("sun.io.CharToByteConverter");
|
||||
fgGetConverterMethod = clazz.getMethod("getConverter", new Class [] {String.class});
|
||||
fgCanConvertMethod = clazz.getMethod("canConvert", new Class [] {Character.TYPE});
|
||||
fgConvertersAvailable = true;
|
||||
}
|
||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot use sun.io.CharToByteConverter.
|
||||
catch (Exception exc) {
|
||||
fgGetConverterMethod = null;
|
||||
fgCanConvertMethod = null;
|
||||
fgConvertersAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,6 +378,12 @@ public class FunctionTable
|
||||
int funcIndex;
|
||||
Object funcIndexObj = getFunctionID(name);
|
||||
|
||||
if (func != null && !Function.class.isAssignableFrom(func)) {
|
||||
throw new ClassCastException(func.getName()
|
||||
+ " cannot be cast to "
|
||||
+ Function.class.getName());
|
||||
}
|
||||
|
||||
if (null != funcIndexObj)
|
||||
{
|
||||
funcIndex = ((Integer) funcIndexObj).intValue();
|
||||
|
@ -64,7 +64,6 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
private Node currentNode = null;
|
||||
private Node node = null;
|
||||
private NamespaceSupport namespaceContext = null;
|
||||
private Method mXmlVersion = null;
|
||||
private boolean [] needContextPop = null;
|
||||
private StringBuffer stringBuffer = null;
|
||||
private int resizeValue = 20;
|
||||
@ -83,25 +82,11 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
ownerDoc = node.getOwnerDocument();
|
||||
currentNode = node;
|
||||
}
|
||||
getDLThreeMethods();
|
||||
stringBuffer = new StringBuffer();
|
||||
needContextPop = new boolean[resizeValue];
|
||||
namespaceContext = new NamespaceSupport();
|
||||
}
|
||||
|
||||
private void getDLThreeMethods(){
|
||||
try{
|
||||
mXmlVersion = ownerDoc.getClass().getMethod("setXmlVersion",new Class[] {String.class});
|
||||
}catch(NoSuchMethodException mex){
|
||||
//log these errors at fine level.
|
||||
mXmlVersion = null;
|
||||
}catch(SecurityException se){
|
||||
//log these errors at fine level.
|
||||
mXmlVersion = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method has no effect when called.
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
@ -557,15 +542,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
*/
|
||||
public void writeStartDocument() throws XMLStreamException {
|
||||
try{
|
||||
if(mXmlVersion != null){
|
||||
mXmlVersion.invoke(ownerDoc, new Object[] {"1.0"});
|
||||
}
|
||||
}catch(IllegalAccessException iae){
|
||||
throw new XMLStreamException(iae);
|
||||
}catch(InvocationTargetException ite){
|
||||
throw new XMLStreamException(ite);
|
||||
}
|
||||
ownerDoc.setXmlVersion("1.0");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -575,15 +552,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
*/
|
||||
public void writeStartDocument(String version) throws XMLStreamException {
|
||||
try{
|
||||
if(mXmlVersion != null){
|
||||
mXmlVersion.invoke(ownerDoc, new Object[] {version});
|
||||
}
|
||||
}catch(IllegalAccessException iae){
|
||||
throw new XMLStreamException(iae);
|
||||
}catch(InvocationTargetException ite){
|
||||
throw new XMLStreamException(ite);
|
||||
}
|
||||
ownerDoc.setXmlVersion(version);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -594,15 +563,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
*/
|
||||
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
|
||||
try{
|
||||
if(mXmlVersion != null){
|
||||
mXmlVersion.invoke(ownerDoc, new Object[] {version});
|
||||
}
|
||||
}catch(IllegalAccessException iae){
|
||||
throw new XMLStreamException(iae);
|
||||
}catch(InvocationTargetException ite){
|
||||
throw new XMLStreamException(ite);
|
||||
}
|
||||
ownerDoc.setXmlVersion(version);
|
||||
//TODO: What to do with encoding.-Venu
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public interface XMLEventReader extends Iterator {
|
||||
* Get the next XMLEvent
|
||||
* @see XMLEvent
|
||||
* @throws XMLStreamException if there is an error with the underlying XML.
|
||||
* @throws NoSuchElementException iteration has no more elements.
|
||||
* @throws java.util.NoSuchElementException iteration has no more elements.
|
||||
*/
|
||||
public XMLEvent nextEvent() throws XMLStreamException;
|
||||
|
||||
|
@ -170,7 +170,7 @@ public interface XMLEvent extends javax.xml.stream.XMLStreamConstants {
|
||||
* infoset expressed.
|
||||
*
|
||||
* @param writer The writer that will output the data
|
||||
* @throws XMLStreamException if there is a fatal error writing the event
|
||||
* @throws javax.xml.stream.XMLStreamException if there is a fatal error writing the event
|
||||
*/
|
||||
public void writeAsEncodedUnicode(Writer writer)
|
||||
throws javax.xml.stream.XMLStreamException;
|
||||
|
@ -110,6 +110,12 @@ public class TransformerException extends Exception {
|
||||
*/
|
||||
public synchronized Throwable initCause(Throwable cause) {
|
||||
|
||||
// TransformerException doesn't set its cause (probably
|
||||
// because it predates initCause()) - and we may not want
|
||||
// to change this since Exceptions are serializable...
|
||||
// But this also leads to the broken code in printStackTrace
|
||||
// below...
|
||||
|
||||
if (this.containedException != null) {
|
||||
throw new IllegalStateException("Can't overwrite cause");
|
||||
}
|
||||
@ -312,61 +318,57 @@ public class TransformerException extends Exception {
|
||||
}
|
||||
|
||||
try {
|
||||
String locInfo = getLocationAsString();
|
||||
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
|
||||
super.printStackTrace(s);
|
||||
} catch (Throwable e) {}
|
||||
|
||||
Throwable exception = getException();
|
||||
|
||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||
s.println("---------");
|
||||
|
||||
try {
|
||||
if (exception instanceof TransformerException) {
|
||||
String locInfo =
|
||||
((TransformerException) exception)
|
||||
.getLocationAsString();
|
||||
String locInfo = getLocationAsString();
|
||||
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
|
||||
exception.printStackTrace(s);
|
||||
} catch (Throwable e) {
|
||||
s.println("Could not print stack trace...");
|
||||
}
|
||||
super.printStackTrace(s);
|
||||
} catch (Throwable e) {}
|
||||
|
||||
try {
|
||||
Method meth =
|
||||
((Object) exception).getClass().getMethod("getException",
|
||||
(Class[]) null);
|
||||
Throwable exception = getException();
|
||||
|
||||
if (null != meth) {
|
||||
Throwable prev = exception;
|
||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||
s.println("---------");
|
||||
|
||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
||||
try {
|
||||
exception.printStackTrace(s);
|
||||
// if exception is a TransformerException it will print
|
||||
// its contained exception, so we don't need to redo it here,
|
||||
// and we can exit the loop now.
|
||||
if (exception instanceof TransformerException) break;
|
||||
} catch (Throwable e) {
|
||||
s.println("Could not print stack trace...");
|
||||
}
|
||||
|
||||
if (prev == exception) {
|
||||
break;
|
||||
try {
|
||||
// Is this still needed?
|
||||
Method meth = exception.getClass().getMethod("getException");
|
||||
|
||||
if (null != meth) {
|
||||
Throwable prev = exception;
|
||||
|
||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
||||
|
||||
if (prev == exception) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
exception = null;
|
||||
}
|
||||
} else {
|
||||
} catch (InvocationTargetException ite) {
|
||||
exception = null;
|
||||
} catch (IllegalAccessException iae) {
|
||||
exception = null;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
exception = null;
|
||||
}
|
||||
} catch (InvocationTargetException ite) {
|
||||
exception = null;
|
||||
} catch (IllegalAccessException iae) {
|
||||
exception = null;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
exception = null;
|
||||
}
|
||||
} finally {
|
||||
// ensure output is written
|
||||
s.flush();
|
||||
}
|
||||
// insure output is written
|
||||
s.flush();
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ package javax.xml.validation;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
@ -41,13 +41,10 @@ class SecuritySupport {
|
||||
|
||||
ClassLoader getContextClassLoader() {
|
||||
return
|
||||
AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
ClassLoader cl = null;
|
||||
//try {
|
||||
cl = Thread.currentThread().getContextClassLoader();
|
||||
//} catch (SecurityException ex) { }
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null)
|
||||
cl = ClassLoader.getSystemClassLoader();
|
||||
return cl;
|
||||
@ -56,7 +53,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
String getSystemProperty(final String propName) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(propName);
|
||||
@ -69,7 +66,7 @@ class SecuritySupport {
|
||||
{
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<FileInputStream>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
@Override
|
||||
public FileInputStream run() throws FileNotFoundException {
|
||||
return new FileInputStream(file);
|
||||
@ -82,7 +79,7 @@ class SecuritySupport {
|
||||
|
||||
// Used for debugging purposes
|
||||
String getClassSource(Class<?> cls) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
||||
@ -97,7 +94,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
boolean doesFileExist(final File f) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Boolean run() {
|
||||
return f.exists();
|
||||
|
@ -40,7 +40,7 @@ class SecuritySupport {
|
||||
|
||||
|
||||
ClassLoader getContextClassLoader() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
ClassLoader cl = null;
|
||||
@ -53,7 +53,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
String getSystemProperty(final String propName) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(propName);
|
||||
@ -66,7 +66,7 @@ class SecuritySupport {
|
||||
{
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<FileInputStream>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
@Override
|
||||
public FileInputStream run() throws FileNotFoundException {
|
||||
return new FileInputStream(file);
|
||||
@ -79,7 +79,7 @@ class SecuritySupport {
|
||||
|
||||
// Used for debugging purposes
|
||||
String getClassSource(Class<?> cls) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
||||
@ -94,7 +94,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
boolean doesFileExist(final File f) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Boolean run() {
|
||||
return f.exists();
|
||||
|
@ -28,7 +28,6 @@ package javax.xml.xpath;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
@ -333,59 +333,36 @@ public final class DOMImplementationRegistry {
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple JRE (Java Runtime Environment) 1.1 test
|
||||
*
|
||||
* @return <code>true</code> if JRE 1.1
|
||||
*/
|
||||
private static boolean isJRE11() {
|
||||
try {
|
||||
Class c = Class.forName("java.security.AccessController");
|
||||
// java.security.AccessController existed since 1.2 so, if no
|
||||
// exception was thrown, the DOM application is running in a JRE
|
||||
// 1.2 or higher
|
||||
return false;
|
||||
} catch (Exception ex) {
|
||||
// ignore
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the ContextClassLoader or <code>null</code> if
|
||||
* running in a JRE 1.1
|
||||
* This method returns the ContextClassLoader.
|
||||
*
|
||||
* @return The Context Classloader
|
||||
*/
|
||||
private static ClassLoader getContextClassLoader() {
|
||||
return isJRE11()
|
||||
? null
|
||||
: (ClassLoader)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
ClassLoader classLoader = null;
|
||||
try {
|
||||
classLoader =
|
||||
Thread.currentThread().getContextClassLoader();
|
||||
} catch (SecurityException ex) {
|
||||
}
|
||||
return classLoader;
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
ClassLoader classLoader = null;
|
||||
try {
|
||||
classLoader =
|
||||
Thread.currentThread().getContextClassLoader();
|
||||
} catch (SecurityException ex) {
|
||||
}
|
||||
});
|
||||
return classLoader;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the system property indicated by the specified name
|
||||
* after checking access control privileges. For a JRE 1.1, this check is
|
||||
* not done.
|
||||
* after checking access control privileges.
|
||||
*
|
||||
* @param name the name of the system property
|
||||
* @return the system property
|
||||
*/
|
||||
private static String getSystemProperty(final String name) {
|
||||
return isJRE11()
|
||||
? (String) System.getProperty(name)
|
||||
: (String) AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(name);
|
||||
}
|
||||
});
|
||||
@ -394,7 +371,7 @@ public final class DOMImplementationRegistry {
|
||||
/**
|
||||
* This method returns an Inputstream for the reading resource
|
||||
* META_INF/services/org.w3c.dom.DOMImplementationSourceList after checking
|
||||
* access control privileges. For a JRE 1.1, this check is not done.
|
||||
* access control privileges.
|
||||
*
|
||||
* @param classLoader classLoader
|
||||
* @param name the resource
|
||||
@ -402,28 +379,18 @@ public final class DOMImplementationRegistry {
|
||||
*/
|
||||
private static InputStream getResourceAsStream(final ClassLoader classLoader,
|
||||
final String name) {
|
||||
if (isJRE11()) {
|
||||
InputStream ris;
|
||||
if (classLoader == null) {
|
||||
ris = ClassLoader.getSystemResourceAsStream(name);
|
||||
} else {
|
||||
ris = classLoader.getResourceAsStream(name);
|
||||
}
|
||||
return ris;
|
||||
} else {
|
||||
return (InputStream)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
InputStream ris;
|
||||
if (classLoader == null) {
|
||||
ris =
|
||||
ClassLoader.getSystemResourceAsStream(name);
|
||||
} else {
|
||||
ris = classLoader.getResourceAsStream(name);
|
||||
}
|
||||
return ris;
|
||||
}
|
||||
});
|
||||
}
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public InputStream run() {
|
||||
InputStream ris;
|
||||
if (classLoader == null) {
|
||||
ris =
|
||||
ClassLoader.getSystemResourceAsStream(name);
|
||||
} else {
|
||||
ris = classLoader.getResourceAsStream(name);
|
||||
}
|
||||
return ris;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -316,3 +316,5 @@ c9785bc8ade98a16a050d7520b70c68363857e00 jdk9-b67
|
||||
b5878b03d1b2e105917d959fbfa3c57c22495803 jdk9-b68
|
||||
f5911c6155c29ac24b6f9068273207e5ebd3a3df jdk9-b69
|
||||
94084caa27a3c8a09a7510aef596ebd64e97c569 jdk9-b70
|
||||
61caeb7061bbf8cc74a767997e5d17cc00712629 jdk9-b71
|
||||
1d87054e2d2f405c114f0061b97cbf8214bddf0a jdk9-b72
|
||||
|
@ -42,7 +42,7 @@ public class MailcapTokenizer {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @parameter inputString the string to tokenize
|
||||
* @param inputString the string to tokenize
|
||||
*/
|
||||
public MailcapTokenizer(String inputString) {
|
||||
data = inputString;
|
||||
@ -73,7 +73,7 @@ public class MailcapTokenizer {
|
||||
/**
|
||||
* Retrieve current token.
|
||||
*
|
||||
* @returns The current token value
|
||||
* @return The current token value
|
||||
*/
|
||||
public int getCurrentToken() {
|
||||
return currentToken;
|
||||
@ -115,7 +115,7 @@ public class MailcapTokenizer {
|
||||
/*
|
||||
* Retrieve current token value.
|
||||
*
|
||||
* @returns A String containing the current token value
|
||||
* @return A String containing the current token value
|
||||
*/
|
||||
public String getCurrentTokenValue() {
|
||||
return currentTokenValue;
|
||||
@ -123,7 +123,7 @@ public class MailcapTokenizer {
|
||||
/*
|
||||
* Process the next token.
|
||||
*
|
||||
* @returns the next token
|
||||
* @return the next token
|
||||
*/
|
||||
public int nextToken() {
|
||||
if (dataIndex < dataLength) {
|
||||
|
@ -34,8 +34,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The <tt>JAXBContext</tt> class provides the client's entry point to the
|
||||
* The {@code JAXBContext} class provides the client's entry point to the
|
||||
* JAXB API. It provides an abstraction for managing the XML/Java binding
|
||||
* information necessary to implement the JAXB binding framework operations:
|
||||
* unmarshal, marshal and validate.
|
||||
@ -62,16 +61,16 @@ import java.io.InputStream;
|
||||
* <p><i>
|
||||
* The following JAXB 1.0 requirement is only required for schema to
|
||||
* java interface/implementation binding. It does not apply to JAXB annotated
|
||||
* classes. JAXB Providers must generate a <tt>jaxb.properties</tt> file in
|
||||
* classes. JAXB Providers must generate a {@code jaxb.properties} file in
|
||||
* each package containing schema derived classes. The property file must
|
||||
* contain a property named <tt>javax.xml.bind.context.factory</tt> whose
|
||||
* value is the name of the class that implements the <tt>createContext</tt>
|
||||
* contain a property named {@code javax.xml.bind.context.factory} whose
|
||||
* value is the name of the class that implements the {@code createContext}
|
||||
* APIs.</i>
|
||||
*
|
||||
* <p><i>
|
||||
* The class supplied by the provider does not have to be assignable to
|
||||
* <tt>javax.xml.bind.JAXBContext</tt>, it simply has to provide a class that
|
||||
* implements the <tt>createContext</tt> APIs.</i>
|
||||
* {@code javax.xml.bind.JAXBContext}, it simply has to provide a class that
|
||||
* implements the {@code createContext} APIs.</i>
|
||||
*
|
||||
* <p><i>
|
||||
* In addition, the provider must call the
|
||||
@ -91,13 +90,13 @@ import java.io.InputStream;
|
||||
* Additionally, the unmarshal method allows for an unrecognized root element that
|
||||
* has an xsi:type attribute's value that references a type definition declared in
|
||||
* the schema to be unmarshalled as the root of an instance document.
|
||||
* The <tt>JAXBContext</tt> object
|
||||
* The {@code JAXBContext} object
|
||||
* allows the merging of global elements and type definitions across a set of schemas (listed
|
||||
* in the <tt>contextPath</tt>). Since each schema in the schema set can belong
|
||||
* in the {@code contextPath}). Since each schema in the schema set can belong
|
||||
* to distinct namespaces, the unification of schemas to an unmarshalling
|
||||
* context should be namespace independent. This means that a client
|
||||
* application is able to unmarshal XML documents that are instances of
|
||||
* any of the schemas listed in the <tt>contextPath</tt>. For example:
|
||||
* any of the schemas listed in the {@code contextPath}. For example:
|
||||
*
|
||||
* <pre>
|
||||
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo:com.acme.bar" );
|
||||
@ -114,12 +113,12 @@ import java.io.InputStream;
|
||||
* For schema-derived interface/implementation classes and for the
|
||||
* creation of elements that are not bound to a JAXB-annotated
|
||||
* class, an application needs to have access and knowledge about each of
|
||||
* the schema derived <tt> ObjectFactory</tt> classes that exist in each of
|
||||
* java packages contained in the <tt>contextPath</tt>. For each schema
|
||||
* the schema derived {@code ObjectFactory} classes that exist in each of
|
||||
* java packages contained in the {@code contextPath}. For each schema
|
||||
* derived java class, there is a static factory method that produces objects
|
||||
* of that type. For example,
|
||||
* assume that after compiling a schema, you have a package <tt>com.acme.foo</tt>
|
||||
* that contains a schema derived interface named <tt>PurchaseOrder</tt>. In
|
||||
* assume that after compiling a schema, you have a package {@code com.acme.foo}
|
||||
* that contains a schema derived interface named {@code PurchaseOrder}. In
|
||||
* order to create objects of that type, the client application would use the
|
||||
* factory method like this:
|
||||
*
|
||||
@ -133,25 +132,25 @@ import java.io.InputStream;
|
||||
* it can use the mutator methods to set content on it.
|
||||
*
|
||||
* <p>
|
||||
* For more information on the generated <tt>ObjectFactory</tt> classes, see
|
||||
* For more information on the generated {@code ObjectFactory} classes, see
|
||||
* Section 4.2 <i>Java Package</i> of the specification.
|
||||
*
|
||||
* <p>
|
||||
* <i>The provider must generate a class in each
|
||||
* package that contains all of the necessary object factory methods for that
|
||||
* package named ObjectFactory as well as the static
|
||||
* <tt>newInstance( javaContentInterface )</tt> method</i>
|
||||
* {@code newInstance( javaContentInterface )} method</i>
|
||||
*
|
||||
* <h3>Marshalling</h3>
|
||||
* <p>
|
||||
* The {@link Marshaller} class provides the client application the ability
|
||||
* to convert a Java content tree back into XML data. There is no difference
|
||||
* between marshalling a content tree that is created manually using the factory
|
||||
* methods and marshalling a content tree that is the result an <tt>unmarshal
|
||||
* </tt> operation. Clients can marshal a java content tree back to XML data
|
||||
* to a <tt>java.io.OutputStream</tt> or a <tt>java.io.Writer</tt>. The
|
||||
* methods and marshalling a content tree that is the result an {@code unmarshal}
|
||||
* operation. Clients can marshal a java content tree back to XML data
|
||||
* to a {@code java.io.OutputStream} or a {@code java.io.Writer}. The
|
||||
* marshalling process can alternatively produce SAX2 event streams to a
|
||||
* registered <tt>ContentHandler</tt> or produce a DOM Node object.
|
||||
* registered {@code ContentHandler} or produce a DOM Node object.
|
||||
* Client applications have control over the output encoding as well as
|
||||
* whether or not to marshal the XML data as a complete document or
|
||||
* as a fragment.
|
||||
@ -178,7 +177,7 @@ import java.io.InputStream;
|
||||
* Validation has been changed significantly since JAXB 1.0. The {@link Validator}
|
||||
* class has been deprecated and made optional. This means that you are advised
|
||||
* not to use this class and, in fact, it may not even be available depending on
|
||||
* your JAXB provider. JAXB 1.0 client applications that rely on <tt>Validator</tt>
|
||||
* your JAXB provider. JAXB 1.0 client applications that rely on {@code Validator}
|
||||
* will still work properly when deployed with the JAXB 1.0 runtime system.
|
||||
*
|
||||
* In JAXB 2.0, the {@link Unmarshaller} has included convenince methods that expose
|
||||
@ -192,8 +191,8 @@ import java.io.InputStream;
|
||||
* The following JAXB 1.0 restriction only applies to binding schema to
|
||||
* interfaces/implementation classes.
|
||||
* Since this binding does not require a common runtime system, a JAXB
|
||||
* client application must not attempt to mix runtime objects (<tt>JAXBContext,
|
||||
* Marshaller</tt>, etc. ) from different providers. This does not
|
||||
* client application must not attempt to mix runtime objects ({@code JAXBContext,
|
||||
* Marshaller}, etc. ) from different providers. This does not
|
||||
* mean that the client application isn't portable, it simply means that a
|
||||
* client has to use a runtime system provided by the same provider that was
|
||||
* used to compile the schema.
|
||||
@ -201,14 +200,14 @@ import java.io.InputStream;
|
||||
*
|
||||
* <h3>Discovery of JAXB implementation</h3>
|
||||
* <p>
|
||||
* When one of the <tt>newInstance</tt> methods is called, a JAXB implementation is discovered
|
||||
* When one of the {@code newInstance} methods is called, a JAXB implementation is discovered
|
||||
* by the following steps.
|
||||
*
|
||||
* <ol>
|
||||
*
|
||||
* <li>
|
||||
* For each package/class explicitly passed in to the {@link #newInstance} method, in the order they are specified,
|
||||
* <tt>jaxb.properties</tt> file is looked up in its package, by using the associated classloader —
|
||||
* {@code jaxb.properties} file is looked up in its package, by using the associated classloader —
|
||||
* this is {@link Class#getClassLoader() the owner class loader} for a {@link Class} argument, and for a package
|
||||
* the specified {@link ClassLoader}.
|
||||
*
|
||||
@ -269,8 +268,6 @@ import java.io.InputStream;
|
||||
* {@link javax.xml.bind.JAXBContextFactory#createContext(Class[], java.util.Map)} is invoked
|
||||
* to create a {@link JAXBContext}.
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* @apiNote
|
||||
* <p>Service discovery method using file /META-INF/services/javax.xml.bind.JAXBContext (described in step 4)
|
||||
* and leveraging provider's static methods is supported only to allow backwards compatibility, but it is strongly
|
||||
@ -294,7 +291,7 @@ public abstract class JAXBContext {
|
||||
|
||||
/**
|
||||
* The name of the property that contains the name of the class capable
|
||||
* of creating new <tt>JAXBContext</tt> objects.
|
||||
* of creating new {@code JAXBContext} objects.
|
||||
*/
|
||||
public static final String JAXB_CONTEXT_FACTORY = "javax.xml.bind.JAXBContextFactory";
|
||||
|
||||
@ -303,8 +300,7 @@ public abstract class JAXBContext {
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* This is a convenience method to invoke the
|
||||
@ -312,7 +308,7 @@ public abstract class JAXBContext {
|
||||
* the context class loader of the current thread.
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt> such as
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
@ -328,8 +324,7 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* The client application must supply a context path which is a list of
|
||||
@ -340,7 +335,7 @@ public abstract class JAXBContext {
|
||||
* ObjectFactory.class generated per package.
|
||||
* Alternatively than being listed in the context path, programmer
|
||||
* annotated JAXB mapped classes can be listed in a
|
||||
* <tt>jaxb.index</tt> resource file, format described below.
|
||||
* {@code jaxb.index} resource file, format described below.
|
||||
* Note that a java package can contain both schema-derived classes and
|
||||
* user annotated JAXB classes. Additionally, the java package may
|
||||
* contain JAXB package annotations that must be processed. (see JLS,
|
||||
@ -349,7 +344,7 @@ public abstract class JAXBContext {
|
||||
*
|
||||
* <p>
|
||||
* Every package listed on the contextPath must meet <b>one or both</b> of the
|
||||
* following conditions otherwise a <tt>JAXBException</tt> will be thrown:
|
||||
* following conditions otherwise a {@code JAXBException} will be thrown:
|
||||
* </p>
|
||||
* <ol>
|
||||
* <li>it must contain ObjectFactory.class</li>
|
||||
@ -367,12 +362,12 @@ public abstract class JAXBContext {
|
||||
* are reachable, as defined in {@link #newInstance(Class...)}, from the
|
||||
* listed classes are also registered with JAXBContext.
|
||||
* <p>
|
||||
* Constraints on class name occuring in a <tt>jaxb.index</tt> file are:
|
||||
* Constraints on class name occuring in a {@code jaxb.index} file are:
|
||||
* <ul>
|
||||
* <li>Must not end with ".class".</li>
|
||||
* <li>Class names are resolved relative to package containing
|
||||
* <tt>jaxb.index</tt> file. Only classes occuring directly in package
|
||||
* containing <tt>jaxb.index</tt> file are allowed.</li>
|
||||
* {@code jaxb.index} file. Only classes occuring directly in package
|
||||
* containing {@code jaxb.index} file are allowed.</li>
|
||||
* <li>Fully qualified class names are not allowed.
|
||||
* A qualified class name,relative to current package,
|
||||
* is only allowed to specify a nested or inner class.</li>
|
||||
@ -381,21 +376,21 @@ public abstract class JAXBContext {
|
||||
* <p>
|
||||
* To maintain compatibility with JAXB 1.0 schema to java
|
||||
* interface/implementation binding, enabled by schema customization
|
||||
* <tt>{@literal <jaxb:globalBindings valueClass="false">}</tt>,
|
||||
* {@code <jaxb:globalBindings valueClass="false">},
|
||||
* the JAXB provider will ensure that each package on the context path
|
||||
* has a <tt>jaxb.properties</tt> file which contains a value for the
|
||||
* <tt>javax.xml.bind.context.factory</tt> property and that all values
|
||||
* has a {@code jaxb.properties} file which contains a value for the
|
||||
* {@code javax.xml.bind.context.factory} property and that all values
|
||||
* resolve to the same provider. This requirement does not apply to
|
||||
* JAXB annotated classes.
|
||||
*
|
||||
* <p>
|
||||
* If there are any global XML element name collisions across the various
|
||||
* packages listed on the <tt>contextPath</tt>, a <tt>JAXBException</tt>
|
||||
* packages listed on the {@code contextPath}, a {@code JAXBException}
|
||||
* will be thrown.
|
||||
*
|
||||
* <p>
|
||||
* Mixing generated interface/impl bindings from multiple JAXB Providers
|
||||
* in the same context path may result in a <tt>JAXBException</tt>
|
||||
* in the same context path may result in a {@code JAXBException}
|
||||
* being thrown.
|
||||
*
|
||||
* <p>
|
||||
@ -408,9 +403,9 @@ public abstract class JAXBContext {
|
||||
* This class loader will be used to locate the implementation
|
||||
* classes.
|
||||
*
|
||||
* @return a new instance of a <tt>JAXBContext</tt>
|
||||
* @return a new instance of a {@code JAXBContext}
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt> such as
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
@ -424,8 +419,7 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* This is mostly the same as {@link JAXBContext#newInstance(String, ClassLoader)},
|
||||
@ -434,7 +428,7 @@ public abstract class JAXBContext {
|
||||
*
|
||||
* <p>
|
||||
* The interpretation of properties is up to implementations. Implementations should
|
||||
* throw <tt>JAXBException</tt> if it finds properties that it doesn't understand.
|
||||
* throw {@code JAXBException} if it finds properties that it doesn't understand.
|
||||
*
|
||||
* @param contextPath list of java package names that contain schema derived classes
|
||||
* @param classLoader
|
||||
@ -443,9 +437,9 @@ public abstract class JAXBContext {
|
||||
* provider-specific properties. Can be null, which means the same thing as passing
|
||||
* in an empty map.
|
||||
*
|
||||
* @return a new instance of a <tt>JAXBContext</tt>
|
||||
* @return a new instance of a {@code JAXBContext}
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt> such as
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
@ -472,8 +466,7 @@ public abstract class JAXBContext {
|
||||
|
||||
// TODO: resurrect this once we introduce external annotations
|
||||
// /**
|
||||
// * <p>
|
||||
// * Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
// * Create a new instance of a {@code JAXBContext} class.
|
||||
// *
|
||||
// * <p>
|
||||
// * The client application must supply a list of classes that the new
|
||||
@ -484,8 +477,8 @@ public abstract class JAXBContext {
|
||||
// * referenced statically from the specified classes.
|
||||
// *
|
||||
// * For example, in the following Java code, if you do
|
||||
// * <tt>newInstance(Foo.class)</tt>, the newly created {@link JAXBContext}
|
||||
// * will recognize both <tt>Foo</tt> and <tt>Bar</tt>, but not <tt>Zot</tt>:
|
||||
// * {@code newInstance(Foo.class)}, the newly created {@link JAXBContext}
|
||||
// * will recognize both {@code Foo} and {@code Bar}, but not {@code Zot}:
|
||||
// * <pre>
|
||||
// * class Foo {
|
||||
// * Bar b;
|
||||
@ -509,11 +502,11 @@ public abstract class JAXBContext {
|
||||
// * spec-defined classes will be returned.
|
||||
// *
|
||||
// * @return
|
||||
// * A new instance of a <tt>JAXBContext</tt>.
|
||||
// * A new instance of a {@code JAXBContext}.
|
||||
// *
|
||||
// * @throws JAXBException
|
||||
// * if an error was encountered while creating the
|
||||
// * <tt>JAXBContext</tt>, such as (but not limited to):
|
||||
// * {@code JAXBContext}, such as (but not limited to):
|
||||
// * <ol>
|
||||
// * <li>No JAXB implementation was discovered
|
||||
// * <li>Classes use JAXB annotations incorrectly
|
||||
@ -546,8 +539,7 @@ public abstract class JAXBContext {
|
||||
// }
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* The client application must supply a list of classes that the new
|
||||
@ -556,12 +548,12 @@ public abstract class JAXBContext {
|
||||
* Not only the new context will recognize all the classes specified,
|
||||
* but it will also recognize any classes that are directly/indirectly
|
||||
* referenced statically from the specified classes. Subclasses of
|
||||
* referenced classes nor <tt>@XmlTransient</tt> referenced classes
|
||||
* referenced classes nor {@code @XmlTransient} referenced classes
|
||||
* are not registered with JAXBContext.
|
||||
*
|
||||
* For example, in the following Java code, if you do
|
||||
* <tt>newInstance(Foo.class)</tt>, the newly created {@link JAXBContext}
|
||||
* will recognize both <tt>Foo</tt> and <tt>Bar</tt>, but not <tt>Zot</tt> or <tt>FooBar</tt>:
|
||||
* {@code newInstance(Foo.class)}, the newly created {@link JAXBContext}
|
||||
* will recognize both {@code Foo} and {@code Bar}, but not {@code Zot} or {@code FooBar}:
|
||||
* <pre>
|
||||
* class Foo {
|
||||
* @XmlTransient FooBar c;
|
||||
@ -589,11 +581,11 @@ public abstract class JAXBContext {
|
||||
* spec-defined classes will be returned.
|
||||
*
|
||||
* @return
|
||||
* A new instance of a <tt>JAXBContext</tt>.
|
||||
* A new instance of a {@code JAXBContext}.
|
||||
*
|
||||
* @throws JAXBException
|
||||
* if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt>, such as (but not limited to):
|
||||
* {@code JAXBContext}, such as (but not limited to):
|
||||
* <ol>
|
||||
* <li>No JAXB implementation was discovered
|
||||
* <li>Classes use JAXB annotations incorrectly
|
||||
@ -615,8 +607,7 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* An overloading of {@link JAXBContext#newInstance(Class...)}
|
||||
@ -624,7 +615,7 @@ public abstract class JAXBContext {
|
||||
*
|
||||
* <p>
|
||||
* The interpretation of properties is up to implementations. Implementations should
|
||||
* throw <tt>JAXBException</tt> if it finds properties that it doesn't understand.
|
||||
* throw {@code JAXBException} if it finds properties that it doesn't understand.
|
||||
*
|
||||
* @param classesToBeBound
|
||||
* list of java classes to be recognized by the new {@link JAXBContext}.
|
||||
@ -635,11 +626,11 @@ public abstract class JAXBContext {
|
||||
* in an empty map.
|
||||
*
|
||||
* @return
|
||||
* A new instance of a <tt>JAXBContext</tt>.
|
||||
* A new instance of a {@code JAXBContext}.
|
||||
*
|
||||
* @throws JAXBException
|
||||
* if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt>, such as (but not limited to):
|
||||
* {@code JAXBContext}, such as (but not limited to):
|
||||
* <ol>
|
||||
* <li>No JAXB implementation was discovered
|
||||
* <li>Classes use JAXB annotations incorrectly
|
||||
@ -672,25 +663,25 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <tt>Unmarshaller</tt> object that can be used to convert XML
|
||||
* Create an {@code Unmarshaller} object that can be used to convert XML
|
||||
* data into a java content tree.
|
||||
*
|
||||
* @return an <tt>Unmarshaller</tt> object
|
||||
* @return an {@code Unmarshaller} object
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>Unmarshaller</tt> object
|
||||
* {@code Unmarshaller} object
|
||||
*/
|
||||
public abstract Unmarshaller createUnmarshaller() throws JAXBException;
|
||||
|
||||
|
||||
/**
|
||||
* Create a <tt>Marshaller</tt> object that can be used to convert a
|
||||
* Create a {@code Marshaller} object that can be used to convert a
|
||||
* java content tree into XML data.
|
||||
*
|
||||
* @return a <tt>Marshaller</tt> object
|
||||
* @return a {@code Marshaller} object
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>Marshaller</tt> object
|
||||
* {@code Marshaller} object
|
||||
*/
|
||||
public abstract Marshaller createMarshaller() throws JAXBException;
|
||||
|
||||
@ -699,27 +690,27 @@ public abstract class JAXBContext {
|
||||
* {@link Validator} has been made optional and deprecated in JAXB 2.0. Please
|
||||
* refer to the javadoc for {@link Validator} for more detail.
|
||||
* <p>
|
||||
* Create a <tt>Validator</tt> object that can be used to validate a
|
||||
* Create a {@code Validator} object that can be used to validate a
|
||||
* java content tree against its source schema.
|
||||
*
|
||||
* @return a <tt>Validator</tt> object
|
||||
* @return a {@code Validator} object
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>Validator</tt> object
|
||||
* {@code Validator} object
|
||||
* @deprecated since JAXB2.0
|
||||
*/
|
||||
public abstract Validator createValidator() throws JAXBException;
|
||||
|
||||
/**
|
||||
* Creates a <tt>Binder</tt> object that can be used for
|
||||
* Creates a {@code Binder} object that can be used for
|
||||
* associative/in-place unmarshalling/marshalling.
|
||||
*
|
||||
* @param domType select the DOM API to use by passing in its DOM Node class.
|
||||
*
|
||||
* @return always a new valid <tt>Binder</tt> object.
|
||||
* @return always a new valid {@code Binder} object.
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* if DOM API corresponding to <tt>domType</tt> is not supported by
|
||||
* if DOM API corresponding to {@code domType} is not supported by
|
||||
* the implementation.
|
||||
*
|
||||
* @since 1.6, JAXB 2.0
|
||||
@ -731,9 +722,9 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <tt>Binder</tt> for W3C DOM.
|
||||
* Creates a {@code Binder} for W3C DOM.
|
||||
*
|
||||
* @return always a new valid <tt>Binder</tt> object.
|
||||
* @return always a new valid {@code Binder} object.
|
||||
*
|
||||
* @since 1.6, JAXB 2.0
|
||||
*/
|
||||
@ -742,11 +733,11 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <tt>JAXBIntrospector</tt> object that can be used to
|
||||
* Creates a {@code JAXBIntrospector} object that can be used to
|
||||
* introspect JAXB objects.
|
||||
*
|
||||
* @return
|
||||
* always return a non-null valid <tt>JAXBIntrospector</tt> object.
|
||||
* always return a non-null valid {@code JAXBIntrospector} object.
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* Calling this method on JAXB 1.0 implementations will throw
|
||||
|
@ -239,7 +239,7 @@
|
||||
<ul>
|
||||
<li> For a property, a given annotation can be applied to
|
||||
either read or write property but not both. </li>
|
||||
|
||||
|
||||
<li> A property name must be different from any other
|
||||
property name in any of the super classes of the
|
||||
class being mapped. </li>
|
||||
@ -250,8 +250,8 @@
|
||||
<h3>Notations</h3>
|
||||
<b>Namespace prefixes</b>
|
||||
<p>The following namespace prefixes are used in the XML Schema
|
||||
fragments in this package.<p>
|
||||
|
||||
fragments in this package.
|
||||
|
||||
<table border="1" cellpadding="4" cellspacing="3">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -313,3 +313,5 @@ ed94f3e7ba6bbfec0772de6d24e39543e13f6d88 jdk9-b65
|
||||
046fd17bb9a0cdf6681124866df9626d17b0516a jdk9-b68
|
||||
551323004d0ce2f1d4b0e99552f7e0cdcebc6fca jdk9-b69
|
||||
a7f731125b7fb0e4b0186172f85a21e2d5139f7e jdk9-b70
|
||||
e47d3bfbc61accc3fbd372a674fdce2933b54f31 jdk9-b71
|
||||
f376824d4940f45719d91838f3f6249f873440db jdk9-b72
|
||||
|
@ -28,7 +28,7 @@ default: all
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
|
||||
SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample
|
||||
SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample/image
|
||||
SAMPLE_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/share
|
||||
SAMPLE_CLOSED_SOURCE_DIR := $(JDK_TOPDIR)/src/closed/sample/share
|
||||
SAMPLE_SOLARIS_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/solaris
|
||||
|
@ -31,17 +31,12 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c \
|
||||
$(CONF_DST_DIR)/accessibility.properties
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c
|
||||
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/%: \
|
||||
$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/%
|
||||
$(install-file)
|
||||
|
||||
$(CONF_DST_DIR)/accessibility.properties: \
|
||||
$(JDK_TOPDIR)/src/jdk.accessibility/windows/conf/accessibility.properties
|
||||
$(install-file)
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
@ -21,4 +21,4 @@
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
tzdata2015d
|
||||
tzdata2015e
|
||||
|
@ -361,9 +361,10 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 -
|
||||
# time this summer, and carry out studies on the possibility of canceling the
|
||||
# practice altogether in future years."
|
||||
#
|
||||
# From Paul Eggert (2015-04-20):
|
||||
# For now, assume DST will be canceled. Any resumption would likely
|
||||
# use different rules anyway.
|
||||
# From Paul Eggert (2015-04-24):
|
||||
# Yesterday the office of Egyptian President El-Sisi announced his
|
||||
# decision to abandon DST permanently. See Ahram Online 2015-04-24.
|
||||
# http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx
|
||||
|
||||
Rule Egypt 2008 only - Aug lastThu 24:00 0 -
|
||||
Rule Egypt 2009 only - Aug 20 24:00 0 -
|
||||
@ -810,20 +811,41 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis
|
||||
# will resume again at 02:00 on Saturday, August 2, 2014....
|
||||
# http://www.mmsp.gov.ma/fr/actualites.aspx?id=586
|
||||
|
||||
# From Paul Eggert (2014-06-05):
|
||||
# For now, guess that later spring and fall transitions will use 2014's rules,
|
||||
# From Milamber (2015-06-08):
|
||||
# (Google Translation) The hour will thus be delayed 60 minutes
|
||||
# Sunday, June 14 at 3:00, the ministry said in a statement, adding
|
||||
# that the time will be advanced again 60 minutes Sunday, July 19,
|
||||
# 2015 at 2:00. The move comes under 2.12.126 Decree of 26 Jumada I
|
||||
# 1433 (18 April 2012) and the decision of the Head of Government of
|
||||
# 16 N. 3-29-15 Chaaban 1435 (4 June 2015).
|
||||
# Source (french):
|
||||
# http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/
|
||||
#
|
||||
# From Milamber (2015-06-09):
|
||||
# http://www.mmsp.gov.ma/fr/actualites.aspx?id=863
|
||||
#
|
||||
# From Michael Deckers (2015-06-09):
|
||||
# [The gov.ma announcement] would (probably) make the switch on 2015-07-19 go
|
||||
# from 03:00 to 04:00 rather than from 02:00 to 03:00, as in the patch....
|
||||
# I think the patch is correct and the quoted text is wrong; the text in
|
||||
# <http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/> agrees
|
||||
# with the patch.
|
||||
|
||||
# From Paul Eggert (2015-06-08):
|
||||
# For now, guess that later spring and fall transitions will use 2015's rules,
|
||||
# and guess that Morocco will switch to standard time at 03:00 the last
|
||||
# Saturday before Ramadan, and back to DST at 02:00 the first Saturday after
|
||||
# Ramadan. To implement this, transition dates for 2015 through 2037 were
|
||||
# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after
|
||||
# Ramadan. To implement this, transition dates for 2016 through 2037 were
|
||||
# determined by running the following program under GNU Emacs 24.3, with the
|
||||
# results integrated by hand into the table below.
|
||||
# (let ((islamic-year 1436))
|
||||
# (let ((islamic-year 1437))
|
||||
# (require 'cal-islam)
|
||||
# (while (< islamic-year 1460)
|
||||
# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
|
||||
# (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
|
||||
# (saturday 6))
|
||||
# (while (/= saturday (mod (setq a (1- a)) 7)))
|
||||
# (while (/= saturday (mod b 7))
|
||||
# (sunday 0))
|
||||
# (while (/= sunday (mod (setq a (1- a)) 7)))
|
||||
# (while (/= sunday (mod b 7))
|
||||
# (setq b (1+ b)))
|
||||
# (setq a (calendar-gregorian-from-absolute a))
|
||||
# (setq b (calendar-gregorian-from-absolute b))
|
||||
@ -867,32 +889,30 @@ Rule Morocco 2012 only - Aug 20 2:00 1:00 S
|
||||
Rule Morocco 2013 only - Jul 7 3:00 0 -
|
||||
Rule Morocco 2013 only - Aug 10 2:00 1:00 S
|
||||
Rule Morocco 2013 max - Oct lastSun 3:00 0 -
|
||||
Rule Morocco 2014 2022 - Mar lastSun 2:00 1:00 S
|
||||
Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S
|
||||
Rule Morocco 2014 only - Jun 28 3:00 0 -
|
||||
Rule Morocco 2014 only - Aug 2 2:00 1:00 S
|
||||
Rule Morocco 2015 only - Jun 13 3:00 0 -
|
||||
Rule Morocco 2015 only - Jul 18 2:00 1:00 S
|
||||
Rule Morocco 2016 only - Jun 4 3:00 0 -
|
||||
Rule Morocco 2016 only - Jul 9 2:00 1:00 S
|
||||
Rule Morocco 2017 only - May 20 3:00 0 -
|
||||
Rule Morocco 2017 only - Jul 1 2:00 1:00 S
|
||||
Rule Morocco 2018 only - May 12 3:00 0 -
|
||||
Rule Morocco 2018 only - Jun 16 2:00 1:00 S
|
||||
Rule Morocco 2019 only - May 4 3:00 0 -
|
||||
Rule Morocco 2019 only - Jun 8 2:00 1:00 S
|
||||
Rule Morocco 2020 only - Apr 18 3:00 0 -
|
||||
Rule Morocco 2020 only - May 30 2:00 1:00 S
|
||||
Rule Morocco 2021 only - Apr 10 3:00 0 -
|
||||
Rule Morocco 2021 only - May 15 2:00 1:00 S
|
||||
Rule Morocco 2022 only - Apr 2 3:00 0 -
|
||||
Rule Morocco 2022 only - May 7 2:00 1:00 S
|
||||
Rule Morocco 2023 only - Apr 22 2:00 1:00 S
|
||||
Rule Morocco 2024 only - Apr 13 2:00 1:00 S
|
||||
Rule Morocco 2025 only - Apr 5 2:00 1:00 S
|
||||
Rule Morocco 2015 only - Jun 14 3:00 0 -
|
||||
Rule Morocco 2015 only - Jul 19 2:00 1:00 S
|
||||
Rule Morocco 2016 only - Jun 5 3:00 0 -
|
||||
Rule Morocco 2016 only - Jul 10 2:00 1:00 S
|
||||
Rule Morocco 2017 only - May 21 3:00 0 -
|
||||
Rule Morocco 2017 only - Jul 2 2:00 1:00 S
|
||||
Rule Morocco 2018 only - May 13 3:00 0 -
|
||||
Rule Morocco 2018 only - Jun 17 2:00 1:00 S
|
||||
Rule Morocco 2019 only - May 5 3:00 0 -
|
||||
Rule Morocco 2019 only - Jun 9 2:00 1:00 S
|
||||
Rule Morocco 2020 only - Apr 19 3:00 0 -
|
||||
Rule Morocco 2020 only - May 24 2:00 1:00 S
|
||||
Rule Morocco 2021 only - Apr 11 3:00 0 -
|
||||
Rule Morocco 2021 only - May 16 2:00 1:00 S
|
||||
Rule Morocco 2022 only - May 8 2:00 1:00 S
|
||||
Rule Morocco 2023 only - Apr 23 2:00 1:00 S
|
||||
Rule Morocco 2024 only - Apr 14 2:00 1:00 S
|
||||
Rule Morocco 2025 only - Apr 6 2:00 1:00 S
|
||||
Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S
|
||||
Rule Morocco 2035 only - Oct 27 3:00 0 -
|
||||
Rule Morocco 2036 only - Oct 18 3:00 0 -
|
||||
Rule Morocco 2037 only - Oct 10 3:00 0 -
|
||||
Rule Morocco 2036 only - Oct 19 3:00 0 -
|
||||
Rule Morocco 2037 only - Oct 4 3:00 0 -
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
|
||||
|
@ -26,11 +26,10 @@
|
||||
# This file is in the public domain, so clarified as of
|
||||
# 2009-05-17 by Arthur David Olson.
|
||||
#
|
||||
# From Paul Eggert (2014-07-18):
|
||||
# From Paul Eggert (2015-05-02):
|
||||
# This file contains a table of two-letter country codes. Columns are
|
||||
# separated by a single tab. Lines beginning with '#' are comments.
|
||||
# Although all text currently uses ASCII encoding, this is planned to
|
||||
# change to UTF-8 soon. The columns of the table are as follows:
|
||||
# All text uses UTF-8 encoding. The columns of the table are as follows:
|
||||
#
|
||||
# 1. ISO 3166-1 alpha-2 country code, current as of
|
||||
# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166
|
||||
@ -61,7 +60,7 @@ AS Samoa (American)
|
||||
AT Austria
|
||||
AU Australia
|
||||
AW Aruba
|
||||
AX Aaland Islands
|
||||
AX Åland Islands
|
||||
AZ Azerbaijan
|
||||
BA Bosnia & Herzegovina
|
||||
BB Barbados
|
||||
@ -90,7 +89,7 @@ CD Congo (Dem. Rep.)
|
||||
CF Central African Rep.
|
||||
CG Congo (Rep.)
|
||||
CH Switzerland
|
||||
CI Cote d'Ivoire
|
||||
CI Côte d'Ivoire
|
||||
CK Cook Islands
|
||||
CL Chile
|
||||
CM Cameroon
|
||||
@ -234,7 +233,7 @@ PT Portugal
|
||||
PW Palau
|
||||
PY Paraguay
|
||||
QA Qatar
|
||||
RE Reunion
|
||||
RE Réunion
|
||||
RO Romania
|
||||
RS Serbia
|
||||
RU Russia
|
||||
|
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