mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-17 05:45:05 +00:00
Merge
This commit is contained in:
commit
7f7b300f89
1
.hgtags
1
.hgtags
@ -323,3 +323,4 @@ c25e882cee9622ec75c4e9d60633539a2f0a8809 jdk9-b77
|
||||
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
|
||||
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
|
||||
3c9f5bd909ae7187f24622ee4b69f8a5756a9271 jdk9-b80
|
||||
2050b3a0aadcb0e024bf798197421d58e54ec8bf jdk9-b81
|
||||
|
||||
@ -323,3 +323,4 @@ d82072b699b880a1f647a5e2d7c0f86cec958941 jdk9-b76
|
||||
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
|
||||
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
|
||||
f7c5ae2933c0b8510a420d1713a955e4ffc7ad0b jdk9-b80
|
||||
b8afcf91331d78626a583ec1b63164468d6f4181 jdk9-b81
|
||||
|
||||
@ -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=1435822080
|
||||
DATE_WHEN_GENERATED=1441958217
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -38307,6 +38307,48 @@ $as_echo "$as_me: Rewriting OBJCOPY to \"$new_complete\"" >&6;}
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||
# objcopy prior to 2.21.1 on solaris is broken and is not usable.
|
||||
# Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
|
||||
# - version number is last blank separate word on first line
|
||||
# - version number formats that have been seen:
|
||||
# - <major>.<minor>
|
||||
# - <major>.<minor>.<micro>
|
||||
OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
|
||||
# The outer [ ] is to prevent m4 from eating the [] in the sed expression.
|
||||
OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
|
||||
-e 's/.* //' \
|
||||
-e '/^[01]\./b bad' \
|
||||
-e '/^2\./{' \
|
||||
-e ' s/^2\.//' \
|
||||
-e ' /^[0-9]$/b bad' \
|
||||
-e ' /^[0-9]\./b bad' \
|
||||
-e ' /^1[0-9]$/b bad' \
|
||||
-e ' /^1[0-9]\./b bad' \
|
||||
-e ' /^20\./b bad' \
|
||||
-e ' /^21\.0$/b bad' \
|
||||
-e ' /^21\.0\./b bad' \
|
||||
-e '}' \
|
||||
-e ':good' \
|
||||
-e 's/.*/VALID_VERSION/p' \
|
||||
-e 'q' \
|
||||
-e ':bad' \
|
||||
-e 's/.*/BAD_VERSION/p' \
|
||||
-e 'q'`
|
||||
if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
|
||||
OBJCOPY=
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&5
|
||||
$as_echo "$as_me: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: objcopy reports version $OBJCOPY_VERSION" >&5
|
||||
$as_echo "$as_me: objcopy reports version $OBJCOPY_VERSION" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&5
|
||||
$as_echo "$as_me: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&5
|
||||
$as_echo "$as_me: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: Solaris 11 Update 1 contains the correct version" >&5
|
||||
$as_echo "$as_me: Note: Solaris 11 Update 1 contains the correct version" >&6;}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -30,25 +30,6 @@
|
||||
# (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
|
||||
# using 'configure @CONFIGURE_COMMAND_LINE@'
|
||||
|
||||
# When calling macros, the spaces between arguments are
|
||||
# often semantically important! Sometimes we need to subst
|
||||
# spaces and commas, therefore we need the following macros.
|
||||
X:=
|
||||
SPACE:=$(X) $(X)
|
||||
COMMA:=,
|
||||
DOLLAR:=$$
|
||||
HASH:=\#
|
||||
LEFT_PAREN:=(
|
||||
RIGHT_PAREN:=)
|
||||
SQUOTE:='
|
||||
#'
|
||||
DQUOTE:="
|
||||
#"
|
||||
define NEWLINE
|
||||
|
||||
|
||||
endef
|
||||
|
||||
# The command line given to configure.
|
||||
CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
|
||||
|
||||
|
||||
@ -586,6 +586,43 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
||||
# Only call fixup if objcopy was found.
|
||||
if test -n "$OBJCOPY"; then
|
||||
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
|
||||
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||
# objcopy prior to 2.21.1 on solaris is broken and is not usable.
|
||||
# Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
|
||||
# - version number is last blank separate word on first line
|
||||
# - version number formats that have been seen:
|
||||
# - <major>.<minor>
|
||||
# - <major>.<minor>.<micro>
|
||||
OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
|
||||
# The outer [ ] is to prevent m4 from eating the [] in the sed expression.
|
||||
[ OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
|
||||
-e 's/.* //' \
|
||||
-e '/^[01]\./b bad' \
|
||||
-e '/^2\./{' \
|
||||
-e ' s/^2\.//' \
|
||||
-e ' /^[0-9]$/b bad' \
|
||||
-e ' /^[0-9]\./b bad' \
|
||||
-e ' /^1[0-9]$/b bad' \
|
||||
-e ' /^1[0-9]\./b bad' \
|
||||
-e ' /^20\./b bad' \
|
||||
-e ' /^21\.0$/b bad' \
|
||||
-e ' /^21\.0\./b bad' \
|
||||
-e '}' \
|
||||
-e ':good' \
|
||||
-e 's/.*/VALID_VERSION/p' \
|
||||
-e 'q' \
|
||||
-e ':bad' \
|
||||
-e 's/.*/BAD_VERSION/p' \
|
||||
-e 'q'` ]
|
||||
if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
|
||||
OBJCOPY=
|
||||
AC_MSG_WARN([Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated.])
|
||||
AC_MSG_NOTICE([objcopy reports version $OBJCOPY_VERSION])
|
||||
AC_MSG_NOTICE([Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version])
|
||||
AC_MSG_NOTICE([Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version])
|
||||
AC_MSG_NOTICE([Note: Solaris 11 Update 1 contains the correct version])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@ -323,3 +323,4 @@ d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
|
||||
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
|
||||
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
|
||||
821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
|
||||
45c35b7f5b40d5af0085e4a7b3a4d6e3e0347c35 jdk9-b81
|
||||
|
||||
@ -483,3 +483,4 @@ e66c3813789debfc06f206afde1bf7a84cb08451 jdk9-b77
|
||||
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
|
||||
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
|
||||
8e8377739c06b99b9011c003c77e0bef84c91e09 jdk9-b80
|
||||
4142c190cd5ca4fb70ec367b4f97ef936272d8ef jdk9-b81
|
||||
|
||||
@ -3803,82 +3803,38 @@ encode %{
|
||||
|
||||
enc_class aarch64_enc_cmpxchg(memory mem, iRegLNoSp oldval, iRegLNoSp newval) %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
Register old_reg = as_Register($oldval$$reg);
|
||||
Register new_reg = as_Register($newval$$reg);
|
||||
Register base = as_Register($mem$$base);
|
||||
Register addr_reg;
|
||||
int index = $mem$$index;
|
||||
int scale = $mem$$scale;
|
||||
int disp = $mem$$disp;
|
||||
if (index == -1) {
|
||||
if (disp != 0) {
|
||||
__ lea(rscratch2, Address(base, disp));
|
||||
addr_reg = rscratch2;
|
||||
} else {
|
||||
// TODO
|
||||
// should we ever get anything other than this case?
|
||||
addr_reg = base;
|
||||
}
|
||||
} else {
|
||||
Register index_reg = as_Register(index);
|
||||
if (disp == 0) {
|
||||
__ lea(rscratch2, Address(base, index_reg, Address::lsl(scale)));
|
||||
addr_reg = rscratch2;
|
||||
} else {
|
||||
__ lea(rscratch2, Address(base, disp));
|
||||
__ lea(rscratch2, Address(rscratch2, index_reg, Address::lsl(scale)));
|
||||
addr_reg = rscratch2;
|
||||
}
|
||||
}
|
||||
Label retry_load, done;
|
||||
__ bind(retry_load);
|
||||
__ ldxr(rscratch1, addr_reg);
|
||||
__ cmp(rscratch1, old_reg);
|
||||
__ br(Assembler::NE, done);
|
||||
__ stlxr(rscratch1, new_reg, addr_reg);
|
||||
__ cbnzw(rscratch1, retry_load);
|
||||
__ bind(done);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
&Assembler::ldxr, &MacroAssembler::cmp, &Assembler::stlxr);
|
||||
%}
|
||||
|
||||
enc_class aarch64_enc_cmpxchgw(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
Register old_reg = as_Register($oldval$$reg);
|
||||
Register new_reg = as_Register($newval$$reg);
|
||||
Register base = as_Register($mem$$base);
|
||||
Register addr_reg;
|
||||
int index = $mem$$index;
|
||||
int scale = $mem$$scale;
|
||||
int disp = $mem$$disp;
|
||||
if (index == -1) {
|
||||
if (disp != 0) {
|
||||
__ lea(rscratch2, Address(base, disp));
|
||||
addr_reg = rscratch2;
|
||||
} else {
|
||||
// TODO
|
||||
// should we ever get anything other than this case?
|
||||
addr_reg = base;
|
||||
}
|
||||
} else {
|
||||
Register index_reg = as_Register(index);
|
||||
if (disp == 0) {
|
||||
__ lea(rscratch2, Address(base, index_reg, Address::lsl(scale)));
|
||||
addr_reg = rscratch2;
|
||||
} else {
|
||||
__ lea(rscratch2, Address(base, disp));
|
||||
__ lea(rscratch2, Address(rscratch2, index_reg, Address::lsl(scale)));
|
||||
addr_reg = rscratch2;
|
||||
}
|
||||
}
|
||||
Label retry_load, done;
|
||||
__ bind(retry_load);
|
||||
__ ldxrw(rscratch1, addr_reg);
|
||||
__ cmpw(rscratch1, old_reg);
|
||||
__ br(Assembler::NE, done);
|
||||
__ stlxrw(rscratch1, new_reg, addr_reg);
|
||||
__ cbnzw(rscratch1, retry_load);
|
||||
__ bind(done);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
&Assembler::ldxrw, &MacroAssembler::cmpw, &Assembler::stlxrw);
|
||||
%}
|
||||
|
||||
|
||||
// The only difference between aarch64_enc_cmpxchg and
|
||||
// aarch64_enc_cmpxchg_acq is that we use load-acquire in the
|
||||
// CompareAndSwap sequence to serve as a barrier on acquiring a
|
||||
// lock.
|
||||
enc_class aarch64_enc_cmpxchg_acq(memory mem, iRegLNoSp oldval, iRegLNoSp newval) %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
&Assembler::ldaxr, &MacroAssembler::cmp, &Assembler::stlxr);
|
||||
%}
|
||||
|
||||
enc_class aarch64_enc_cmpxchgw_acq(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
|
||||
__ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
|
||||
&Assembler::ldaxrw, &MacroAssembler::cmpw, &Assembler::stlxrw);
|
||||
%}
|
||||
|
||||
|
||||
// auxiliary used for CompareAndSwapX to set result register
|
||||
enc_class aarch64_enc_cset_eq(iRegINoSp res) %{
|
||||
MacroAssembler _masm(&cbuf);
|
||||
@ -4398,13 +4354,10 @@ encode %{
|
||||
|
||||
// Compare object markOop with mark and if equal exchange scratch1
|
||||
// with object markOop.
|
||||
// Note that this is simply a CAS: it does not generate any
|
||||
// barriers. These are separately generated by
|
||||
// membar_acquire_lock().
|
||||
{
|
||||
Label retry_load;
|
||||
__ bind(retry_load);
|
||||
__ ldxr(tmp, oop);
|
||||
__ ldaxr(tmp, oop);
|
||||
__ cmp(tmp, disp_hdr);
|
||||
__ br(Assembler::NE, cas_failed);
|
||||
// use stlxr to ensure update is immediately visible
|
||||
@ -4454,7 +4407,7 @@ encode %{
|
||||
{
|
||||
Label retry_load, fail;
|
||||
__ bind(retry_load);
|
||||
__ ldxr(rscratch1, tmp);
|
||||
__ ldaxr(rscratch1, tmp);
|
||||
__ cmp(disp_hdr, rscratch1);
|
||||
__ br(Assembler::NE, fail);
|
||||
// use stlxr to ensure update is immediately visible
|
||||
@ -8017,10 +7970,10 @@ instruct membar_acquire_lock() %{
|
||||
match(MemBarAcquireLock);
|
||||
ins_cost(VOLATILE_REF_COST);
|
||||
|
||||
format %{ "membar_acquire_lock" %}
|
||||
format %{ "membar_acquire_lock (elided)" %}
|
||||
|
||||
ins_encode %{
|
||||
__ membar(Assembler::LoadLoad|Assembler::LoadStore);
|
||||
__ block_comment("membar_acquire_lock (elided)");
|
||||
%}
|
||||
|
||||
ins_pipe(pipe_serial);
|
||||
@ -8080,10 +8033,10 @@ instruct membar_release_lock() %{
|
||||
match(MemBarReleaseLock);
|
||||
ins_cost(VOLATILE_REF_COST);
|
||||
|
||||
format %{ "membar_release_lock" %}
|
||||
format %{ "membar_release_lock (elided)" %}
|
||||
|
||||
ins_encode %{
|
||||
__ membar(Assembler::LoadStore|Assembler::StoreStore);
|
||||
__ block_comment("membar_release_lock (elided)");
|
||||
%}
|
||||
|
||||
ins_pipe(pipe_serial);
|
||||
@ -8369,7 +8322,11 @@ instruct storePConditional(memory heap_top_ptr, iRegP oldval, iRegP newval, rFla
|
||||
ins_pipe(pipe_serial);
|
||||
%}
|
||||
|
||||
// this has to be implemented as a CAS
|
||||
|
||||
// storeLConditional is used by PhaseMacroExpand::expand_lock_node
|
||||
// when attempting to rebias a lock towards the current thread. We
|
||||
// must use the acquire form of cmpxchg in order to guarantee acquire
|
||||
// semantics in this case.
|
||||
instruct storeLConditional(indirect mem, iRegLNoSp oldval, iRegLNoSp newval, rFlagsReg cr)
|
||||
%{
|
||||
match(Set cr (StoreLConditional mem (Binary oldval newval)));
|
||||
@ -8381,12 +8338,14 @@ instruct storeLConditional(indirect mem, iRegLNoSp oldval, iRegLNoSp newval, rFl
|
||||
"cmpw rscratch1, zr\t# EQ on successful write"
|
||||
%}
|
||||
|
||||
ins_encode(aarch64_enc_cmpxchg(mem, oldval, newval));
|
||||
ins_encode(aarch64_enc_cmpxchg_acq(mem, oldval, newval));
|
||||
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
// this has to be implemented as a CAS
|
||||
// storeIConditional also has acquire semantics, for no better reason
|
||||
// than matching storeLConditional. At the time of writing this
|
||||
// comment storeIConditional was not used anywhere by AArch64.
|
||||
instruct storeIConditional(indirect mem, iRegINoSp oldval, iRegINoSp newval, rFlagsReg cr)
|
||||
%{
|
||||
match(Set cr (StoreIConditional mem (Binary oldval newval)));
|
||||
@ -8398,7 +8357,7 @@ instruct storeIConditional(indirect mem, iRegINoSp oldval, iRegINoSp newval, rFl
|
||||
"cmpw rscratch1, zr\t# EQ on successful write"
|
||||
%}
|
||||
|
||||
ins_encode(aarch64_enc_cmpxchgw(mem, oldval, newval));
|
||||
ins_encode(aarch64_enc_cmpxchgw_acq(mem, oldval, newval));
|
||||
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
@ -917,6 +917,8 @@ public:
|
||||
|
||||
void cmpptr(Register src1, Address src2);
|
||||
|
||||
// Various forms of CAS
|
||||
|
||||
void cmpxchgptr(Register oldv, Register newv, Register addr, Register tmp,
|
||||
Label &suceed, Label *fail);
|
||||
|
||||
@ -938,6 +940,23 @@ public:
|
||||
str(rscratch2, adr);
|
||||
}
|
||||
|
||||
// A generic CAS; success or failure is in the EQ flag.
|
||||
template <typename T1, typename T2>
|
||||
void cmpxchg(Register addr, Register expected, Register new_val,
|
||||
T1 load_insn,
|
||||
void (MacroAssembler::*cmp_insn)(Register, Register),
|
||||
T2 store_insn,
|
||||
Register tmp = rscratch1) {
|
||||
Label retry_load, done;
|
||||
bind(retry_load);
|
||||
(this->*load_insn)(tmp, addr);
|
||||
(this->*cmp_insn)(tmp, expected);
|
||||
br(Assembler::NE, done);
|
||||
(this->*store_insn)(tmp, new_val, addr);
|
||||
cbnzw(tmp, retry_load);
|
||||
bind(done);
|
||||
}
|
||||
|
||||
// Calls
|
||||
|
||||
address trampoline_call(Address entry, CodeBuffer *cbuf = NULL);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -438,7 +438,9 @@ class ArrayAddress VALUE_OBJ_CLASS_SPEC {
|
||||
|
||||
};
|
||||
|
||||
const int FPUStateSizeInWords = NOT_LP64(27) LP64_ONLY( 512*2 / wordSize);
|
||||
// 64-bit refect the fxsave size which is 512 bytes and the new xsave area on EVEX which is another 2176 bytes
|
||||
// See fxsave and xsave(EVEX enabled) documentation for layout
|
||||
const int FPUStateSizeInWords = NOT_LP64(27) LP64_ONLY(2688 / wordSize);
|
||||
|
||||
// The Intel x86/Amd64 Assembler: Pure assembler doing NO optimizations on the instruction
|
||||
// level (e.g. mov rax, 0 is not translated into xor rax, rax!); i.e., what you write
|
||||
@ -594,11 +596,16 @@ class Assembler : public AbstractAssembler {
|
||||
|
||||
private:
|
||||
|
||||
int evex_encoding;
|
||||
int input_size_in_bits;
|
||||
int avx_vector_len;
|
||||
int tuple_type;
|
||||
bool is_evex_instruction;
|
||||
int _evex_encoding;
|
||||
int _input_size_in_bits;
|
||||
int _avx_vector_len;
|
||||
int _tuple_type;
|
||||
bool _is_evex_instruction;
|
||||
bool _legacy_mode_bw;
|
||||
bool _legacy_mode_dq;
|
||||
bool _legacy_mode_vl;
|
||||
bool _legacy_mode_vlbw;
|
||||
bool _instruction_uses_vl;
|
||||
|
||||
// 64bit prefixes
|
||||
int prefix_and_encode(int reg_enc, bool byteinst = false);
|
||||
@ -972,11 +979,16 @@ private:
|
||||
// belong in macro assembler but there is no need for both varieties to exist
|
||||
|
||||
void init_attributes(void) {
|
||||
evex_encoding = 0;
|
||||
input_size_in_bits = 0;
|
||||
avx_vector_len = AVX_NoVec;
|
||||
tuple_type = EVEX_ETUP;
|
||||
is_evex_instruction = false;
|
||||
_evex_encoding = 0;
|
||||
_input_size_in_bits = 0;
|
||||
_avx_vector_len = AVX_NoVec;
|
||||
_tuple_type = EVEX_ETUP;
|
||||
_is_evex_instruction = false;
|
||||
_legacy_mode_bw = (VM_Version::supports_avx512bw() == false);
|
||||
_legacy_mode_dq = (VM_Version::supports_avx512dq() == false);
|
||||
_legacy_mode_vl = (VM_Version::supports_avx512vl() == false);
|
||||
_legacy_mode_vlbw = (VM_Version::supports_avx512vlbw() == false);
|
||||
_instruction_uses_vl = false;
|
||||
}
|
||||
|
||||
void lea(Register dst, Address src);
|
||||
@ -1344,8 +1356,10 @@ private:
|
||||
void fxch(int i = 1);
|
||||
|
||||
void fxrstor(Address src);
|
||||
void xrstor(Address src);
|
||||
|
||||
void fxsave(Address dst);
|
||||
void xsave(Address dst);
|
||||
|
||||
void fyl2x();
|
||||
void frndint();
|
||||
@ -1479,11 +1493,12 @@ private:
|
||||
void movb(Address dst, int imm8);
|
||||
void movb(Register dst, Address src);
|
||||
|
||||
void kmovq(KRegister dst, KRegister src);
|
||||
void kmovql(KRegister dst, KRegister src);
|
||||
void kmovql(KRegister dst, Register src);
|
||||
void kmovdl(KRegister dst, Register src);
|
||||
void kmovq(Address dst, KRegister src);
|
||||
void kmovq(KRegister dst, Address src);
|
||||
void kmovwl(KRegister dst, Register src);
|
||||
void kmovql(Address dst, KRegister src);
|
||||
void kmovql(KRegister dst, Address src);
|
||||
|
||||
void movdl(XMMRegister dst, Register src);
|
||||
void movdl(Register dst, XMMRegister src);
|
||||
@ -1509,9 +1524,12 @@ private:
|
||||
void vmovdqu(XMMRegister dst, XMMRegister src);
|
||||
|
||||
// Move Unaligned 512bit Vector
|
||||
void evmovdqu(Address dst, XMMRegister src, int vector_len);
|
||||
void evmovdqu(XMMRegister dst, Address src, int vector_len);
|
||||
void evmovdqu(XMMRegister dst, XMMRegister src, int vector_len);
|
||||
void evmovdqul(Address dst, XMMRegister src, int vector_len);
|
||||
void evmovdqul(XMMRegister dst, Address src, int vector_len);
|
||||
void evmovdqul(XMMRegister dst, XMMRegister src, int vector_len);
|
||||
void evmovdquq(Address dst, XMMRegister src, int vector_len);
|
||||
void evmovdquq(XMMRegister dst, Address src, int vector_len);
|
||||
void evmovdquq(XMMRegister dst, XMMRegister src, int vector_len);
|
||||
|
||||
// Move lower 64bit to high 64bit in 128bit register
|
||||
void movlhps(XMMRegister dst, XMMRegister src);
|
||||
@ -1643,6 +1661,7 @@ private:
|
||||
|
||||
// Pemutation of 64bit words
|
||||
void vpermq(XMMRegister dst, XMMRegister src, int imm8, int vector_len);
|
||||
void vpermq(XMMRegister dst, XMMRegister src, int imm8);
|
||||
|
||||
void pause();
|
||||
|
||||
@ -1920,6 +1939,10 @@ private:
|
||||
void vdivpd(XMMRegister dst, XMMRegister nds, Address src, int vector_len);
|
||||
void vdivps(XMMRegister dst, XMMRegister nds, Address src, int vector_len);
|
||||
|
||||
// Sqrt Packed Floating-Point Values - Double precision only
|
||||
void vsqrtpd(XMMRegister dst, XMMRegister src, int vector_len);
|
||||
void vsqrtpd(XMMRegister dst, Address src, int vector_len);
|
||||
|
||||
// Bitwise Logical AND of Packed Floating-Point Values
|
||||
void andpd(XMMRegister dst, XMMRegister src);
|
||||
void andps(XMMRegister dst, XMMRegister src);
|
||||
@ -2057,6 +2080,9 @@ private:
|
||||
void vextracti64x2h(XMMRegister dst, XMMRegister src, int value);
|
||||
void vextractf64x2h(XMMRegister dst, XMMRegister src, int value);
|
||||
void vextractf32x4h(XMMRegister dst, XMMRegister src, int value);
|
||||
void vextractf32x4h(Address dst, XMMRegister src, int value);
|
||||
void vinsertf32x4h(XMMRegister dst, XMMRegister nds, XMMRegister src, int value);
|
||||
void vinsertf32x4h(XMMRegister dst, Address src, int value);
|
||||
|
||||
// duplicate 4-bytes integer data from src into 8 locations in dest
|
||||
void vpbroadcastd(XMMRegister dst, XMMRegister src);
|
||||
|
||||
@ -3798,16 +3798,24 @@ void LIR_Assembler::negate(LIR_Opr left, LIR_Opr dest) {
|
||||
if (left->as_xmm_float_reg() != dest->as_xmm_float_reg()) {
|
||||
__ movflt(dest->as_xmm_float_reg(), left->as_xmm_float_reg());
|
||||
}
|
||||
__ xorps(dest->as_xmm_float_reg(),
|
||||
ExternalAddress((address)float_signflip_pool));
|
||||
|
||||
if (UseAVX > 1) {
|
||||
__ vnegatess(dest->as_xmm_float_reg(), dest->as_xmm_float_reg(),
|
||||
ExternalAddress((address)float_signflip_pool));
|
||||
} else {
|
||||
__ xorps(dest->as_xmm_float_reg(),
|
||||
ExternalAddress((address)float_signflip_pool));
|
||||
}
|
||||
} else if (dest->is_double_xmm()) {
|
||||
if (left->as_xmm_double_reg() != dest->as_xmm_double_reg()) {
|
||||
__ movdbl(dest->as_xmm_double_reg(), left->as_xmm_double_reg());
|
||||
}
|
||||
__ xorpd(dest->as_xmm_double_reg(),
|
||||
ExternalAddress((address)double_signflip_pool));
|
||||
|
||||
if (UseAVX > 1) {
|
||||
__ vnegatesd(dest->as_xmm_double_reg(), dest->as_xmm_double_reg(),
|
||||
ExternalAddress((address)double_signflip_pool));
|
||||
} else {
|
||||
__ xorpd(dest->as_xmm_double_reg(),
|
||||
ExternalAddress((address)double_signflip_pool));
|
||||
}
|
||||
} else if (left->is_single_fpu() || left->is_double_fpu()) {
|
||||
assert(left->fpu() == 0, "arg must be on TOS");
|
||||
assert(dest->fpu() == 0, "dest must be TOS");
|
||||
|
||||
@ -401,11 +401,9 @@ static OopMap* generate_oop_map(StubAssembler* sasm, int num_rt_args,
|
||||
|
||||
} else if (UseSSE == 1) {
|
||||
int xmm_off = xmm_regs_as_doubles_off;
|
||||
for (int n = 0; n < FrameMap::nof_xmm_regs; n++) {
|
||||
if (n < xmm_bypass_limit) {
|
||||
VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg();
|
||||
map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0);
|
||||
}
|
||||
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) {
|
||||
VMReg xmm_name_0 = as_XMMRegister(n)->as_VMReg();
|
||||
map->set_callee_saved(VMRegImpl::stack2reg(xmm_off + num_rt_args), xmm_name_0);
|
||||
xmm_off += 2;
|
||||
}
|
||||
assert(xmm_off == float_regs_as_doubles_off, "incorrect number of xmm registers");
|
||||
@ -452,14 +450,11 @@ static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args,
|
||||
__ frstor(Address(rsp, fpu_state_off * VMRegImpl::stack_slot_size));
|
||||
|
||||
// Save the FPU registers in de-opt-able form
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0));
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8));
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16));
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24));
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32));
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40));
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48));
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56));
|
||||
int offset = 0;
|
||||
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) {
|
||||
__ fstp_d(Address(rsp, float_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset));
|
||||
offset += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (UseSSE >= 2) {
|
||||
@ -468,52 +463,26 @@ static OopMap* save_live_registers(StubAssembler* sasm, int num_rt_args,
|
||||
// so always save them as doubles.
|
||||
// note that float values are _not_ converted automatically, so for float values
|
||||
// the second word contains only garbage data.
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0), xmm0);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8), xmm1);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16), xmm2);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24), xmm3);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32), xmm4);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40), xmm5);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48), xmm6);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56), xmm7);
|
||||
int xmm_bypass_limit = FrameMap::nof_xmm_regs;
|
||||
int offset = 0;
|
||||
#ifdef _LP64
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 64), xmm8);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 72), xmm9);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 80), xmm10);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 88), xmm11);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 96), xmm12);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 104), xmm13);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 112), xmm14);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 120), xmm15);
|
||||
if (UseAVX > 2) {
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 128), xmm16);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 136), xmm17);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 144), xmm18);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 152), xmm19);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 160), xmm20);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 168), xmm21);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 176), xmm22);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 184), xmm23);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 192), xmm24);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 200), xmm25);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 208), xmm26);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 216), xmm27);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 224), xmm28);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 232), xmm29);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 240), xmm30);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 248), xmm31);
|
||||
if (UseAVX < 3) {
|
||||
xmm_bypass_limit = xmm_bypass_limit / 2;
|
||||
}
|
||||
#endif
|
||||
for (int n = 0; n < xmm_bypass_limit; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
__ movdbl(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset), xmm_name);
|
||||
offset += 8;
|
||||
}
|
||||
#endif // _LP64
|
||||
} else if (UseSSE == 1) {
|
||||
// save XMM registers as float because double not supported without SSE2
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0), xmm0);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8), xmm1);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16), xmm2);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24), xmm3);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32), xmm4);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40), xmm5);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48), xmm6);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56), xmm7);
|
||||
// save XMM registers as float because double not supported without SSE2(num MMX == num fpu)
|
||||
int offset = 0;
|
||||
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
__ movflt(Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset), xmm_name);
|
||||
offset += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -528,52 +497,26 @@ static void restore_fpu(StubAssembler* sasm, bool restore_fpu_registers = true)
|
||||
if (restore_fpu_registers) {
|
||||
if (UseSSE >= 2) {
|
||||
// restore XMM registers
|
||||
__ movdbl(xmm0, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0));
|
||||
__ movdbl(xmm1, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8));
|
||||
__ movdbl(xmm2, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16));
|
||||
__ movdbl(xmm3, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24));
|
||||
__ movdbl(xmm4, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32));
|
||||
__ movdbl(xmm5, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40));
|
||||
__ movdbl(xmm6, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48));
|
||||
__ movdbl(xmm7, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56));
|
||||
int xmm_bypass_limit = FrameMap::nof_xmm_regs;
|
||||
#ifdef _LP64
|
||||
__ movdbl(xmm8, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 64));
|
||||
__ movdbl(xmm9, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 72));
|
||||
__ movdbl(xmm10, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 80));
|
||||
__ movdbl(xmm11, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 88));
|
||||
__ movdbl(xmm12, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 96));
|
||||
__ movdbl(xmm13, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 104));
|
||||
__ movdbl(xmm14, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 112));
|
||||
__ movdbl(xmm15, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 120));
|
||||
if (UseAVX > 2) {
|
||||
__ movdbl(xmm16, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 128));
|
||||
__ movdbl(xmm17, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 136));
|
||||
__ movdbl(xmm18, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 144));
|
||||
__ movdbl(xmm19, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 152));
|
||||
__ movdbl(xmm20, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 160));
|
||||
__ movdbl(xmm21, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 168));
|
||||
__ movdbl(xmm22, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 176));
|
||||
__ movdbl(xmm23, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 184));
|
||||
__ movdbl(xmm24, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 192));
|
||||
__ movdbl(xmm25, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 200));
|
||||
__ movdbl(xmm26, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 208));
|
||||
__ movdbl(xmm27, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 216));
|
||||
__ movdbl(xmm28, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 224));
|
||||
__ movdbl(xmm29, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 232));
|
||||
__ movdbl(xmm30, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 240));
|
||||
__ movdbl(xmm31, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 248));
|
||||
if (UseAVX < 3) {
|
||||
xmm_bypass_limit = xmm_bypass_limit / 2;
|
||||
}
|
||||
#endif
|
||||
int offset = 0;
|
||||
for (int n = 0; n < xmm_bypass_limit; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
__ movdbl(xmm_name, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset));
|
||||
offset += 8;
|
||||
}
|
||||
#endif // _LP64
|
||||
} else if (UseSSE == 1) {
|
||||
// restore XMM registers
|
||||
__ movflt(xmm0, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 0));
|
||||
__ movflt(xmm1, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 8));
|
||||
__ movflt(xmm2, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 16));
|
||||
__ movflt(xmm3, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 24));
|
||||
__ movflt(xmm4, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 32));
|
||||
__ movflt(xmm5, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 40));
|
||||
__ movflt(xmm6, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 48));
|
||||
__ movflt(xmm7, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + 56));
|
||||
// restore XMM registers(num MMX == num fpu)
|
||||
int offset = 0;
|
||||
for (int n = 0; n < FrameMap::nof_fpu_regs; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
__ movflt(xmm_name, Address(rsp, xmm_regs_as_doubles_off * VMRegImpl::stack_slot_size + offset));
|
||||
offset += 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (UseSSE < 2) {
|
||||
|
||||
@ -3751,8 +3751,31 @@ void MacroAssembler::pop_CPU_state() {
|
||||
}
|
||||
|
||||
void MacroAssembler::pop_FPU_state() {
|
||||
NOT_LP64(frstor(Address(rsp, 0));)
|
||||
LP64_ONLY(fxrstor(Address(rsp, 0));)
|
||||
#ifndef _LP64
|
||||
frstor(Address(rsp, 0));
|
||||
#else
|
||||
// AVX will continue to use the fxsave area.
|
||||
// EVEX needs to utilize the xsave area, which is under different
|
||||
// management.
|
||||
if(VM_Version::supports_evex()) {
|
||||
// EDX:EAX describe the XSAVE header and
|
||||
// are obtained while fetching info for XCR0 via cpuid.
|
||||
// These two registers make up 64-bits in the header for which bits
|
||||
// 62:10 are currently reserved for future implementations and unused. Bit 63
|
||||
// is unused for our implementation as we do not utilize
|
||||
// compressed XSAVE areas. Bits 9..8 are currently ignored as we do not use
|
||||
// the functionality for PKRU state and MSR tracing.
|
||||
// Ergo we are primarily concerned with bits 7..0, which define
|
||||
// which ISA extensions and features are enabled for a given machine and are
|
||||
// defined in XemXcr0Eax and is used to map the XSAVE area
|
||||
// for restoring registers as described via XCR0.
|
||||
movl(rdx,VM_Version::get_xsave_header_upper_segment());
|
||||
movl(rax,VM_Version::get_xsave_header_lower_segment());
|
||||
xrstor(Address(rsp, 0));
|
||||
} else {
|
||||
fxrstor(Address(rsp, 0));
|
||||
}
|
||||
#endif
|
||||
addptr(rsp, FPUStateSizeInWords * wordSize);
|
||||
}
|
||||
|
||||
@ -3769,13 +3792,49 @@ void MacroAssembler::push_CPU_state() {
|
||||
push_FPU_state();
|
||||
}
|
||||
|
||||
#ifdef _LP64
|
||||
#define XSTATE_BV 0x200
|
||||
#endif
|
||||
|
||||
void MacroAssembler::push_FPU_state() {
|
||||
subptr(rsp, FPUStateSizeInWords * wordSize);
|
||||
#ifndef _LP64
|
||||
fnsave(Address(rsp, 0));
|
||||
fwait();
|
||||
#else
|
||||
fxsave(Address(rsp, 0));
|
||||
// AVX will continue to use the fxsave area.
|
||||
// EVEX needs to utilize the xsave area, which is under different
|
||||
// management.
|
||||
if(VM_Version::supports_evex()) {
|
||||
// Save a copy of EAX and EDX
|
||||
push(rax);
|
||||
push(rdx);
|
||||
// EDX:EAX describe the XSAVE header and
|
||||
// are obtained while fetching info for XCR0 via cpuid.
|
||||
// These two registers make up 64-bits in the header for which bits
|
||||
// 62:10 are currently reserved for future implementations and unused. Bit 63
|
||||
// is unused for our implementation as we do not utilize
|
||||
// compressed XSAVE areas. Bits 9..8 are currently ignored as we do not use
|
||||
// the functionality for PKRU state and MSR tracing.
|
||||
// Ergo we are primarily concerned with bits 7..0, which define
|
||||
// which ISA extensions and features are enabled for a given machine and are
|
||||
// defined in XemXcr0Eax and is used to program XSAVE area
|
||||
// for saving the required registers as defined in XCR0.
|
||||
int xcr0_edx = VM_Version::get_xsave_header_upper_segment();
|
||||
int xcr0_eax = VM_Version::get_xsave_header_lower_segment();
|
||||
movl(rdx,xcr0_edx);
|
||||
movl(rax,xcr0_eax);
|
||||
xsave(Address(rsp, wordSize*2));
|
||||
// now Apply control bits and clear bytes 8..23 in the header
|
||||
pop(rdx);
|
||||
pop(rax);
|
||||
movl(Address(rsp, XSTATE_BV), xcr0_eax);
|
||||
movl(Address(rsp, XSTATE_BV+4), xcr0_edx);
|
||||
andq(Address(rsp, XSTATE_BV+8), 0);
|
||||
andq(Address(rsp, XSTATE_BV+16), 0);
|
||||
} else {
|
||||
fxsave(Address(rsp, 0));
|
||||
}
|
||||
#endif // LP64
|
||||
}
|
||||
|
||||
@ -4082,6 +4141,84 @@ void MacroAssembler::vsubss(XMMRegister dst, XMMRegister nds, AddressLiteral src
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::vnegatess(XMMRegister dst, XMMRegister nds, AddressLiteral src) {
|
||||
int nds_enc = nds->encoding();
|
||||
int dst_enc = dst->encoding();
|
||||
bool dst_upper_bank = (dst_enc > 15);
|
||||
bool nds_upper_bank = (nds_enc > 15);
|
||||
if (VM_Version::supports_avx512novl() &&
|
||||
(nds_upper_bank || dst_upper_bank)) {
|
||||
if (dst_upper_bank) {
|
||||
subptr(rsp, 64);
|
||||
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
|
||||
movflt(xmm0, nds);
|
||||
if (reachable(src)) {
|
||||
vxorps(xmm0, xmm0, as_Address(src), Assembler::AVX_128bit);
|
||||
} else {
|
||||
lea(rscratch1, src);
|
||||
vxorps(xmm0, xmm0, Address(rscratch1, 0), Assembler::AVX_128bit);
|
||||
}
|
||||
movflt(dst, xmm0);
|
||||
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
|
||||
addptr(rsp, 64);
|
||||
} else {
|
||||
movflt(dst, nds);
|
||||
if (reachable(src)) {
|
||||
vxorps(dst, dst, as_Address(src), Assembler::AVX_128bit);
|
||||
} else {
|
||||
lea(rscratch1, src);
|
||||
vxorps(dst, dst, Address(rscratch1, 0), Assembler::AVX_128bit);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (reachable(src)) {
|
||||
vxorps(dst, nds, as_Address(src), Assembler::AVX_128bit);
|
||||
} else {
|
||||
lea(rscratch1, src);
|
||||
vxorps(dst, nds, Address(rscratch1, 0), Assembler::AVX_128bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::vnegatesd(XMMRegister dst, XMMRegister nds, AddressLiteral src) {
|
||||
int nds_enc = nds->encoding();
|
||||
int dst_enc = dst->encoding();
|
||||
bool dst_upper_bank = (dst_enc > 15);
|
||||
bool nds_upper_bank = (nds_enc > 15);
|
||||
if (VM_Version::supports_avx512novl() &&
|
||||
(nds_upper_bank || dst_upper_bank)) {
|
||||
if (dst_upper_bank) {
|
||||
subptr(rsp, 64);
|
||||
evmovdqul(Address(rsp, 0), xmm0, Assembler::AVX_512bit);
|
||||
movdbl(xmm0, nds);
|
||||
if (reachable(src)) {
|
||||
vxorps(xmm0, xmm0, as_Address(src), Assembler::AVX_128bit);
|
||||
} else {
|
||||
lea(rscratch1, src);
|
||||
vxorps(xmm0, xmm0, Address(rscratch1, 0), Assembler::AVX_128bit);
|
||||
}
|
||||
movdbl(dst, xmm0);
|
||||
evmovdqul(xmm0, Address(rsp, 0), Assembler::AVX_512bit);
|
||||
addptr(rsp, 64);
|
||||
} else {
|
||||
movdbl(dst, nds);
|
||||
if (reachable(src)) {
|
||||
vxorps(dst, dst, as_Address(src), Assembler::AVX_128bit);
|
||||
} else {
|
||||
lea(rscratch1, src);
|
||||
vxorps(dst, dst, Address(rscratch1, 0), Assembler::AVX_128bit);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (reachable(src)) {
|
||||
vxorpd(dst, nds, as_Address(src), Assembler::AVX_128bit);
|
||||
} else {
|
||||
lea(rscratch1, src);
|
||||
vxorpd(dst, nds, Address(rscratch1, 0), Assembler::AVX_128bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::vxorpd(XMMRegister dst, XMMRegister nds, AddressLiteral src, int vector_len) {
|
||||
if (reachable(src)) {
|
||||
vxorpd(dst, nds, as_Address(src), vector_len);
|
||||
@ -4318,7 +4455,6 @@ void MacroAssembler::store_check(Register obj, Address dst) {
|
||||
void MacroAssembler::store_check(Register obj) {
|
||||
// Does a store check for the oop in register obj. The content of
|
||||
// register obj is destroyed afterwards.
|
||||
|
||||
BarrierSet* bs = Universe::heap()->barrier_set();
|
||||
assert(bs->kind() == BarrierSet::CardTableForRS ||
|
||||
bs->kind() == BarrierSet::CardTableExtension,
|
||||
@ -4572,69 +4708,58 @@ void MacroAssembler::fp_runtime_fallback(address runtime_entry, int nb_args, int
|
||||
|
||||
// if we are coming from c1, xmm registers may be live
|
||||
int off = 0;
|
||||
int num_xmm_regs = LP64_ONLY(16) NOT_LP64(8);
|
||||
if (UseAVX > 2) {
|
||||
num_xmm_regs = LP64_ONLY(32) NOT_LP64(8);
|
||||
}
|
||||
|
||||
if (UseSSE == 1) {
|
||||
subptr(rsp, sizeof(jdouble)*8);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm0);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm1);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm2);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm3);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm4);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm5);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm6);
|
||||
movflt(Address(rsp,off++*sizeof(jdouble)),xmm7);
|
||||
for (int n = 0; n < 8; n++) {
|
||||
movflt(Address(rsp, off++*sizeof(jdouble)), as_XMMRegister(n));
|
||||
}
|
||||
} else if (UseSSE >= 2) {
|
||||
if (UseAVX > 2) {
|
||||
push(rbx);
|
||||
movl(rbx, 0xffff);
|
||||
#ifdef _LP64
|
||||
kmovql(k1, rbx);
|
||||
#else
|
||||
kmovdl(k1, rbx);
|
||||
#endif
|
||||
kmovwl(k1, rbx);
|
||||
pop(rbx);
|
||||
}
|
||||
#ifdef COMPILER2
|
||||
if (MaxVectorSize > 16) {
|
||||
assert(UseAVX > 0, "256bit vectors are supported only with AVX");
|
||||
if(UseAVX > 2) {
|
||||
// Save upper half of ZMM registes
|
||||
subptr(rsp, 32*num_xmm_regs);
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
vextractf64x4h(Address(rsp, off++*32), as_XMMRegister(n));
|
||||
}
|
||||
off = 0;
|
||||
}
|
||||
assert(UseAVX > 0, "256 bit vectors are supported only with AVX");
|
||||
// Save upper half of YMM registes
|
||||
subptr(rsp, 16 * LP64_ONLY(16) NOT_LP64(8));
|
||||
vextractf128h(Address(rsp, 0),xmm0);
|
||||
vextractf128h(Address(rsp, 16),xmm1);
|
||||
vextractf128h(Address(rsp, 32),xmm2);
|
||||
vextractf128h(Address(rsp, 48),xmm3);
|
||||
vextractf128h(Address(rsp, 64),xmm4);
|
||||
vextractf128h(Address(rsp, 80),xmm5);
|
||||
vextractf128h(Address(rsp, 96),xmm6);
|
||||
vextractf128h(Address(rsp,112),xmm7);
|
||||
#ifdef _LP64
|
||||
vextractf128h(Address(rsp,128),xmm8);
|
||||
vextractf128h(Address(rsp,144),xmm9);
|
||||
vextractf128h(Address(rsp,160),xmm10);
|
||||
vextractf128h(Address(rsp,176),xmm11);
|
||||
vextractf128h(Address(rsp,192),xmm12);
|
||||
vextractf128h(Address(rsp,208),xmm13);
|
||||
vextractf128h(Address(rsp,224),xmm14);
|
||||
vextractf128h(Address(rsp,240),xmm15);
|
||||
#endif
|
||||
subptr(rsp, 16*num_xmm_regs);
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
vextractf128h(Address(rsp, off++*16), as_XMMRegister(n));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Save whole 128bit (16 bytes) XMM regiters
|
||||
subptr(rsp, 16 * LP64_ONLY(16) NOT_LP64(8));
|
||||
movdqu(Address(rsp,off++*16),xmm0);
|
||||
movdqu(Address(rsp,off++*16),xmm1);
|
||||
movdqu(Address(rsp,off++*16),xmm2);
|
||||
movdqu(Address(rsp,off++*16),xmm3);
|
||||
movdqu(Address(rsp,off++*16),xmm4);
|
||||
movdqu(Address(rsp,off++*16),xmm5);
|
||||
movdqu(Address(rsp,off++*16),xmm6);
|
||||
movdqu(Address(rsp,off++*16),xmm7);
|
||||
// Save whole 128bit (16 bytes) XMM registers
|
||||
subptr(rsp, 16*num_xmm_regs);
|
||||
off = 0;
|
||||
#ifdef _LP64
|
||||
movdqu(Address(rsp,off++*16),xmm8);
|
||||
movdqu(Address(rsp,off++*16),xmm9);
|
||||
movdqu(Address(rsp,off++*16),xmm10);
|
||||
movdqu(Address(rsp,off++*16),xmm11);
|
||||
movdqu(Address(rsp,off++*16),xmm12);
|
||||
movdqu(Address(rsp,off++*16),xmm13);
|
||||
movdqu(Address(rsp,off++*16),xmm14);
|
||||
movdqu(Address(rsp,off++*16),xmm15);
|
||||
if (VM_Version::supports_avx512novl()) {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
vextractf32x4h(Address(rsp, off++*16), as_XMMRegister(n), 0);
|
||||
}
|
||||
} else {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
movdqu(Address(rsp, off++*16), as_XMMRegister(n));
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
movdqu(Address(rsp, off++*16), as_XMMRegister(n));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -4689,7 +4814,7 @@ void MacroAssembler::fp_runtime_fallback(address runtime_entry, int nb_args, int
|
||||
movsd(Address(rsp, 0), xmm0);
|
||||
fld_d(Address(rsp, 0));
|
||||
#endif // _LP64
|
||||
addptr(rsp, sizeof(jdouble) * nb_args);
|
||||
addptr(rsp, sizeof(jdouble)*nb_args);
|
||||
if (num_fpu_regs_in_use > 1) {
|
||||
// Must save return value to stack and then restore entire FPU
|
||||
// stack except incoming arguments
|
||||
@ -4699,63 +4824,50 @@ void MacroAssembler::fp_runtime_fallback(address runtime_entry, int nb_args, int
|
||||
addptr(rsp, sizeof(jdouble));
|
||||
}
|
||||
fld_d(Address(rsp, (nb_args-1)*sizeof(jdouble)));
|
||||
addptr(rsp, sizeof(jdouble) * nb_args);
|
||||
addptr(rsp, sizeof(jdouble)*nb_args);
|
||||
}
|
||||
|
||||
off = 0;
|
||||
if (UseSSE == 1) {
|
||||
movflt(xmm0, Address(rsp,off++*sizeof(jdouble)));
|
||||
movflt(xmm1, Address(rsp,off++*sizeof(jdouble)));
|
||||
movflt(xmm2, Address(rsp,off++*sizeof(jdouble)));
|
||||
movflt(xmm3, Address(rsp,off++*sizeof(jdouble)));
|
||||
movflt(xmm4, Address(rsp,off++*sizeof(jdouble)));
|
||||
movflt(xmm5, Address(rsp,off++*sizeof(jdouble)));
|
||||
movflt(xmm6, Address(rsp,off++*sizeof(jdouble)));
|
||||
movflt(xmm7, Address(rsp,off++*sizeof(jdouble)));
|
||||
for (int n = 0; n < 8; n++) {
|
||||
movflt(as_XMMRegister(n), Address(rsp, off++*sizeof(jdouble)));
|
||||
}
|
||||
addptr(rsp, sizeof(jdouble)*8);
|
||||
} else if (UseSSE >= 2) {
|
||||
// Restore whole 128bit (16 bytes) XMM regiters
|
||||
movdqu(xmm0, Address(rsp,off++*16));
|
||||
movdqu(xmm1, Address(rsp,off++*16));
|
||||
movdqu(xmm2, Address(rsp,off++*16));
|
||||
movdqu(xmm3, Address(rsp,off++*16));
|
||||
movdqu(xmm4, Address(rsp,off++*16));
|
||||
movdqu(xmm5, Address(rsp,off++*16));
|
||||
movdqu(xmm6, Address(rsp,off++*16));
|
||||
movdqu(xmm7, Address(rsp,off++*16));
|
||||
#ifdef _LP64
|
||||
movdqu(xmm8, Address(rsp,off++*16));
|
||||
movdqu(xmm9, Address(rsp,off++*16));
|
||||
movdqu(xmm10, Address(rsp,off++*16));
|
||||
movdqu(xmm11, Address(rsp,off++*16));
|
||||
movdqu(xmm12, Address(rsp,off++*16));
|
||||
movdqu(xmm13, Address(rsp,off++*16));
|
||||
movdqu(xmm14, Address(rsp,off++*16));
|
||||
movdqu(xmm15, Address(rsp,off++*16));
|
||||
if (VM_Version::supports_avx512novl()) {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
vinsertf32x4h(as_XMMRegister(n), Address(rsp, off++*16), 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
movdqu(as_XMMRegister(n), Address(rsp, off++*16));
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
movdqu(as_XMMRegister(n), Address(rsp, off++ * 16));
|
||||
}
|
||||
#endif
|
||||
addptr(rsp, 16 * LP64_ONLY(16) NOT_LP64(8));
|
||||
addptr(rsp, 16*num_xmm_regs);
|
||||
|
||||
#ifdef COMPILER2
|
||||
if (MaxVectorSize > 16) {
|
||||
// Restore upper half of YMM registes.
|
||||
vinsertf128h(xmm0, Address(rsp, 0));
|
||||
vinsertf128h(xmm1, Address(rsp, 16));
|
||||
vinsertf128h(xmm2, Address(rsp, 32));
|
||||
vinsertf128h(xmm3, Address(rsp, 48));
|
||||
vinsertf128h(xmm4, Address(rsp, 64));
|
||||
vinsertf128h(xmm5, Address(rsp, 80));
|
||||
vinsertf128h(xmm6, Address(rsp, 96));
|
||||
vinsertf128h(xmm7, Address(rsp,112));
|
||||
#ifdef _LP64
|
||||
vinsertf128h(xmm8, Address(rsp,128));
|
||||
vinsertf128h(xmm9, Address(rsp,144));
|
||||
vinsertf128h(xmm10, Address(rsp,160));
|
||||
vinsertf128h(xmm11, Address(rsp,176));
|
||||
vinsertf128h(xmm12, Address(rsp,192));
|
||||
vinsertf128h(xmm13, Address(rsp,208));
|
||||
vinsertf128h(xmm14, Address(rsp,224));
|
||||
vinsertf128h(xmm15, Address(rsp,240));
|
||||
#endif
|
||||
addptr(rsp, 16 * LP64_ONLY(16) NOT_LP64(8));
|
||||
off = 0;
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
vinsertf128h(as_XMMRegister(n), Address(rsp, off++*16));
|
||||
}
|
||||
addptr(rsp, 16*num_xmm_regs);
|
||||
if(UseAVX > 2) {
|
||||
off = 0;
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
vinsertf64x4h(as_XMMRegister(n), Address(rsp, off++*32));
|
||||
}
|
||||
addptr(rsp, 32*num_xmm_regs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -7095,11 +7207,7 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned,
|
||||
Label L_fill_32_bytes_loop, L_check_fill_8_bytes, L_fill_8_bytes_loop, L_fill_8_bytes;
|
||||
if (UseAVX > 2) {
|
||||
movl(rtmp, 0xffff);
|
||||
#ifdef _LP64
|
||||
kmovql(k1, rtmp);
|
||||
#else
|
||||
kmovdl(k1, rtmp);
|
||||
#endif
|
||||
kmovwl(k1, rtmp);
|
||||
}
|
||||
movdl(xtmp, value);
|
||||
if (UseAVX > 2 && UseUnalignedLoadStores) {
|
||||
@ -7112,7 +7220,7 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned,
|
||||
align(16);
|
||||
|
||||
BIND(L_fill_64_bytes_loop);
|
||||
evmovdqu(Address(to, 0), xtmp, Assembler::AVX_512bit);
|
||||
evmovdqul(Address(to, 0), xtmp, Assembler::AVX_512bit);
|
||||
addptr(to, 64);
|
||||
subl(count, 16 << shift);
|
||||
jcc(Assembler::greaterEqual, L_fill_64_bytes_loop);
|
||||
@ -7120,7 +7228,7 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned,
|
||||
BIND(L_check_fill_32_bytes);
|
||||
addl(count, 8 << shift);
|
||||
jccb(Assembler::less, L_check_fill_8_bytes);
|
||||
evmovdqu(Address(to, 0), xtmp, Assembler::AVX_256bit);
|
||||
evmovdqul(Address(to, 0), xtmp, Assembler::AVX_256bit);
|
||||
addptr(to, 32);
|
||||
subl(count, 8 << shift);
|
||||
|
||||
@ -8399,6 +8507,14 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, Regi
|
||||
Label L_tail, L_tail_restore, L_tail_loop, L_exit, L_align_loop, L_aligned;
|
||||
Label L_fold_tail, L_fold_128b, L_fold_512b, L_fold_512b_loop, L_fold_tail_loop;
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
movl(tmp, 0xffff);
|
||||
kmovwl(k1, tmp);
|
||||
}
|
||||
|
||||
lea(table, ExternalAddress(StubRoutines::crc_table_addr()));
|
||||
notl(crc); // ~crc
|
||||
cmpl(len, 16);
|
||||
|
||||
@ -1069,6 +1069,9 @@ public:
|
||||
void vsubss(XMMRegister dst, XMMRegister nds, Address src) { Assembler::vsubss(dst, nds, src); }
|
||||
void vsubss(XMMRegister dst, XMMRegister nds, AddressLiteral src);
|
||||
|
||||
void vnegatess(XMMRegister dst, XMMRegister nds, AddressLiteral src);
|
||||
void vnegatesd(XMMRegister dst, XMMRegister nds, AddressLiteral src);
|
||||
|
||||
// AVX Vector instructions
|
||||
|
||||
void vxorpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { Assembler::vxorpd(dst, nds, src, vector_len); }
|
||||
|
||||
@ -115,6 +115,7 @@ class RegisterSaver {
|
||||
OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_frame_words,
|
||||
int* total_frame_words, bool verify_fpu, bool save_vectors) {
|
||||
int vect_words = 0;
|
||||
int num_xmm_regs = XMMRegisterImpl::number_of_registers;
|
||||
#ifdef COMPILER2
|
||||
if (save_vectors) {
|
||||
assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
|
||||
@ -173,59 +174,50 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
|
||||
__ fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std()));
|
||||
}
|
||||
|
||||
int off = st0_off;
|
||||
int delta = st1_off - off;
|
||||
|
||||
// Save the FPU registers in de-opt-able form
|
||||
for (int n = 0; n < FloatRegisterImpl::number_of_registers; n++) {
|
||||
__ fstp_d(Address(rsp, off*wordSize));
|
||||
off += delta;
|
||||
}
|
||||
|
||||
__ fstp_d(Address(rsp, st0_off*wordSize)); // st(0)
|
||||
__ fstp_d(Address(rsp, st1_off*wordSize)); // st(1)
|
||||
__ fstp_d(Address(rsp, st2_off*wordSize)); // st(2)
|
||||
__ fstp_d(Address(rsp, st3_off*wordSize)); // st(3)
|
||||
__ fstp_d(Address(rsp, st4_off*wordSize)); // st(4)
|
||||
__ fstp_d(Address(rsp, st5_off*wordSize)); // st(5)
|
||||
__ fstp_d(Address(rsp, st6_off*wordSize)); // st(6)
|
||||
__ fstp_d(Address(rsp, st7_off*wordSize)); // st(7)
|
||||
|
||||
if( UseSSE == 1 ) { // Save the XMM state
|
||||
__ movflt(Address(rsp,xmm0_off*wordSize),xmm0);
|
||||
__ movflt(Address(rsp,xmm1_off*wordSize),xmm1);
|
||||
__ movflt(Address(rsp,xmm2_off*wordSize),xmm2);
|
||||
__ movflt(Address(rsp,xmm3_off*wordSize),xmm3);
|
||||
__ movflt(Address(rsp,xmm4_off*wordSize),xmm4);
|
||||
__ movflt(Address(rsp,xmm5_off*wordSize),xmm5);
|
||||
__ movflt(Address(rsp,xmm6_off*wordSize),xmm6);
|
||||
__ movflt(Address(rsp,xmm7_off*wordSize),xmm7);
|
||||
} else if( UseSSE >= 2 ) {
|
||||
off = xmm0_off;
|
||||
delta = xmm1_off - off;
|
||||
if(UseSSE == 1) { // Save the XMM state
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ movflt(Address(rsp, off*wordSize), as_XMMRegister(n));
|
||||
off += delta;
|
||||
}
|
||||
} else if(UseSSE >= 2) {
|
||||
// Save whole 128bit (16 bytes) XMM regiters
|
||||
__ movdqu(Address(rsp,xmm0_off*wordSize),xmm0);
|
||||
__ movdqu(Address(rsp,xmm1_off*wordSize),xmm1);
|
||||
__ movdqu(Address(rsp,xmm2_off*wordSize),xmm2);
|
||||
__ movdqu(Address(rsp,xmm3_off*wordSize),xmm3);
|
||||
__ movdqu(Address(rsp,xmm4_off*wordSize),xmm4);
|
||||
__ movdqu(Address(rsp,xmm5_off*wordSize),xmm5);
|
||||
__ movdqu(Address(rsp,xmm6_off*wordSize),xmm6);
|
||||
__ movdqu(Address(rsp,xmm7_off*wordSize),xmm7);
|
||||
if (VM_Version::supports_avx512novl()) {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vextractf32x4h(Address(rsp, off*wordSize), as_XMMRegister(n), 0);
|
||||
off += delta;
|
||||
}
|
||||
} else {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ movdqu(Address(rsp, off*wordSize), as_XMMRegister(n));
|
||||
off += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vect_words > 0) {
|
||||
assert(vect_words*wordSize == 128, "");
|
||||
__ subptr(rsp, 128); // Save upper half of YMM registes
|
||||
__ vextractf128h(Address(rsp, 0),xmm0);
|
||||
__ vextractf128h(Address(rsp, 16),xmm1);
|
||||
__ vextractf128h(Address(rsp, 32),xmm2);
|
||||
__ vextractf128h(Address(rsp, 48),xmm3);
|
||||
__ vextractf128h(Address(rsp, 64),xmm4);
|
||||
__ vextractf128h(Address(rsp, 80),xmm5);
|
||||
__ vextractf128h(Address(rsp, 96),xmm6);
|
||||
__ vextractf128h(Address(rsp,112),xmm7);
|
||||
off = 0;
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vextractf128h(Address(rsp, off++*16), as_XMMRegister(n));
|
||||
}
|
||||
if (UseAVX > 2) {
|
||||
__ subptr(rsp, 256); // Save upper half of ZMM registes
|
||||
__ vextractf64x4h(Address(rsp, 0), xmm0);
|
||||
__ vextractf64x4h(Address(rsp, 32), xmm1);
|
||||
__ vextractf64x4h(Address(rsp, 64), xmm2);
|
||||
__ vextractf64x4h(Address(rsp, 96), xmm3);
|
||||
__ vextractf64x4h(Address(rsp, 128), xmm4);
|
||||
__ vextractf64x4h(Address(rsp, 160), xmm5);
|
||||
__ vextractf64x4h(Address(rsp, 192), xmm6);
|
||||
__ vextractf64x4h(Address(rsp, 224), xmm7);
|
||||
off = 0;
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vextractf64x4h(Address(rsp, off++*32), as_XMMRegister(n));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,58 +230,40 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
|
||||
OopMap* map = new OopMap( frame_words, 0 );
|
||||
|
||||
#define STACK_OFFSET(x) VMRegImpl::stack2reg((x) + additional_frame_words)
|
||||
|
||||
map->set_callee_saved(STACK_OFFSET( rax_off), rax->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET( rcx_off), rcx->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET( rdx_off), rdx->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET( rbx_off), rbx->as_VMReg());
|
||||
// rbp, location is known implicitly, no oopMap
|
||||
map->set_callee_saved(STACK_OFFSET( rsi_off), rsi->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET( rdi_off), rdi->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st0_off), as_FloatRegister(0)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st1_off), as_FloatRegister(1)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st2_off), as_FloatRegister(2)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st3_off), as_FloatRegister(3)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st4_off), as_FloatRegister(4)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st5_off), as_FloatRegister(5)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st6_off), as_FloatRegister(6)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(st7_off), as_FloatRegister(7)->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm0_off), xmm0->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm1_off), xmm1->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm2_off), xmm2->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm3_off), xmm3->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm4_off), xmm4->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm5_off), xmm5->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm6_off), xmm6->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm7_off), xmm7->as_VMReg());
|
||||
// %%% This is really a waste but we'll keep things as they were for now
|
||||
if (true) {
|
||||
#define NEXTREG(x) (x)->as_VMReg()->next()
|
||||
map->set_callee_saved(STACK_OFFSET(st0H_off), NEXTREG(as_FloatRegister(0)));
|
||||
map->set_callee_saved(STACK_OFFSET(st1H_off), NEXTREG(as_FloatRegister(1)));
|
||||
map->set_callee_saved(STACK_OFFSET(st2H_off), NEXTREG(as_FloatRegister(2)));
|
||||
map->set_callee_saved(STACK_OFFSET(st3H_off), NEXTREG(as_FloatRegister(3)));
|
||||
map->set_callee_saved(STACK_OFFSET(st4H_off), NEXTREG(as_FloatRegister(4)));
|
||||
map->set_callee_saved(STACK_OFFSET(st5H_off), NEXTREG(as_FloatRegister(5)));
|
||||
map->set_callee_saved(STACK_OFFSET(st6H_off), NEXTREG(as_FloatRegister(6)));
|
||||
map->set_callee_saved(STACK_OFFSET(st7H_off), NEXTREG(as_FloatRegister(7)));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm0H_off), NEXTREG(xmm0));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm1H_off), NEXTREG(xmm1));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm2H_off), NEXTREG(xmm2));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm3H_off), NEXTREG(xmm3));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm4H_off), NEXTREG(xmm4));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm5H_off), NEXTREG(xmm5));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm6H_off), NEXTREG(xmm6));
|
||||
map->set_callee_saved(STACK_OFFSET(xmm7H_off), NEXTREG(xmm7));
|
||||
|
||||
map->set_callee_saved(STACK_OFFSET(rax_off), rax->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(rcx_off), rcx->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(rdx_off), rdx->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(rbx_off), rbx->as_VMReg());
|
||||
// rbp, location is known implicitly, no oopMap
|
||||
map->set_callee_saved(STACK_OFFSET(rsi_off), rsi->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(rdi_off), rdi->as_VMReg());
|
||||
// %%% This is really a waste but we'll keep things as they were for now for the upper component
|
||||
off = st0_off;
|
||||
delta = st1_off - off;
|
||||
for (int n = 0; n < FloatRegisterImpl::number_of_registers; n++) {
|
||||
FloatRegister freg_name = as_FloatRegister(n);
|
||||
map->set_callee_saved(STACK_OFFSET(off), freg_name->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(off+1), NEXTREG(freg_name));
|
||||
off += delta;
|
||||
}
|
||||
off = xmm0_off;
|
||||
delta = xmm1_off - off;
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
map->set_callee_saved(STACK_OFFSET(off), xmm_name->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(off+1), NEXTREG(xmm_name));
|
||||
off += delta;
|
||||
}
|
||||
#undef NEXTREG
|
||||
#undef STACK_OFFSET
|
||||
}
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
void RegisterSaver::restore_live_registers(MacroAssembler* masm, bool restore_vectors) {
|
||||
int num_xmm_regs = XMMRegisterImpl::number_of_registers;
|
||||
// Recover XMM & FPU state
|
||||
int additional_frame_bytes = 0;
|
||||
#ifdef COMPILER2
|
||||
@ -301,52 +275,43 @@ void RegisterSaver::restore_live_registers(MacroAssembler* masm, bool restore_ve
|
||||
#else
|
||||
assert(!restore_vectors, "vectors are generated only by C2");
|
||||
#endif
|
||||
int off = xmm0_off;
|
||||
int delta = xmm1_off - off;
|
||||
|
||||
if (UseSSE == 1) {
|
||||
assert(additional_frame_bytes == 0, "");
|
||||
__ movflt(xmm0,Address(rsp,xmm0_off*wordSize));
|
||||
__ movflt(xmm1,Address(rsp,xmm1_off*wordSize));
|
||||
__ movflt(xmm2,Address(rsp,xmm2_off*wordSize));
|
||||
__ movflt(xmm3,Address(rsp,xmm3_off*wordSize));
|
||||
__ movflt(xmm4,Address(rsp,xmm4_off*wordSize));
|
||||
__ movflt(xmm5,Address(rsp,xmm5_off*wordSize));
|
||||
__ movflt(xmm6,Address(rsp,xmm6_off*wordSize));
|
||||
__ movflt(xmm7,Address(rsp,xmm7_off*wordSize));
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ movflt(as_XMMRegister(n), Address(rsp, off*wordSize));
|
||||
off += delta;
|
||||
}
|
||||
} else if (UseSSE >= 2) {
|
||||
#define STACK_ADDRESS(x) Address(rsp,(x)*wordSize + additional_frame_bytes)
|
||||
__ movdqu(xmm0,STACK_ADDRESS(xmm0_off));
|
||||
__ movdqu(xmm1,STACK_ADDRESS(xmm1_off));
|
||||
__ movdqu(xmm2,STACK_ADDRESS(xmm2_off));
|
||||
__ movdqu(xmm3,STACK_ADDRESS(xmm3_off));
|
||||
__ movdqu(xmm4,STACK_ADDRESS(xmm4_off));
|
||||
__ movdqu(xmm5,STACK_ADDRESS(xmm5_off));
|
||||
__ movdqu(xmm6,STACK_ADDRESS(xmm6_off));
|
||||
__ movdqu(xmm7,STACK_ADDRESS(xmm7_off));
|
||||
#undef STACK_ADDRESS
|
||||
if (VM_Version::supports_avx512novl()) {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vinsertf32x4h(as_XMMRegister(n), Address(rsp, off*wordSize+additional_frame_bytes), 0);
|
||||
off += delta;
|
||||
}
|
||||
} else {
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ movdqu(as_XMMRegister(n), Address(rsp, off*wordSize+additional_frame_bytes));
|
||||
off += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (restore_vectors) {
|
||||
if (UseAVX > 2) {
|
||||
off = 0;
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vinsertf64x4h(as_XMMRegister(n), Address(rsp, off++*32));
|
||||
}
|
||||
__ addptr(rsp, additional_frame_bytes*2); // Save upper half of ZMM registes
|
||||
}
|
||||
// Restore upper half of YMM registes.
|
||||
assert(additional_frame_bytes == 128, "");
|
||||
__ vinsertf128h(xmm0, Address(rsp, 0));
|
||||
__ vinsertf128h(xmm1, Address(rsp, 16));
|
||||
__ vinsertf128h(xmm2, Address(rsp, 32));
|
||||
__ vinsertf128h(xmm3, Address(rsp, 48));
|
||||
__ vinsertf128h(xmm4, Address(rsp, 64));
|
||||
__ vinsertf128h(xmm5, Address(rsp, 80));
|
||||
__ vinsertf128h(xmm6, Address(rsp, 96));
|
||||
__ vinsertf128h(xmm7, Address(rsp,112));
|
||||
__ addptr(rsp, additional_frame_bytes);
|
||||
if (UseAVX > 2) {
|
||||
additional_frame_bytes = 256;
|
||||
__ vinsertf64x4h(xmm0, Address(rsp, 0));
|
||||
__ vinsertf64x4h(xmm1, Address(rsp, 32));
|
||||
__ vinsertf64x4h(xmm2, Address(rsp, 64));
|
||||
__ vinsertf64x4h(xmm3, Address(rsp, 96));
|
||||
__ vinsertf64x4h(xmm4, Address(rsp, 128));
|
||||
__ vinsertf64x4h(xmm5, Address(rsp, 160));
|
||||
__ vinsertf64x4h(xmm6, Address(rsp, 192));
|
||||
__ vinsertf64x4h(xmm7, Address(rsp, 224));
|
||||
__ addptr(rsp, additional_frame_bytes);
|
||||
off = 0;
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vinsertf128h(as_XMMRegister(n), Address(rsp, off++*16));
|
||||
}
|
||||
__ addptr(rsp, additional_frame_bytes); // Save upper half of YMM registes
|
||||
}
|
||||
__ pop_FPU_state();
|
||||
__ addptr(rsp, FPU_regs_live*wordSize); // Pop FPU registers
|
||||
|
||||
@ -69,7 +69,9 @@ class SimpleRuntimeFrame {
|
||||
class RegisterSaver {
|
||||
// Capture info about frame layout. Layout offsets are in jint
|
||||
// units because compiler frame slots are jints.
|
||||
#define HALF_ZMM_BANK_WORDS 128
|
||||
#define DEF_XMM_OFFS(regnum) xmm ## regnum ## _off = xmm_off + (regnum)*16/BytesPerInt, xmm ## regnum ## H_off
|
||||
#define DEF_ZMM_OFFS(regnum) zmm ## regnum ## _off = zmm_off + (regnum-16)*64/BytesPerInt, zmm ## regnum ## H_off
|
||||
enum layout {
|
||||
fpu_state_off = frame::arg_reg_save_area_bytes/BytesPerInt, // fxsave save area
|
||||
xmm_off = fpu_state_off + 160/BytesPerInt, // offset in fxsave save area
|
||||
@ -89,23 +91,24 @@ class RegisterSaver {
|
||||
DEF_XMM_OFFS(13),
|
||||
DEF_XMM_OFFS(14),
|
||||
DEF_XMM_OFFS(15),
|
||||
DEF_XMM_OFFS(16),
|
||||
DEF_XMM_OFFS(17),
|
||||
DEF_XMM_OFFS(18),
|
||||
DEF_XMM_OFFS(19),
|
||||
DEF_XMM_OFFS(20),
|
||||
DEF_XMM_OFFS(21),
|
||||
DEF_XMM_OFFS(22),
|
||||
DEF_XMM_OFFS(23),
|
||||
DEF_XMM_OFFS(24),
|
||||
DEF_XMM_OFFS(25),
|
||||
DEF_XMM_OFFS(26),
|
||||
DEF_XMM_OFFS(27),
|
||||
DEF_XMM_OFFS(28),
|
||||
DEF_XMM_OFFS(29),
|
||||
DEF_XMM_OFFS(30),
|
||||
DEF_XMM_OFFS(31),
|
||||
fpu_state_end = fpu_state_off + ((FPUStateSizeInWords - 1)*wordSize / BytesPerInt),
|
||||
zmm_off = fpu_state_off + ((FPUStateSizeInWords - (HALF_ZMM_BANK_WORDS + 1))*wordSize / BytesPerInt),
|
||||
DEF_ZMM_OFFS(16),
|
||||
DEF_ZMM_OFFS(17),
|
||||
DEF_ZMM_OFFS(18),
|
||||
DEF_ZMM_OFFS(19),
|
||||
DEF_ZMM_OFFS(20),
|
||||
DEF_ZMM_OFFS(21),
|
||||
DEF_ZMM_OFFS(22),
|
||||
DEF_ZMM_OFFS(23),
|
||||
DEF_ZMM_OFFS(24),
|
||||
DEF_ZMM_OFFS(25),
|
||||
DEF_ZMM_OFFS(26),
|
||||
DEF_ZMM_OFFS(27),
|
||||
DEF_ZMM_OFFS(28),
|
||||
DEF_ZMM_OFFS(29),
|
||||
DEF_ZMM_OFFS(30),
|
||||
DEF_ZMM_OFFS(31),
|
||||
fpu_state_end = fpu_state_off + ((FPUStateSizeInWords-1)*wordSize / BytesPerInt),
|
||||
fpu_stateH_end,
|
||||
r15_off, r15H_off,
|
||||
r14_off, r14H_off,
|
||||
@ -155,9 +158,10 @@ class RegisterSaver {
|
||||
|
||||
OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_frame_words, int* total_frame_words, bool save_vectors) {
|
||||
int vect_words = 0;
|
||||
int num_xmm_regs = 16;
|
||||
if (UseAVX > 2) {
|
||||
num_xmm_regs = 32;
|
||||
int off = 0;
|
||||
int num_xmm_regs = XMMRegisterImpl::number_of_registers;
|
||||
if (UseAVX < 3) {
|
||||
num_xmm_regs = num_xmm_regs/2;
|
||||
}
|
||||
#ifdef COMPILER2
|
||||
if (save_vectors) {
|
||||
@ -165,9 +169,7 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
|
||||
assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
|
||||
// Save upper half of YMM registers
|
||||
vect_words = 16 * num_xmm_regs / wordSize;
|
||||
additional_frame_words += vect_words;
|
||||
if (UseAVX > 2) {
|
||||
// Save upper half of ZMM registers as well
|
||||
if (UseAVX < 3) {
|
||||
additional_frame_words += vect_words;
|
||||
}
|
||||
}
|
||||
@ -195,77 +197,13 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
|
||||
__ enter(); // rsp becomes 16-byte aligned here
|
||||
__ push_CPU_state(); // Push a multiple of 16 bytes
|
||||
|
||||
if (vect_words > 0) {
|
||||
// push cpu state handles this on EVEX enabled targets
|
||||
if ((vect_words > 0) && (UseAVX < 3)) {
|
||||
assert(vect_words*wordSize >= 256, "");
|
||||
__ subptr(rsp, 256); // Save upper half of YMM registes(0..15)
|
||||
__ vextractf128h(Address(rsp, 0), xmm0);
|
||||
__ vextractf128h(Address(rsp, 16), xmm1);
|
||||
__ vextractf128h(Address(rsp, 32), xmm2);
|
||||
__ vextractf128h(Address(rsp, 48), xmm3);
|
||||
__ vextractf128h(Address(rsp, 64), xmm4);
|
||||
__ vextractf128h(Address(rsp, 80), xmm5);
|
||||
__ vextractf128h(Address(rsp, 96), xmm6);
|
||||
__ vextractf128h(Address(rsp, 112), xmm7);
|
||||
__ vextractf128h(Address(rsp, 128), xmm8);
|
||||
__ vextractf128h(Address(rsp, 144), xmm9);
|
||||
__ vextractf128h(Address(rsp, 160), xmm10);
|
||||
__ vextractf128h(Address(rsp, 176), xmm11);
|
||||
__ vextractf128h(Address(rsp, 192), xmm12);
|
||||
__ vextractf128h(Address(rsp, 208), xmm13);
|
||||
__ vextractf128h(Address(rsp, 224), xmm14);
|
||||
__ vextractf128h(Address(rsp, 240), xmm15);
|
||||
if (UseAVX > 2) {
|
||||
__ subptr(rsp, 256); // Save upper half of YMM registes(16..31)
|
||||
__ vextractf128h(Address(rsp, 0), xmm16);
|
||||
__ vextractf128h(Address(rsp, 16), xmm17);
|
||||
__ vextractf128h(Address(rsp, 32), xmm18);
|
||||
__ vextractf128h(Address(rsp, 48), xmm19);
|
||||
__ vextractf128h(Address(rsp, 64), xmm20);
|
||||
__ vextractf128h(Address(rsp, 80), xmm21);
|
||||
__ vextractf128h(Address(rsp, 96), xmm22);
|
||||
__ vextractf128h(Address(rsp, 112), xmm23);
|
||||
__ vextractf128h(Address(rsp, 128), xmm24);
|
||||
__ vextractf128h(Address(rsp, 144), xmm25);
|
||||
__ vextractf128h(Address(rsp, 160), xmm26);
|
||||
__ vextractf128h(Address(rsp, 176), xmm27);
|
||||
__ vextractf128h(Address(rsp, 192), xmm28);
|
||||
__ vextractf128h(Address(rsp, 208), xmm29);
|
||||
__ vextractf128h(Address(rsp, 224), xmm30);
|
||||
__ vextractf128h(Address(rsp, 240), xmm31);
|
||||
// Now handle the ZMM registers (0..31)
|
||||
__ subptr(rsp, 1024); // Save upper half of ZMM registes
|
||||
__ vextractf64x4h(Address(rsp, 0), xmm0);
|
||||
__ vextractf64x4h(Address(rsp, 32), xmm1);
|
||||
__ vextractf64x4h(Address(rsp, 64), xmm2);
|
||||
__ vextractf64x4h(Address(rsp, 96), xmm3);
|
||||
__ vextractf64x4h(Address(rsp, 128), xmm4);
|
||||
__ vextractf64x4h(Address(rsp, 160), xmm5);
|
||||
__ vextractf64x4h(Address(rsp, 192), xmm6);
|
||||
__ vextractf64x4h(Address(rsp, 224), xmm7);
|
||||
__ vextractf64x4h(Address(rsp, 256), xmm8);
|
||||
__ vextractf64x4h(Address(rsp, 288), xmm9);
|
||||
__ vextractf64x4h(Address(rsp, 320), xmm10);
|
||||
__ vextractf64x4h(Address(rsp, 352), xmm11);
|
||||
__ vextractf64x4h(Address(rsp, 384), xmm12);
|
||||
__ vextractf64x4h(Address(rsp, 416), xmm13);
|
||||
__ vextractf64x4h(Address(rsp, 448), xmm14);
|
||||
__ vextractf64x4h(Address(rsp, 480), xmm15);
|
||||
__ vextractf64x4h(Address(rsp, 512), xmm16);
|
||||
__ vextractf64x4h(Address(rsp, 544), xmm17);
|
||||
__ vextractf64x4h(Address(rsp, 576), xmm18);
|
||||
__ vextractf64x4h(Address(rsp, 608), xmm19);
|
||||
__ vextractf64x4h(Address(rsp, 640), xmm20);
|
||||
__ vextractf64x4h(Address(rsp, 672), xmm21);
|
||||
__ vextractf64x4h(Address(rsp, 704), xmm22);
|
||||
__ vextractf64x4h(Address(rsp, 736), xmm23);
|
||||
__ vextractf64x4h(Address(rsp, 768), xmm24);
|
||||
__ vextractf64x4h(Address(rsp, 800), xmm25);
|
||||
__ vextractf64x4h(Address(rsp, 832), xmm26);
|
||||
__ vextractf64x4h(Address(rsp, 864), xmm27);
|
||||
__ vextractf64x4h(Address(rsp, 896), xmm28);
|
||||
__ vextractf64x4h(Address(rsp, 928), xmm29);
|
||||
__ vextractf64x4h(Address(rsp, 960), xmm30);
|
||||
__ vextractf64x4h(Address(rsp, 992), xmm31);
|
||||
// Save upper half of YMM registes(0..num_xmm_regs)
|
||||
__ subptr(rsp, num_xmm_regs*16);
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vextractf128h(Address(rsp, off++*16), as_XMMRegister(n));
|
||||
}
|
||||
}
|
||||
if (frame::arg_reg_save_area_bytes != 0) {
|
||||
@ -299,39 +237,24 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
|
||||
map->set_callee_saved(STACK_OFFSET( r13_off ), r13->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET( r14_off ), r14->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET( r15_off ), r15->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm0_off ), xmm0->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm1_off ), xmm1->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm2_off ), xmm2->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm3_off ), xmm3->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm4_off ), xmm4->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm5_off ), xmm5->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm6_off ), xmm6->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm7_off ), xmm7->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm8_off ), xmm8->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm9_off ), xmm9->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm10_off), xmm10->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm11_off), xmm11->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm12_off), xmm12->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm13_off), xmm13->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm14_off), xmm14->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm15_off), xmm15->as_VMReg());
|
||||
if (UseAVX > 2) {
|
||||
map->set_callee_saved(STACK_OFFSET(xmm16_off), xmm16->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm17_off), xmm17->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm18_off), xmm18->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm19_off), xmm19->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm20_off), xmm20->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm21_off), xmm21->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm22_off), xmm22->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm23_off), xmm23->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm24_off), xmm24->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm25_off), xmm25->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm26_off), xmm26->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm27_off), xmm27->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm28_off), xmm28->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm29_off), xmm29->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm30_off), xmm30->as_VMReg());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm31_off), xmm31->as_VMReg());
|
||||
// For both AVX and EVEX we will use the legacy FXSAVE area for xmm0..xmm15,
|
||||
// on EVEX enabled targets, we get it included in the xsave area
|
||||
off = xmm0_off;
|
||||
int delta = xmm1_off - off;
|
||||
for (int n = 0; n < 16; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
map->set_callee_saved(STACK_OFFSET(off), xmm_name->as_VMReg());
|
||||
off += delta;
|
||||
}
|
||||
if(UseAVX > 2) {
|
||||
// Obtain xmm16..xmm31 from the XSAVE area on EVEX enabled targets
|
||||
off = zmm16_off;
|
||||
delta = zmm17_off - off;
|
||||
for (int n = 16; n < num_xmm_regs; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
map->set_callee_saved(STACK_OFFSET(off), xmm_name->as_VMReg());
|
||||
off += delta;
|
||||
}
|
||||
}
|
||||
|
||||
// %%% These should all be a waste but we'll keep things as they were for now
|
||||
@ -351,39 +274,24 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
|
||||
map->set_callee_saved(STACK_OFFSET( r13H_off ), r13->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET( r14H_off ), r14->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET( r15H_off ), r15->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm0H_off ), xmm0->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm1H_off ), xmm1->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm2H_off ), xmm2->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm3H_off ), xmm3->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm4H_off ), xmm4->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm5H_off ), xmm5->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm6H_off ), xmm6->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm7H_off ), xmm7->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm8H_off ), xmm8->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm9H_off ), xmm9->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm10H_off), xmm10->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm11H_off), xmm11->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm12H_off), xmm12->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm13H_off), xmm13->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm14H_off), xmm14->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm15H_off), xmm15->as_VMReg()->next());
|
||||
// For both AVX and EVEX we will use the legacy FXSAVE area for xmm0..xmm15,
|
||||
// on EVEX enabled targets, we get it included in the xsave area
|
||||
off = xmm0H_off;
|
||||
delta = xmm1H_off - off;
|
||||
for (int n = 0; n < 16; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
map->set_callee_saved(STACK_OFFSET(off), xmm_name->as_VMReg()->next());
|
||||
off += delta;
|
||||
}
|
||||
if (UseAVX > 2) {
|
||||
map->set_callee_saved(STACK_OFFSET(xmm16H_off), xmm16->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm17H_off), xmm17->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm18H_off), xmm18->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm19H_off), xmm19->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm20H_off), xmm20->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm21H_off), xmm21->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm22H_off), xmm22->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm23H_off), xmm23->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm24H_off), xmm24->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm25H_off), xmm25->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm26H_off), xmm26->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm27H_off), xmm27->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm28H_off), xmm28->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm29H_off), xmm29->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm30H_off), xmm30->as_VMReg()->next());
|
||||
map->set_callee_saved(STACK_OFFSET(xmm31H_off), xmm31->as_VMReg()->next());
|
||||
// Obtain xmm16..xmm31 from the XSAVE area on EVEX enabled targets
|
||||
off = zmm16H_off;
|
||||
delta = zmm17H_off - off;
|
||||
for (int n = 16; n < num_xmm_regs; n++) {
|
||||
XMMRegister xmm_name = as_XMMRegister(n);
|
||||
map->set_callee_saved(STACK_OFFSET(off), xmm_name->as_VMReg()->next());
|
||||
off += delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -391,86 +299,25 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_
|
||||
}
|
||||
|
||||
void RegisterSaver::restore_live_registers(MacroAssembler* masm, bool restore_vectors) {
|
||||
int num_xmm_regs = XMMRegisterImpl::number_of_registers;
|
||||
if (UseAVX < 3) {
|
||||
num_xmm_regs = num_xmm_regs/2;
|
||||
}
|
||||
if (frame::arg_reg_save_area_bytes != 0) {
|
||||
// Pop arg register save area
|
||||
__ addptr(rsp, frame::arg_reg_save_area_bytes);
|
||||
}
|
||||
#ifdef COMPILER2
|
||||
if (restore_vectors) {
|
||||
// Restore upper half of YMM registes (0..15)
|
||||
assert(UseAVX > 0, "512bit vectors are supported only with AVX");
|
||||
assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
|
||||
__ vinsertf128h(xmm0, Address(rsp, 0));
|
||||
__ vinsertf128h(xmm1, Address(rsp, 16));
|
||||
__ vinsertf128h(xmm2, Address(rsp, 32));
|
||||
__ vinsertf128h(xmm3, Address(rsp, 48));
|
||||
__ vinsertf128h(xmm4, Address(rsp, 64));
|
||||
__ vinsertf128h(xmm5, Address(rsp, 80));
|
||||
__ vinsertf128h(xmm6, Address(rsp, 96));
|
||||
__ vinsertf128h(xmm7, Address(rsp,112));
|
||||
__ vinsertf128h(xmm8, Address(rsp,128));
|
||||
__ vinsertf128h(xmm9, Address(rsp,144));
|
||||
__ vinsertf128h(xmm10, Address(rsp,160));
|
||||
__ vinsertf128h(xmm11, Address(rsp,176));
|
||||
__ vinsertf128h(xmm12, Address(rsp,192));
|
||||
__ vinsertf128h(xmm13, Address(rsp,208));
|
||||
__ vinsertf128h(xmm14, Address(rsp,224));
|
||||
__ vinsertf128h(xmm15, Address(rsp,240));
|
||||
__ addptr(rsp, 256);
|
||||
if (UseAVX > 2) {
|
||||
// Restore upper half of YMM registes (16..31)
|
||||
__ vinsertf128h(xmm16, Address(rsp, 0));
|
||||
__ vinsertf128h(xmm17, Address(rsp, 16));
|
||||
__ vinsertf128h(xmm18, Address(rsp, 32));
|
||||
__ vinsertf128h(xmm19, Address(rsp, 48));
|
||||
__ vinsertf128h(xmm20, Address(rsp, 64));
|
||||
__ vinsertf128h(xmm21, Address(rsp, 80));
|
||||
__ vinsertf128h(xmm22, Address(rsp, 96));
|
||||
__ vinsertf128h(xmm23, Address(rsp,112));
|
||||
__ vinsertf128h(xmm24, Address(rsp,128));
|
||||
__ vinsertf128h(xmm25, Address(rsp,144));
|
||||
__ vinsertf128h(xmm26, Address(rsp,160));
|
||||
__ vinsertf128h(xmm27, Address(rsp,176));
|
||||
__ vinsertf128h(xmm28, Address(rsp,192));
|
||||
__ vinsertf128h(xmm29, Address(rsp,208));
|
||||
__ vinsertf128h(xmm30, Address(rsp,224));
|
||||
__ vinsertf128h(xmm31, Address(rsp,240));
|
||||
__ addptr(rsp, 256);
|
||||
// Restore upper half of ZMM registes.
|
||||
__ vinsertf64x4h(xmm0, Address(rsp, 0));
|
||||
__ vinsertf64x4h(xmm1, Address(rsp, 32));
|
||||
__ vinsertf64x4h(xmm2, Address(rsp, 64));
|
||||
__ vinsertf64x4h(xmm3, Address(rsp, 96));
|
||||
__ vinsertf64x4h(xmm4, Address(rsp, 128));
|
||||
__ vinsertf64x4h(xmm5, Address(rsp, 160));
|
||||
__ vinsertf64x4h(xmm6, Address(rsp, 192));
|
||||
__ vinsertf64x4h(xmm7, Address(rsp, 224));
|
||||
__ vinsertf64x4h(xmm8, Address(rsp, 256));
|
||||
__ vinsertf64x4h(xmm9, Address(rsp, 288));
|
||||
__ vinsertf64x4h(xmm10, Address(rsp, 320));
|
||||
__ vinsertf64x4h(xmm11, Address(rsp, 352));
|
||||
__ vinsertf64x4h(xmm12, Address(rsp, 384));
|
||||
__ vinsertf64x4h(xmm13, Address(rsp, 416));
|
||||
__ vinsertf64x4h(xmm14, Address(rsp, 448));
|
||||
__ vinsertf64x4h(xmm15, Address(rsp, 480));
|
||||
__ vinsertf64x4h(xmm16, Address(rsp, 512));
|
||||
__ vinsertf64x4h(xmm17, Address(rsp, 544));
|
||||
__ vinsertf64x4h(xmm18, Address(rsp, 576));
|
||||
__ vinsertf64x4h(xmm19, Address(rsp, 608));
|
||||
__ vinsertf64x4h(xmm20, Address(rsp, 640));
|
||||
__ vinsertf64x4h(xmm21, Address(rsp, 672));
|
||||
__ vinsertf64x4h(xmm22, Address(rsp, 704));
|
||||
__ vinsertf64x4h(xmm23, Address(rsp, 736));
|
||||
__ vinsertf64x4h(xmm24, Address(rsp, 768));
|
||||
__ vinsertf64x4h(xmm25, Address(rsp, 800));
|
||||
__ vinsertf64x4h(xmm26, Address(rsp, 832));
|
||||
__ vinsertf64x4h(xmm27, Address(rsp, 864));
|
||||
__ vinsertf64x4h(xmm28, Address(rsp, 896));
|
||||
__ vinsertf64x4h(xmm29, Address(rsp, 928));
|
||||
__ vinsertf64x4h(xmm30, Address(rsp, 960));
|
||||
__ vinsertf64x4h(xmm31, Address(rsp, 992));
|
||||
__ addptr(rsp, 1024);
|
||||
// On EVEX enabled targets everything is handled in pop fpu state
|
||||
if ((restore_vectors) && (UseAVX < 3)) {
|
||||
assert(UseAVX > 0, "256/512-bit vectors are supported only with AVX");
|
||||
assert(MaxVectorSize == 64, "up to 512bit vectors are supported now");
|
||||
int off = 0;
|
||||
// Restore upper half of YMM registes (0..num_xmm_regs)
|
||||
for (int n = 0; n < num_xmm_regs; n++) {
|
||||
__ vinsertf128h(as_XMMRegister(n), Address(rsp, off++*16));
|
||||
}
|
||||
__ addptr(rsp, num_xmm_regs*16);
|
||||
}
|
||||
#else
|
||||
assert(!restore_vectors, "vectors are generated only by C2");
|
||||
|
||||
@ -795,6 +795,12 @@ class StubGenerator: public StubCodeGenerator {
|
||||
void xmm_copy_forward(Register from, Register to_from, Register qword_count) {
|
||||
assert( UseSSE >= 2, "supported cpu only" );
|
||||
Label L_copy_64_bytes_loop, L_copy_64_bytes, L_copy_8_bytes, L_exit;
|
||||
if (UseAVX > 2) {
|
||||
__ push(rbx);
|
||||
__ movl(rbx, 0xffff);
|
||||
__ kmovdl(k1, rbx);
|
||||
__ pop(rbx);
|
||||
}
|
||||
// Copy 64-byte chunks
|
||||
__ jmpb(L_copy_64_bytes);
|
||||
__ align(OptoLoopAlignment);
|
||||
@ -802,8 +808,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
if (UseUnalignedLoadStores) {
|
||||
if (UseAVX > 2) {
|
||||
__ evmovdqu(xmm0, Address(from, 0), Assembler::AVX_512bit);
|
||||
__ evmovdqu(Address(from, to_from, Address::times_1, 0), xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqul(xmm0, Address(from, 0), Assembler::AVX_512bit);
|
||||
__ evmovdqul(Address(from, to_from, Address::times_1, 0), xmm0, Assembler::AVX_512bit);
|
||||
} else if (UseAVX == 2) {
|
||||
__ vmovdqu(xmm0, Address(from, 0));
|
||||
__ vmovdqu(Address(from, to_from, Address::times_1, 0), xmm0);
|
||||
@ -2217,6 +2223,15 @@ class StubGenerator: public StubCodeGenerator {
|
||||
const XMMRegister xmm_temp4 = xmm5;
|
||||
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rdx, 0xffff);
|
||||
__ kmovdl(k1, rdx);
|
||||
}
|
||||
|
||||
__ movptr(from, from_param);
|
||||
__ movptr(key, key_param);
|
||||
|
||||
@ -2315,6 +2330,15 @@ class StubGenerator: public StubCodeGenerator {
|
||||
const XMMRegister xmm_temp4 = xmm5;
|
||||
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rdx, 0xffff);
|
||||
__ kmovdl(k1, rdx);
|
||||
}
|
||||
|
||||
__ movptr(from, from_param);
|
||||
__ movptr(key, key_param);
|
||||
|
||||
@ -2441,6 +2465,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
handleSOERegisters(true /*saving*/);
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rdx, 0xffff);
|
||||
__ kmovdl(k1, rdx);
|
||||
}
|
||||
|
||||
// load registers from incoming parameters
|
||||
const Address from_param(rbp, 8+0);
|
||||
const Address to_param (rbp, 8+4);
|
||||
@ -2602,6 +2634,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
handleSOERegisters(true /*saving*/);
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rdx, 0xffff);
|
||||
__ kmovdl(k1, rdx);
|
||||
}
|
||||
|
||||
// load registers from incoming parameters
|
||||
const Address from_param(rbp, 8+0);
|
||||
const Address to_param (rbp, 8+4);
|
||||
@ -2782,6 +2822,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ enter();
|
||||
handleSOERegisters(true); // Save registers
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rdx, 0xffff);
|
||||
__ kmovdl(k1, rdx);
|
||||
}
|
||||
|
||||
__ movptr(state, state_param);
|
||||
__ movptr(subkeyH, subkeyH_param);
|
||||
__ movptr(data, data_param);
|
||||
|
||||
@ -269,12 +269,16 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ kmovql(k1, rbx);
|
||||
}
|
||||
#ifdef _WIN64
|
||||
int last_reg = 15;
|
||||
if (UseAVX > 2) {
|
||||
for (int i = 6; i <= 31; i++) {
|
||||
__ movdqu(xmm_save(i), as_XMMRegister(i));
|
||||
last_reg = 31;
|
||||
}
|
||||
if (VM_Version::supports_avx512novl()) {
|
||||
for (int i = xmm_save_first; i <= last_reg; i++) {
|
||||
__ vextractf32x4h(xmm_save(i), as_XMMRegister(i), 0);
|
||||
}
|
||||
} else {
|
||||
for (int i = 6; i <= 15; i++) {
|
||||
for (int i = xmm_save_first; i <= last_reg; i++) {
|
||||
__ movdqu(xmm_save(i), as_XMMRegister(i));
|
||||
}
|
||||
}
|
||||
@ -386,13 +390,15 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
// restore regs belonging to calling function
|
||||
#ifdef _WIN64
|
||||
int xmm_ub = 15;
|
||||
if (UseAVX > 2) {
|
||||
xmm_ub = 31;
|
||||
}
|
||||
// emit the restores for xmm regs
|
||||
for (int i = 6; i <= xmm_ub; i++) {
|
||||
__ movdqu(as_XMMRegister(i), xmm_save(i));
|
||||
if (VM_Version::supports_avx512novl()) {
|
||||
for (int i = xmm_save_first; i <= last_reg; i++) {
|
||||
__ vinsertf32x4h(as_XMMRegister(i), xmm_save(i), 0);
|
||||
}
|
||||
} else {
|
||||
for (int i = xmm_save_first; i <= last_reg; i++) {
|
||||
__ movdqu(as_XMMRegister(i), xmm_save(i));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
__ movptr(r15, r15_save);
|
||||
@ -1342,11 +1348,15 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ align(OptoLoopAlignment);
|
||||
if (UseUnalignedLoadStores) {
|
||||
Label L_end;
|
||||
if (UseAVX > 2) {
|
||||
__ movl(to, 0xffff);
|
||||
__ kmovql(k1, to);
|
||||
}
|
||||
// Copy 64-bytes per iteration
|
||||
__ BIND(L_loop);
|
||||
if (UseAVX > 2) {
|
||||
__ evmovdqu(xmm0, Address(end_from, qword_count, Address::times_8, -56), Assembler::AVX_512bit);
|
||||
__ evmovdqu(Address(end_to, qword_count, Address::times_8, -56), xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqul(xmm0, Address(end_from, qword_count, Address::times_8, -56), Assembler::AVX_512bit);
|
||||
__ evmovdqul(Address(end_to, qword_count, Address::times_8, -56), xmm0, Assembler::AVX_512bit);
|
||||
} else if (UseAVX == 2) {
|
||||
__ vmovdqu(xmm0, Address(end_from, qword_count, Address::times_8, -56));
|
||||
__ vmovdqu(Address(end_to, qword_count, Address::times_8, -56), xmm0);
|
||||
@ -1422,11 +1432,15 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ align(OptoLoopAlignment);
|
||||
if (UseUnalignedLoadStores) {
|
||||
Label L_end;
|
||||
if (UseAVX > 2) {
|
||||
__ movl(to, 0xffff);
|
||||
__ kmovql(k1, to);
|
||||
}
|
||||
// Copy 64-bytes per iteration
|
||||
__ BIND(L_loop);
|
||||
if (UseAVX > 2) {
|
||||
__ evmovdqu(xmm0, Address(from, qword_count, Address::times_8, 32), Assembler::AVX_512bit);
|
||||
__ evmovdqu(Address(dest, qword_count, Address::times_8, 32), xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqul(xmm0, Address(from, qword_count, Address::times_8, 32), Assembler::AVX_512bit);
|
||||
__ evmovdqul(Address(dest, qword_count, Address::times_8, 32), xmm0, Assembler::AVX_512bit);
|
||||
} else if (UseAVX == 2) {
|
||||
__ vmovdqu(xmm0, Address(from, qword_count, Address::times_8, 32));
|
||||
__ vmovdqu(Address(dest, qword_count, Address::times_8, 32), xmm0);
|
||||
@ -3106,6 +3120,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rax, 0xffff);
|
||||
__ kmovql(k1, rax);
|
||||
}
|
||||
|
||||
// keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
|
||||
__ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
|
||||
|
||||
@ -3200,6 +3222,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rax, 0xffff);
|
||||
__ kmovql(k1, rax);
|
||||
}
|
||||
|
||||
// keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
|
||||
__ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
|
||||
|
||||
@ -3312,6 +3342,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rax, 0xffff);
|
||||
__ kmovql(k1, rax);
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
// on win64, fill len_reg from stack position
|
||||
__ movl(len_reg, len_mem);
|
||||
@ -3508,6 +3546,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rax, 0xffff);
|
||||
__ kmovql(k1, rax);
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
// on win64, fill len_reg from stack position
|
||||
__ movl(len_reg, len_mem);
|
||||
@ -3746,6 +3792,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
__ enter();
|
||||
|
||||
// For EVEX with VL and BW, provide a standard mask, VL = 128 will guide the merge
|
||||
// context for the registers used, where all instructions below are using 128-bit mode
|
||||
// On EVEX without VL and BW, these instructions will all be AVX.
|
||||
if (VM_Version::supports_avx512vlbw()) {
|
||||
__ movl(rax, 0xffff);
|
||||
__ kmovql(k1, rax);
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
// save the xmm registers which must be preserved 6-10
|
||||
__ subptr(rsp, -rsp_after_call_off * wordSize);
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
enum platform_dependent_constants {
|
||||
code_size1 = 9000, // simply increase if too small (assembler will crash if too small)
|
||||
code_size2 = 22000 // simply increase if too small (assembler will crash if too small)
|
||||
code_size2 = 30000 // simply increase if too small (assembler will crash if too small)
|
||||
};
|
||||
|
||||
class x86 {
|
||||
|
||||
@ -33,7 +33,7 @@ static bool returns_to_call_stub(address return_pc) { return return_pc == _
|
||||
|
||||
enum platform_dependent_constants {
|
||||
code_size1 = 19000, // simply increase if too small (assembler will crash if too small)
|
||||
code_size2 = 24000 // simply increase if too small (assembler will crash if too small)
|
||||
code_size2 = 32000 // simply increase if too small (assembler will crash if too small)
|
||||
};
|
||||
|
||||
class x86 {
|
||||
|
||||
@ -367,16 +367,12 @@ class VM_Version_StubGenerator: public StubCodeGenerator {
|
||||
__ movl(rcx, VM_Version::ymm_test_value());
|
||||
__ movdl(xmm0, rcx);
|
||||
__ movl(rcx, 0xffff);
|
||||
#ifdef _LP64
|
||||
__ kmovql(k1, rcx);
|
||||
#else
|
||||
__ kmovdl(k1, rcx);
|
||||
#endif
|
||||
__ kmovwl(k1, rcx);
|
||||
__ evpbroadcastd(xmm0, xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqu(xmm7, xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqul(xmm7, xmm0, Assembler::AVX_512bit);
|
||||
#ifdef _LP64
|
||||
__ evmovdqu(xmm8, xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqu(xmm31, xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqul(xmm8, xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqul(xmm31, xmm0, Assembler::AVX_512bit);
|
||||
#endif
|
||||
VM_Version::clean_cpuFeatures();
|
||||
__ jmp(save_restore_except);
|
||||
@ -427,11 +423,11 @@ class VM_Version_StubGenerator: public StubCodeGenerator {
|
||||
UseAVX = 3;
|
||||
UseSSE = 2;
|
||||
__ lea(rsi, Address(rbp, in_bytes(VM_Version::zmm_save_offset())));
|
||||
__ evmovdqu(Address(rsi, 0), xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqu(Address(rsi, 64), xmm7, Assembler::AVX_512bit);
|
||||
__ evmovdqul(Address(rsi, 0), xmm0, Assembler::AVX_512bit);
|
||||
__ evmovdqul(Address(rsi, 64), xmm7, Assembler::AVX_512bit);
|
||||
#ifdef _LP64
|
||||
__ evmovdqu(Address(rsi, 128), xmm8, Assembler::AVX_512bit);
|
||||
__ evmovdqu(Address(rsi, 192), xmm31, Assembler::AVX_512bit);
|
||||
__ evmovdqul(Address(rsi, 128), xmm8, Assembler::AVX_512bit);
|
||||
__ evmovdqul(Address(rsi, 192), xmm31, Assembler::AVX_512bit);
|
||||
#endif
|
||||
VM_Version::clean_cpuFeatures();
|
||||
UseAVX = saved_useavx;
|
||||
|
||||
@ -227,14 +227,15 @@ public:
|
||||
union XemXcr0Eax {
|
||||
uint32_t value;
|
||||
struct {
|
||||
uint32_t x87 : 1,
|
||||
sse : 1,
|
||||
ymm : 1,
|
||||
: 2,
|
||||
opmask : 1,
|
||||
zmm512 : 1,
|
||||
zmm32 : 1,
|
||||
: 24;
|
||||
uint32_t x87 : 1,
|
||||
sse : 1,
|
||||
ymm : 1,
|
||||
bndregs : 1,
|
||||
bndcsr : 1,
|
||||
opmask : 1,
|
||||
zmm512 : 1,
|
||||
zmm32 : 1,
|
||||
: 24;
|
||||
} bits;
|
||||
};
|
||||
|
||||
@ -703,6 +704,7 @@ public:
|
||||
static bool supports_avx512bw() { return (_cpuFeatures & CPU_AVX512BW) != 0; }
|
||||
static bool supports_avx512vl() { return (_cpuFeatures & CPU_AVX512VL) != 0; }
|
||||
static bool supports_avx512vlbw() { return (supports_avx512bw() && supports_avx512vl()); }
|
||||
static bool supports_avx512novl() { return (supports_evex() && !supports_avx512vl()); }
|
||||
// Intel features
|
||||
static bool is_intel_family_core() { return is_intel() &&
|
||||
extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }
|
||||
@ -817,6 +819,12 @@ public:
|
||||
intx count = PrefetchFieldsAhead;
|
||||
return count >= 0 ? count : 1;
|
||||
}
|
||||
static uint32_t get_xsave_header_lower_segment() {
|
||||
return _cpuid_info.xem_xcr0_eax.value;
|
||||
}
|
||||
static uint32_t get_xsave_header_upper_segment() {
|
||||
return _cpuid_info.xem_xcr0_edx;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CPU_X86_VM_VM_VERSION_X86_HPP
|
||||
|
||||
@ -1661,46 +1661,55 @@ const bool Matcher::match_rule_supported(int opcode) {
|
||||
if (!has_match_rule(opcode))
|
||||
return false;
|
||||
|
||||
bool ret_value = true;
|
||||
switch (opcode) {
|
||||
case Op_PopCountI:
|
||||
case Op_PopCountL:
|
||||
if (!UsePopCountInstruction)
|
||||
return false;
|
||||
break;
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_MulVI:
|
||||
if ((UseSSE < 4) && (UseAVX < 1)) // only with SSE4_1 or AVX
|
||||
return false;
|
||||
break;
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_MulVL:
|
||||
case Op_MulReductionVL:
|
||||
if (VM_Version::supports_avx512dq() == false)
|
||||
return false;
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_AddReductionVL:
|
||||
if (UseAVX < 3) // only EVEX : vector connectivity becomes an issue here
|
||||
return false;
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_AddReductionVI:
|
||||
if (UseSSE < 3) // requires at least SSE3
|
||||
return false;
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_MulReductionVI:
|
||||
if (UseSSE < 4) // requires at least SSE4
|
||||
return false;
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_AddReductionVF:
|
||||
case Op_AddReductionVD:
|
||||
case Op_MulReductionVF:
|
||||
case Op_MulReductionVD:
|
||||
if (UseSSE < 1) // requires at least SSE
|
||||
return false;
|
||||
break;
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_SqrtVD:
|
||||
if (UseAVX < 1) // enabled for AVX only
|
||||
ret_value = false;
|
||||
break;
|
||||
case Op_CompareAndSwapL:
|
||||
#ifdef _LP64
|
||||
case Op_CompareAndSwapP:
|
||||
#endif
|
||||
if (!VM_Version::supports_cx8())
|
||||
return false;
|
||||
break;
|
||||
ret_value = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return true; // Per default match rules are supported.
|
||||
return ret_value; // Per default match rules are supported.
|
||||
}
|
||||
|
||||
// Max vector size in bytes. 0 if not supported.
|
||||
@ -1721,14 +1730,24 @@ const int Matcher::vector_width_in_bytes(BasicType bt) {
|
||||
case T_DOUBLE:
|
||||
case T_LONG:
|
||||
if (size < 16) return 0;
|
||||
break;
|
||||
case T_FLOAT:
|
||||
case T_INT:
|
||||
if (size < 8) return 0;
|
||||
break;
|
||||
case T_BOOLEAN:
|
||||
case T_BYTE:
|
||||
if (size < 4) return 0;
|
||||
break;
|
||||
case T_CHAR:
|
||||
if (size < 4) return 0;
|
||||
break;
|
||||
case T_BYTE:
|
||||
if (size < 4) return 0;
|
||||
if ((size > 32) && !VM_Version::supports_avx512bw()) return 0;
|
||||
break;
|
||||
case T_SHORT:
|
||||
if (size < 4) return 0;
|
||||
if ((size > 16) && !VM_Version::supports_avx512bw()) return 0;
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
@ -1800,7 +1819,7 @@ static int vec_mov_helper(CodeBuffer *cbuf, bool do_size, int src_lo, int dst_lo
|
||||
__ vmovdqu(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]));
|
||||
break;
|
||||
case Op_VecZ:
|
||||
__ evmovdqu(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]), 2);
|
||||
__ evmovdqul(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]), 2);
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
@ -1855,7 +1874,7 @@ static int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load,
|
||||
__ vmovdqu(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset));
|
||||
break;
|
||||
case Op_VecZ:
|
||||
__ evmovdqu(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset), 2);
|
||||
__ evmovdqul(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset), 2);
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
@ -1875,7 +1894,7 @@ static int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load,
|
||||
__ vmovdqu(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]));
|
||||
break;
|
||||
case Op_VecZ:
|
||||
__ evmovdqu(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]), 2);
|
||||
__ evmovdqul(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]), 2);
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
@ -1929,9 +1948,40 @@ static int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
int offset_size = (stack_offset == 0) ? 0 : ((stack_offset < 0x80) ? 1 : (UseAVX > 2) ? 6 : 4);
|
||||
bool is_single_byte = false;
|
||||
int vec_len = 0;
|
||||
if ((UseAVX > 2) && (stack_offset != 0)) {
|
||||
switch (ireg) {
|
||||
case Op_VecS:
|
||||
case Op_VecD:
|
||||
case Op_VecX:
|
||||
break;
|
||||
case Op_VecY:
|
||||
vec_len = 1;
|
||||
break;
|
||||
case Op_VecZ:
|
||||
vec_len = 2;
|
||||
break;
|
||||
}
|
||||
is_single_byte = Assembler::query_compressed_disp_byte(stack_offset, true, vec_len, Assembler::EVEX_FVM, Assembler::EVEX_32bit, 0);
|
||||
}
|
||||
int offset_size = 0;
|
||||
int size = 5;
|
||||
if (UseAVX > 2 ) {
|
||||
if ((VM_Version::supports_avx512vl() == false) && (vec_len == 2)) {
|
||||
offset_size = (stack_offset == 0) ? 0 : ((is_single_byte) ? 1 : 4);
|
||||
size += 2; // Need an additional two bytes for EVEX encoding
|
||||
} else if ((VM_Version::supports_avx512vl() == false) && (vec_len < 2)) {
|
||||
offset_size = (stack_offset == 0) ? 0 : ((stack_offset <= 127) ? 1 : 4);
|
||||
} else {
|
||||
offset_size = (stack_offset == 0) ? 0 : ((is_single_byte) ? 1 : 4);
|
||||
size += 2; // Need an additional two bytes for EVEX encodding
|
||||
}
|
||||
} else {
|
||||
offset_size = (stack_offset == 0) ? 0 : ((stack_offset <= 127) ? 1 : 4);
|
||||
}
|
||||
// VEX_2bytes prefix is used if UseAVX > 0, so it takes the same 2 bytes as SIMD prefix.
|
||||
return 5+offset_size;
|
||||
return size+offset_size;
|
||||
}
|
||||
|
||||
static inline jfloat replicate4_imm(int con, int width) {
|
||||
@ -2675,11 +2725,10 @@ instruct negF_reg_reg(regF dst, regF src) %{
|
||||
predicate(UseAVX > 0);
|
||||
match(Set dst (NegF src));
|
||||
ins_cost(150);
|
||||
format %{ "vxorps $dst, $src, [0x80000000]\t# neg float by sign flipping" %}
|
||||
format %{ "vnegatess $dst, $src, [0x80000000]\t# neg float by sign flipping" %}
|
||||
ins_encode %{
|
||||
int vector_len = 0;
|
||||
__ vxorps($dst$$XMMRegister, $src$$XMMRegister,
|
||||
ExternalAddress(float_signflip()), vector_len);
|
||||
__ vnegatess($dst$$XMMRegister, $src$$XMMRegister,
|
||||
ExternalAddress(float_signflip()));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -2700,12 +2749,11 @@ instruct negD_reg_reg(regD dst, regD src) %{
|
||||
predicate(UseAVX > 0);
|
||||
match(Set dst (NegD src));
|
||||
ins_cost(150);
|
||||
format %{ "vxorpd $dst, $src, [0x8000000000000000]\t"
|
||||
format %{ "vnegatess $dst, $src, [0x8000000000000000]\t"
|
||||
"# neg double by sign flipping" %}
|
||||
ins_encode %{
|
||||
int vector_len = 0;
|
||||
__ vxorpd($dst$$XMMRegister, $src$$XMMRegister,
|
||||
ExternalAddress(double_signflip()), vector_len);
|
||||
__ vnegatesd($dst$$XMMRegister, $src$$XMMRegister,
|
||||
ExternalAddress(double_signflip()));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -2838,7 +2886,7 @@ instruct loadV64(vecZ dst, memory mem) %{
|
||||
format %{ "vmovdqu $dst k0,$mem\t! load vector (64 bytes)" %}
|
||||
ins_encode %{
|
||||
int vector_len = 2;
|
||||
__ evmovdqu($dst$$XMMRegister, $mem$$Address, vector_len);
|
||||
__ evmovdqul($dst$$XMMRegister, $mem$$Address, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
@ -2895,7 +2943,7 @@ instruct storeV64(memory mem, vecZ src) %{
|
||||
format %{ "vmovdqu $mem k0,$src\t! store vector (64 bytes)" %}
|
||||
ins_encode %{
|
||||
int vector_len = 2;
|
||||
__ evmovdqu($mem$$Address, $src$$XMMRegister, vector_len);
|
||||
__ evmovdqul($mem$$Address, $src$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
@ -3315,6 +3363,37 @@ instruct Repl8F_mem(vecY dst, memory mem) %{
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct Repl2F_zero(vecD dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 2 && UseAVX < 3);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "xorps $dst,$dst\t! replicate2F zero" %}
|
||||
ins_encode %{
|
||||
__ xorps($dst$$XMMRegister, $dst$$XMMRegister);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl4F_zero(vecX dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 4 && UseAVX < 3);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "xorps $dst,$dst\t! replicate4F zero" %}
|
||||
ins_encode %{
|
||||
__ xorps($dst$$XMMRegister, $dst$$XMMRegister);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl8F_zero(vecY dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 8 && UseAVX < 3);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "vxorps $dst,$dst,$dst\t! replicate8F zero" %}
|
||||
ins_encode %{
|
||||
int vector_len = 1;
|
||||
__ vxorps($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl2D_mem(vecX dst, memory mem) %{
|
||||
predicate(n->as_Vector()->length() == 2 && UseAVX > 0 && !VM_Version::supports_avx512vl());
|
||||
match(Set dst (ReplicateD (LoadD mem)));
|
||||
@ -3349,6 +3428,28 @@ instruct Repl4D_mem(vecY dst, memory mem) %{
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
// Replicate double (8 byte) scalar zero to be vector
|
||||
instruct Repl2D_zero(vecX dst, immD0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 2 && UseAVX < 3);
|
||||
match(Set dst (ReplicateD zero));
|
||||
format %{ "xorpd $dst,$dst\t! replicate2D zero" %}
|
||||
ins_encode %{
|
||||
__ xorpd($dst$$XMMRegister, $dst$$XMMRegister);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl4D_zero(vecY dst, immD0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 4 && UseAVX < 3);
|
||||
match(Set dst (ReplicateD zero));
|
||||
format %{ "vxorpd $dst,$dst,$dst,vect256\t! replicate4D zero" %}
|
||||
ins_encode %{
|
||||
int vector_len = 1;
|
||||
__ vxorpd($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
// ====================GENERIC REPLICATE==========================================
|
||||
|
||||
// Replicate byte scalar to be vector
|
||||
@ -3680,38 +3781,6 @@ instruct Repl4F(vecX dst, regF src) %{
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
// Replicate float (4 byte) scalar zero to be vector
|
||||
instruct Repl2F_zero(vecD dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 2);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "xorps $dst,$dst\t! replicate2F zero" %}
|
||||
ins_encode %{
|
||||
__ xorps($dst$$XMMRegister, $dst$$XMMRegister);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl4F_zero(vecX dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 4);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "xorps $dst,$dst\t! replicate4F zero" %}
|
||||
ins_encode %{
|
||||
__ xorps($dst$$XMMRegister, $dst$$XMMRegister);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl8F_zero(vecY dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 8);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "vxorps $dst,$dst,$dst\t! replicate8F zero" %}
|
||||
ins_encode %{
|
||||
int vector_len = 1;
|
||||
__ vxorps($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
// Replicate double (8 bytes) scalar to be vector
|
||||
instruct Repl2D(vecX dst, regD src) %{
|
||||
predicate(n->as_Vector()->length() == 2);
|
||||
@ -3723,28 +3792,6 @@ instruct Repl2D(vecX dst, regD src) %{
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
// Replicate double (8 byte) scalar zero to be vector
|
||||
instruct Repl2D_zero(vecX dst, immD0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 2);
|
||||
match(Set dst (ReplicateD zero));
|
||||
format %{ "xorpd $dst,$dst\t! replicate2D zero" %}
|
||||
ins_encode %{
|
||||
__ xorpd($dst$$XMMRegister, $dst$$XMMRegister);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl4D_zero(vecY dst, immD0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 4);
|
||||
match(Set dst (ReplicateD zero));
|
||||
format %{ "vxorpd $dst,$dst,$dst,vect256\t! replicate4D zero" %}
|
||||
ins_encode %{
|
||||
int vector_len = 1;
|
||||
__ vxorpd($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
// ====================EVEX REPLICATE=============================================
|
||||
|
||||
instruct Repl4B_mem_evex(vecS dst, memory mem) %{
|
||||
@ -3814,7 +3861,7 @@ instruct Repl32B_mem_evex(vecY dst, memory mem) %{
|
||||
%}
|
||||
|
||||
instruct Repl64B_evex(vecZ dst, rRegI src) %{
|
||||
predicate(n->as_Vector()->length() == 64 && UseAVX > 2);
|
||||
predicate(n->as_Vector()->length() == 64 && VM_Version::supports_avx512bw());
|
||||
match(Set dst (ReplicateB src));
|
||||
format %{ "vpbroadcastb $dst,$src\t! upper replicate64B" %}
|
||||
ins_encode %{
|
||||
@ -3825,7 +3872,7 @@ instruct Repl64B_evex(vecZ dst, rRegI src) %{
|
||||
%}
|
||||
|
||||
instruct Repl64B_mem_evex(vecZ dst, memory mem) %{
|
||||
predicate(n->as_Vector()->length() == 64 && VM_Version::supports_avx512vlbw());
|
||||
predicate(n->as_Vector()->length() == 64 && VM_Version::supports_avx512bw());
|
||||
match(Set dst (ReplicateB (LoadB mem)));
|
||||
format %{ "vpbroadcastb $dst,$mem\t! replicate64B" %}
|
||||
ins_encode %{
|
||||
@ -3862,7 +3909,7 @@ instruct Repl32B_imm_evex(vecY dst, immI con) %{
|
||||
%}
|
||||
|
||||
instruct Repl64B_imm_evex(vecZ dst, immI con) %{
|
||||
predicate(n->as_Vector()->length() == 64 && UseAVX > 2);
|
||||
predicate(n->as_Vector()->length() == 64 && VM_Version::supports_avx512bw());
|
||||
match(Set dst (ReplicateB con));
|
||||
format %{ "movq $dst,[$constantaddress]\n\t"
|
||||
"vpbroadcastb $dst,$dst\t! upper replicate64B" %}
|
||||
@ -3953,7 +4000,7 @@ instruct Repl16S_mem_evex(vecY dst, memory mem) %{
|
||||
%}
|
||||
|
||||
instruct Repl32S_evex(vecZ dst, rRegI src) %{
|
||||
predicate(n->as_Vector()->length() == 32 && UseAVX > 2);
|
||||
predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512bw());
|
||||
match(Set dst (ReplicateS src));
|
||||
format %{ "vpbroadcastw $dst,$src\t! replicate32S" %}
|
||||
ins_encode %{
|
||||
@ -3964,7 +4011,7 @@ instruct Repl32S_evex(vecZ dst, rRegI src) %{
|
||||
%}
|
||||
|
||||
instruct Repl32S_mem_evex(vecZ dst, memory mem) %{
|
||||
predicate(n->as_Vector()->length() == 32 && UseAVX > 2);
|
||||
predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512bw());
|
||||
match(Set dst (ReplicateS (LoadS mem)));
|
||||
format %{ "vpbroadcastw $dst,$mem\t! replicate32S" %}
|
||||
ins_encode %{
|
||||
@ -4001,7 +4048,7 @@ instruct Repl16S_imm_evex(vecY dst, immI con) %{
|
||||
%}
|
||||
|
||||
instruct Repl32S_imm_evex(vecZ dst, immI con) %{
|
||||
predicate(n->as_Vector()->length() == 32 && UseAVX > 2);
|
||||
predicate(n->as_Vector()->length() == 32 && VM_Version::supports_avx512bw());
|
||||
match(Set dst (ReplicateS con));
|
||||
format %{ "movq $dst,[$constantaddress]\n\t"
|
||||
"vpbroadcastw $dst,$dst\t! replicate32S" %}
|
||||
@ -4318,13 +4365,50 @@ instruct Repl16F_mem_evex(vecZ dst, memory mem) %{
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct Repl2F_zero_evex(vecD dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 2 && UseAVX > 2);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "vpxor $dst k0,$dst,$dst\t! replicate2F zero" %}
|
||||
ins_encode %{
|
||||
// Use vpxor in place of vxorps since EVEX has a constriant on dq for vxorps: this is a 512-bit operation
|
||||
int vector_len = 2;
|
||||
__ vpxor($dst$$XMMRegister,$dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl4F_zero_evex(vecX dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 4 && UseAVX > 2);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "vpxor $dst k0,$dst,$dst\t! replicate4F zero" %}
|
||||
ins_encode %{
|
||||
// Use vpxor in place of vxorps since EVEX has a constriant on dq for vxorps: this is a 512-bit operation
|
||||
int vector_len = 2;
|
||||
__ vpxor($dst$$XMMRegister,$dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl8F_zero_evex(vecY dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 8 && UseAVX > 2);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "vpxor $dst k0,$dst,$dst\t! replicate8F zero" %}
|
||||
ins_encode %{
|
||||
// Use vpxor in place of vxorps since EVEX has a constriant on dq for vxorps: this is a 512-bit operation
|
||||
int vector_len = 2;
|
||||
__ vpxor($dst$$XMMRegister,$dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl16F_zero_evex(vecZ dst, immF0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 16 && UseAVX > 2);
|
||||
match(Set dst (ReplicateF zero));
|
||||
format %{ "vxorps $dst k0,$dst,$dst\t! replicate16F zero" %}
|
||||
format %{ "vpxor $dst k0,$dst,$dst\t! replicate16F zero" %}
|
||||
ins_encode %{
|
||||
// Use vpxor in place of vxorps since EVEX has a constriant on dq for vxorps: this is a 512-bit operation
|
||||
int vector_len = 2;
|
||||
__ vxorps($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
__ vpxor($dst$$XMMRegister,$dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
@ -4373,13 +4457,38 @@ instruct Repl8D_mem_evex(vecZ dst, memory mem) %{
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct Repl2D_zero_evex(vecX dst, immD0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 2 && UseAVX > 2);
|
||||
match(Set dst (ReplicateD zero));
|
||||
format %{ "vpxor $dst k0,$dst,$dst\t! replicate2D zero" %}
|
||||
ins_encode %{
|
||||
// Use vpxor in place of vxorpd since EVEX has a constriant on dq for vxorpd: this is a 512-bit operation
|
||||
int vector_len = 2;
|
||||
__ vpxor($dst$$XMMRegister,$dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl4D_zero_evex(vecY dst, immD0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 4 && UseAVX > 2);
|
||||
match(Set dst (ReplicateD zero));
|
||||
format %{ "vpxor $dst k0,$dst,$dst\t! replicate4D zero" %}
|
||||
ins_encode %{
|
||||
// Use vpxor in place of vxorpd since EVEX has a constriant on dq for vxorpd: this is a 512-bit operation
|
||||
int vector_len = 2;
|
||||
__ vpxor($dst$$XMMRegister,$dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
|
||||
instruct Repl8D_zero_evex(vecZ dst, immD0 zero) %{
|
||||
predicate(n->as_Vector()->length() == 8 && UseAVX > 2);
|
||||
match(Set dst (ReplicateD zero));
|
||||
format %{ "vxorpd $dst k0,$dst,$dst,vect512\t! replicate8D zero" %}
|
||||
format %{ "vpxor $dst k0,$dst,$dst,vect512\t! replicate8D zero" %}
|
||||
ins_encode %{
|
||||
// Use vpxor in place of vxorpd since EVEX has a constriant on dq for vxorpd: this is a 512-bit operation
|
||||
int vector_len = 2;
|
||||
__ vxorpd($dst$$XMMRegister, $dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
__ vpxor($dst$$XMMRegister,$dst$$XMMRegister, $dst$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( fpu_reg_reg );
|
||||
%}
|
||||
@ -7474,6 +7583,75 @@ instruct vshiftcnt(vecS dst, rRegI cnt) %{
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
// --------------------------------- Sqrt --------------------------------------
|
||||
|
||||
// Floating point vector sqrt - double precision only
|
||||
instruct vsqrt2D_reg(vecX dst, vecX src) %{
|
||||
predicate(UseAVX > 0 && n->as_Vector()->length() == 2);
|
||||
match(Set dst (SqrtVD src));
|
||||
format %{ "vsqrtpd $dst,$src\t! sqrt packed2D" %}
|
||||
ins_encode %{
|
||||
int vector_len = 0;
|
||||
__ vsqrtpd($dst$$XMMRegister, $src$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vsqrt2D_mem(vecX dst, memory mem) %{
|
||||
predicate(UseAVX > 0 && n->as_Vector()->length() == 2);
|
||||
match(Set dst (SqrtVD (LoadVector mem)));
|
||||
format %{ "vsqrtpd $dst,$mem\t! sqrt packed2D" %}
|
||||
ins_encode %{
|
||||
int vector_len = 0;
|
||||
__ vsqrtpd($dst$$XMMRegister, $mem$$Address, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vsqrt4D_reg(vecY dst, vecY src) %{
|
||||
predicate(UseAVX > 0 && n->as_Vector()->length() == 4);
|
||||
match(Set dst (SqrtVD src));
|
||||
format %{ "vsqrtpd $dst,$src\t! sqrt packed4D" %}
|
||||
ins_encode %{
|
||||
int vector_len = 1;
|
||||
__ vsqrtpd($dst$$XMMRegister, $src$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vsqrt4D_mem(vecY dst, memory mem) %{
|
||||
predicate(UseAVX > 0 && n->as_Vector()->length() == 4);
|
||||
match(Set dst (SqrtVD (LoadVector mem)));
|
||||
format %{ "vsqrtpd $dst,$mem\t! sqrt packed4D" %}
|
||||
ins_encode %{
|
||||
int vector_len = 1;
|
||||
__ vsqrtpd($dst$$XMMRegister, $mem$$Address, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vsqrt8D_reg(vecZ dst, vecZ src) %{
|
||||
predicate(UseAVX > 2 && n->as_Vector()->length() == 8);
|
||||
match(Set dst (SqrtVD src));
|
||||
format %{ "vsqrtpd $dst,$src\t! sqrt packed8D" %}
|
||||
ins_encode %{
|
||||
int vector_len = 2;
|
||||
__ vsqrtpd($dst$$XMMRegister, $src$$XMMRegister, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
instruct vsqrt8D_mem(vecZ dst, memory mem) %{
|
||||
predicate(UseAVX > 2 && n->as_Vector()->length() == 8);
|
||||
match(Set dst (SqrtVD (LoadVector mem)));
|
||||
format %{ "vsqrtpd $dst,$mem\t! sqrt packed8D" %}
|
||||
ins_encode %{
|
||||
int vector_len = 2;
|
||||
__ vsqrtpd($dst$$XMMRegister, $mem$$Address, vector_len);
|
||||
%}
|
||||
ins_pipe( pipe_slow );
|
||||
%}
|
||||
|
||||
// ------------------------------ LeftShift -----------------------------------
|
||||
|
||||
// Shorts/Chars vector left shift
|
||||
|
||||
@ -1004,10 +1004,10 @@ static int vec_stack_to_stack_helper(CodeBuffer *cbuf, bool do_size, int src_off
|
||||
__ vmovdqu(Address(rsp, dst_offset), xmm0);
|
||||
__ vmovdqu(xmm0, Address(rsp, -32));
|
||||
case Op_VecZ:
|
||||
__ evmovdqu(Address(rsp, -64), xmm0, 2);
|
||||
__ evmovdqu(xmm0, Address(rsp, src_offset), 2);
|
||||
__ evmovdqu(Address(rsp, dst_offset), xmm0, 2);
|
||||
__ evmovdqu(xmm0, Address(rsp, -64), 2);
|
||||
__ evmovdqul(Address(rsp, -64), xmm0, 2);
|
||||
__ evmovdqul(xmm0, Address(rsp, src_offset), 2);
|
||||
__ evmovdqul(Address(rsp, dst_offset), xmm0, 2);
|
||||
__ evmovdqul(xmm0, Address(rsp, -64), 2);
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
|
||||
@ -1075,10 +1075,10 @@ static void vec_stack_to_stack_helper(CodeBuffer *cbuf, int src_offset,
|
||||
__ vmovdqu(Address(rsp, dst_offset), xmm0);
|
||||
__ vmovdqu(xmm0, Address(rsp, -32));
|
||||
case Op_VecZ:
|
||||
__ evmovdqu(Address(rsp, -64), xmm0, 2);
|
||||
__ evmovdqu(xmm0, Address(rsp, src_offset), 2);
|
||||
__ evmovdqu(Address(rsp, dst_offset), xmm0, 2);
|
||||
__ evmovdqu(xmm0, Address(rsp, -64), 2);
|
||||
__ evmovdqul(Address(rsp, -64), xmm0, 2);
|
||||
__ evmovdqul(xmm0, Address(rsp, src_offset), 2);
|
||||
__ evmovdqul(Address(rsp, dst_offset), xmm0, 2);
|
||||
__ evmovdqul(xmm0, Address(rsp, -64), 2);
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
|
||||
@ -4143,6 +4143,7 @@ bool MatchRule::is_vector() const {
|
||||
"SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
|
||||
"MulVS","MulVI","MulVL","MulVF","MulVD",
|
||||
"DivVF","DivVD",
|
||||
"SqrtVD",
|
||||
"AndV" ,"XorV" ,"OrV",
|
||||
"AddReductionVI", "AddReductionVL",
|
||||
"AddReductionVF", "AddReductionVD",
|
||||
|
||||
@ -290,6 +290,7 @@ macro(MulVD)
|
||||
macro(MulReductionVD)
|
||||
macro(DivVF)
|
||||
macro(DivVD)
|
||||
macro(SqrtVD)
|
||||
macro(LShiftCntV)
|
||||
macro(RShiftCntV)
|
||||
macro(LShiftVB)
|
||||
|
||||
@ -858,18 +858,29 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
|
||||
// this_bool = <=
|
||||
// dom_bool = >= (proj = True) or dom_bool = < (proj = False)
|
||||
// x in [a, b] on the fail (= True) projection, b+1 > a-1:
|
||||
// lo = a, hi = b, adjusted_lim = b-a, cond = <=u
|
||||
// lo = a, hi = b, adjusted_lim = b-a+1, cond = <u
|
||||
// lo = a, hi = b, adjusted_lim = b-a, cond = <=u doesn't work because b = a - 1 is possible, then b-a = -1
|
||||
// dom_bool = > (proj = True) or dom_bool = <= (proj = False)
|
||||
// x in ]a, b] on the fail (= True) projection b+1 > a:
|
||||
// lo = a+1, hi = b, adjusted_lim = b-a, cond = <u
|
||||
// lo = a+1, hi = b, adjusted_lim = b-a-1, cond = <=u doesn't work because a = b is possible, then hi-lo = -1
|
||||
// lo = a+1, hi = b, adjusted_lim = b-a-1, cond = <=u doesn't work because a = b is possible, then b-a-1 = -1
|
||||
|
||||
if (lo_test == BoolTest::gt || lo_test == BoolTest::le) {
|
||||
if (hi_test == BoolTest::le) {
|
||||
if (hi_test == BoolTest::lt) {
|
||||
if (lo_test == BoolTest::gt || lo_test == BoolTest::le) {
|
||||
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
|
||||
}
|
||||
} else {
|
||||
assert(hi_test == BoolTest::le, "bad test");
|
||||
if (lo_test == BoolTest::ge || lo_test == BoolTest::lt) {
|
||||
adjusted_lim = igvn->transform(new SubINode(hi, lo));
|
||||
adjusted_lim = igvn->transform(new AddINode(adjusted_lim, igvn->intcon(1)));
|
||||
cond = BoolTest::lt;
|
||||
} else {
|
||||
assert(lo_test == BoolTest::gt || lo_test == BoolTest::le, "bad test");
|
||||
adjusted_lim = igvn->transform(new SubINode(hi, lo));
|
||||
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
|
||||
cond = BoolTest::lt;
|
||||
}
|
||||
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
|
||||
}
|
||||
} else if (lo_type->_lo > hi_type->_hi && lo_type->_hi == max_jint && hi_type->_lo == min_jint) {
|
||||
|
||||
@ -879,7 +890,8 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
|
||||
// lo = b, hi = a, adjusted_lim = a-b, cond = >=u
|
||||
// dom_bool = <= (proj = True) or dom_bool = > (proj = False)
|
||||
// x in [b, a] on the fail (= False) projection, a+1 > b-1:
|
||||
// lo = b, hi = a, adjusted_lim = a-b, cond = >u
|
||||
// lo = b, hi = a, adjusted_lim = a-b+1, cond = >=u
|
||||
// lo = b, hi = a, adjusted_lim = a-b, cond = >u doesn't work because a = b - 1 is possible, then b-a = -1
|
||||
// this_bool = <=
|
||||
// dom_bool = < (proj = True) or dom_bool = >= (proj = False)
|
||||
// x in ]b, a[ on the fail (= False) projection, a > b:
|
||||
@ -887,7 +899,7 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
|
||||
// dom_bool = <= (proj = True) or dom_bool = > (proj = False)
|
||||
// x in ]b, a] on the fail (= False) projection, a+1 > b:
|
||||
// lo = b+1, hi = a, adjusted_lim = a-b, cond = >=u
|
||||
// lo = b+1, hi = a, adjusted_lim = a-b-1, cond = >u doesn't work because a = b is possible, then hi-lo = -1
|
||||
// lo = b+1, hi = a, adjusted_lim = a-b-1, cond = >u doesn't work because a = b is possible, then b-a-1 = -1
|
||||
|
||||
swap(lo, hi);
|
||||
swap(lo_type, hi_type);
|
||||
@ -900,14 +912,26 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
|
||||
|
||||
cond = (hi_test == BoolTest::le || hi_test == BoolTest::gt) ? BoolTest::gt : BoolTest::ge;
|
||||
|
||||
if (lo_test == BoolTest::le) {
|
||||
if (cond == BoolTest::gt) {
|
||||
if (lo_test == BoolTest::lt) {
|
||||
if (hi_test == BoolTest::lt || hi_test == BoolTest::ge) {
|
||||
cond = BoolTest::ge;
|
||||
} else {
|
||||
assert(hi_test == BoolTest::le || hi_test == BoolTest::gt, "bad test");
|
||||
adjusted_lim = igvn->transform(new SubINode(hi, lo));
|
||||
adjusted_lim = igvn->transform(new AddINode(adjusted_lim, igvn->intcon(1)));
|
||||
cond = BoolTest::ge;
|
||||
}
|
||||
} else if (lo_test == BoolTest::le) {
|
||||
if (hi_test == BoolTest::lt || hi_test == BoolTest::ge) {
|
||||
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
|
||||
cond = BoolTest::ge;
|
||||
} else {
|
||||
assert(hi_test == BoolTest::le || hi_test == BoolTest::gt, "bad test");
|
||||
adjusted_lim = igvn->transform(new SubINode(hi, lo));
|
||||
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
|
||||
cond = BoolTest::ge;
|
||||
}
|
||||
lo = igvn->transform(new AddINode(lo, igvn->intcon(1)));
|
||||
}
|
||||
|
||||
} else {
|
||||
const TypeInt* failtype = filtered_int_type(igvn, n, proj);
|
||||
if (failtype != NULL) {
|
||||
|
||||
@ -112,6 +112,13 @@ ProjNode* PhaseIdealLoop::create_new_if_for_predicate(ProjNode* cont_proj, Node*
|
||||
if (_idom != NULL) {
|
||||
set_idom(call, rgn, dom_depth(rgn));
|
||||
}
|
||||
for (DUIterator_Fast imax, i = uncommon_proj->fast_outs(imax); i < imax; i++) {
|
||||
Node* n = uncommon_proj->fast_out(i);
|
||||
if (n->is_Load() || n->is_Store()) {
|
||||
_igvn.replace_input_of(n, 0, rgn);
|
||||
--i; --imax;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Find region's edge corresponding to uncommon_proj
|
||||
for (; proj_index < rgn->req(); proj_index++)
|
||||
|
||||
@ -1901,7 +1901,7 @@ void IdealLoopTree::dump_head( ) const {
|
||||
if (stride_con > 0) tty->print("+");
|
||||
tty->print("%d", stride_con);
|
||||
|
||||
tty->print(" (%d iters) ", (int)cl->profile_trip_cnt());
|
||||
tty->print(" (%0.f iters) ", cl->profile_trip_cnt());
|
||||
|
||||
if (cl->is_pre_loop ()) tty->print(" pre" );
|
||||
if (cl->is_main_loop()) tty->print(" main");
|
||||
|
||||
@ -1858,6 +1858,11 @@ void SuperWord::output() {
|
||||
vn = VectorNode::make(opc, in1, in2, vlen, velt_basic_type(n));
|
||||
vlen_in_bytes = vn->as_Vector()->length_in_bytes();
|
||||
}
|
||||
} else if (opc == Op_SqrtD) {
|
||||
// Promote operand to vector (Sqrt is a 2 address instruction)
|
||||
Node* in = vector_opd(p, 1);
|
||||
vn = VectorNode::make(opc, in, NULL, vlen, velt_basic_type(n));
|
||||
vlen_in_bytes = vn->as_Vector()->length_in_bytes();
|
||||
} else {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
@ -92,6 +92,9 @@ int VectorNode::opcode(int sopc, BasicType bt) {
|
||||
case Op_DivD:
|
||||
assert(bt == T_DOUBLE, "must be");
|
||||
return Op_DivVD;
|
||||
case Op_SqrtD:
|
||||
assert(bt == T_DOUBLE, "must be");
|
||||
return Op_SqrtVD;
|
||||
case Op_LShiftI:
|
||||
switch (bt) {
|
||||
case T_BOOLEAN:
|
||||
@ -277,6 +280,9 @@ VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, uint vlen, BasicType b
|
||||
case Op_DivVF: return new DivVFNode(n1, n2, vt);
|
||||
case Op_DivVD: return new DivVDNode(n1, n2, vt);
|
||||
|
||||
// Currently only supports double precision sqrt
|
||||
case Op_SqrtVD: return new SqrtVDNode(n1, vt);
|
||||
|
||||
case Op_LShiftVB: return new LShiftVBNode(n1, n2, vt);
|
||||
case Op_LShiftVS: return new LShiftVSNode(n1, n2, vt);
|
||||
case Op_LShiftVI: return new LShiftVINode(n1, n2, vt);
|
||||
|
||||
@ -309,6 +309,14 @@ class DivVDNode : public VectorNode {
|
||||
virtual int Opcode() const;
|
||||
};
|
||||
|
||||
//------------------------------SqrtVDNode--------------------------------------
|
||||
// Vector Sqrt double
|
||||
class SqrtVDNode : public VectorNode {
|
||||
public:
|
||||
SqrtVDNode(Node* in, const TypeVect* vt) : VectorNode(in,vt) {}
|
||||
virtual int Opcode() const;
|
||||
};
|
||||
|
||||
//------------------------------LShiftVBNode-----------------------------------
|
||||
// Vector left shift bytes
|
||||
class LShiftVBNode : public VectorNode {
|
||||
|
||||
@ -1041,11 +1041,18 @@ CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
|
||||
}
|
||||
|
||||
WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type))
|
||||
return (jlong) WhiteBox::allocate_code_blob(size, blob_type);
|
||||
if (size < 0) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
err_msg("WB_AllocateCodeBlob: size is negative: " INT32_FORMAT, size));
|
||||
}
|
||||
return (jlong) WhiteBox::allocate_code_blob(size, blob_type);
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(void, WB_FreeCodeBlob(JNIEnv* env, jobject o, jlong addr))
|
||||
BufferBlob::free((BufferBlob*) addr);
|
||||
if (addr == 0) {
|
||||
return;
|
||||
}
|
||||
BufferBlob::free((BufferBlob*) addr);
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_type))
|
||||
@ -1090,9 +1097,13 @@ WB_ENTRY(jint, WB_GetCompilationActivityMode(JNIEnv* env, jobject o))
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jobjectArray, WB_GetCodeBlob(JNIEnv* env, jobject o, jlong addr))
|
||||
ThreadToNativeFromVM ttn(thread);
|
||||
CodeBlobStub stub((CodeBlob*) addr);
|
||||
return codeBlob2objectArray(thread, env, &stub);
|
||||
if (addr == 0) {
|
||||
THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(),
|
||||
"WB_GetCodeBlob: addr is null");
|
||||
}
|
||||
ThreadToNativeFromVM ttn(thread);
|
||||
CodeBlobStub stub((CodeBlob*) addr);
|
||||
return codeBlob2objectArray(thread, env, &stub);
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jlong, WB_GetThreadStackSize(JNIEnv* env, jobject o))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -200,9 +200,10 @@ SensorInfo::SensorInfo() {
|
||||
// any clears unless the usage becomes greater than or equal
|
||||
// to the high threshold.
|
||||
//
|
||||
// If the current level is between high and low threhsold, no change.
|
||||
// If the current level is between high and low threshold, no change.
|
||||
//
|
||||
void SensorInfo::set_gauge_sensor_level(MemoryUsage usage, ThresholdSupport* high_low_threshold) {
|
||||
assert(Service_lock->owned_by_self(), "Must own Service_lock");
|
||||
assert(high_low_threshold->is_high_threshold_supported(), "just checking");
|
||||
|
||||
bool is_over_high = high_low_threshold->is_high_threshold_crossed(usage);
|
||||
@ -257,6 +258,7 @@ void SensorInfo::set_gauge_sensor_level(MemoryUsage usage, ThresholdSupport* hig
|
||||
// the sensor will be on (i.e. sensor is currently off
|
||||
// and has pending trigger requests).
|
||||
void SensorInfo::set_counter_sensor_level(MemoryUsage usage, ThresholdSupport* counter_threshold) {
|
||||
assert(Service_lock->owned_by_self(), "Must own Service_lock");
|
||||
assert(counter_threshold->is_high_threshold_supported(), "just checking");
|
||||
|
||||
bool is_over_high = counter_threshold->is_high_threshold_crossed(usage);
|
||||
@ -278,9 +280,7 @@ void SensorInfo::oops_do(OopClosure* f) {
|
||||
}
|
||||
|
||||
void SensorInfo::process_pending_requests(TRAPS) {
|
||||
if (!has_pending_requests()) {
|
||||
return;
|
||||
}
|
||||
assert(has_pending_requests(), "Must have pending request");
|
||||
|
||||
int pending_count = pending_trigger_count();
|
||||
if (pending_clear_count() > 0) {
|
||||
@ -293,7 +293,6 @@ void SensorInfo::process_pending_requests(TRAPS) {
|
||||
|
||||
void SensorInfo::trigger(int count, TRAPS) {
|
||||
assert(count <= _pending_trigger_count, "just checking");
|
||||
|
||||
if (_sensor_obj != NULL) {
|
||||
Klass* k = Management::sun_management_Sensor_klass(CHECK);
|
||||
instanceKlassHandle sensorKlass (THREAD, k);
|
||||
@ -316,6 +315,7 @@ void SensorInfo::trigger(int count, TRAPS) {
|
||||
{
|
||||
// Holds Service_lock and update the sensor state
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_pending_trigger_count > 0, "Must have pending trigger");
|
||||
_sensor_on = true;
|
||||
_sensor_count += count;
|
||||
_pending_trigger_count = _pending_trigger_count - count;
|
||||
@ -323,6 +323,20 @@ void SensorInfo::trigger(int count, TRAPS) {
|
||||
}
|
||||
|
||||
void SensorInfo::clear(int count, TRAPS) {
|
||||
{
|
||||
// Holds Service_lock and update the sensor state
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (_pending_clear_count == 0) {
|
||||
// Bail out if we lost a race to set_*_sensor_level() which may have
|
||||
// reactivated the sensor in the meantime because it was triggered again.
|
||||
return;
|
||||
}
|
||||
_sensor_on = false;
|
||||
_sensor_count += count;
|
||||
_pending_clear_count = 0;
|
||||
_pending_trigger_count = _pending_trigger_count - count;
|
||||
}
|
||||
|
||||
if (_sensor_obj != NULL) {
|
||||
Klass* k = Management::sun_management_Sensor_klass(CHECK);
|
||||
instanceKlassHandle sensorKlass (THREAD, k);
|
||||
@ -338,14 +352,6 @@ void SensorInfo::clear(int count, TRAPS) {
|
||||
&args,
|
||||
CHECK);
|
||||
}
|
||||
|
||||
{
|
||||
// Holds Service_lock and update the sensor state
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
_sensor_on = false;
|
||||
_pending_clear_count = 0;
|
||||
_pending_trigger_count = _pending_trigger_count - count;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 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
|
||||
@ -180,7 +180,7 @@ public:
|
||||
// any clears unless the usage becomes greater than or equal
|
||||
// to the high threshold.
|
||||
//
|
||||
// If the current level is between high and low threhsold, no change.
|
||||
// If the current level is between high and low threshold, no change.
|
||||
//
|
||||
void set_gauge_sensor_level(MemoryUsage usage, ThresholdSupport* high_low_threshold);
|
||||
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8134974
|
||||
* @summary Cannot pin eliminated arraycopy loads for deopt state in uncommon trap path if it is a loop predicate unc
|
||||
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayLoopPredicateCopyDeopt
|
||||
*
|
||||
*/
|
||||
|
||||
public class TestEliminatedArrayLoopPredicateCopyDeopt {
|
||||
|
||||
static boolean test(int[] array_src) {
|
||||
int[] array_dst = new int[10];
|
||||
System.arraycopy(array_src, 0, array_dst, 0, 10);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
array_src[i] = i;
|
||||
}
|
||||
if (array_dst[0] == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static public void main(String[] args) {
|
||||
int[] array_src = new int[100];
|
||||
for (int i = 0; i < 20000; i++) {
|
||||
test(array_src);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Add C2 x86 Superword support for scalar sum reduction optimizations : double sqrt test
|
||||
*
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=2 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
*
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=4 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
*
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=8 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
*
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-SuperWordReductions -XX:LoopUnrollLimit=250 -XX:LoopMaxUnroll=16 -XX:CompileThresholdScaling=0.1 SumRedSqrt_Double
|
||||
*/
|
||||
|
||||
public class SumRedSqrt_Double
|
||||
{
|
||||
public static void main(String[] args) throws Exception {
|
||||
double[] a = new double[256*1024];
|
||||
double[] b = new double[256*1024];
|
||||
double[] c = new double[256*1024];
|
||||
double[] d = new double[256*1024];
|
||||
sumReductionInit(a,b,c);
|
||||
double total = 0;
|
||||
double valid = 2.06157643776E14;
|
||||
for(int j = 0; j < 2000; j++) {
|
||||
total = sumReductionImplement(a,b,c,d,total);
|
||||
}
|
||||
if(total == valid) {
|
||||
System.out.println("Success");
|
||||
} else {
|
||||
System.out.println("Invalid sum of elements variable in total: " + total);
|
||||
System.out.println("Expected value = " + valid);
|
||||
throw new Exception("Failed");
|
||||
}
|
||||
}
|
||||
|
||||
public static void sumReductionInit(
|
||||
double[] a,
|
||||
double[] b,
|
||||
double[] c)
|
||||
{
|
||||
for(int j = 0; j < 1; j++)
|
||||
{
|
||||
for(int i = 0; i < a.length; i++)
|
||||
{
|
||||
a[i] = i * 1 + j;
|
||||
b[i] = i * 1 - j;
|
||||
c[i] = i + j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static double sumReductionImplement(
|
||||
double[] a,
|
||||
double[] b,
|
||||
double[] c,
|
||||
double[] d,
|
||||
double total)
|
||||
{
|
||||
for(int i = 0; i < a.length; i++)
|
||||
{
|
||||
d[i]= Math.sqrt(a[i] * b[i]) + Math.sqrt(a[i] * c[i]) + Math.sqrt(b[i] * c[i]);
|
||||
total += d[i];
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
}
|
||||
@ -24,7 +24,8 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8085832
|
||||
* @summary x <= 0 || x > 0 wrongly folded as (x-1) >u -1
|
||||
* @bug 8135069
|
||||
* @summary x <= 0 || x > 0 wrongly folded as (x-1) >u -1 and x < 0 || x > -1 wrongly folded as x >u -1
|
||||
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestBadFoldCompare
|
||||
*/
|
||||
|
||||
@ -58,6 +59,34 @@ public class TestBadFoldCompare {
|
||||
helper2(i, 0, 0, flag);
|
||||
}
|
||||
|
||||
static boolean test3_taken;
|
||||
|
||||
static void helper3(int i, int a, int b, boolean flag) {
|
||||
if (flag) {
|
||||
if (i < a || i > b - 1) {
|
||||
test3_taken = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void test3(int i, boolean flag) {
|
||||
helper3(i, 0, 0, flag);
|
||||
}
|
||||
|
||||
static boolean test4_taken;
|
||||
|
||||
static void helper4(int i, int a, int b, boolean flag) {
|
||||
if (flag) {
|
||||
if (i > b - 1 || i < a) {
|
||||
test4_taken = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void test4(int i, boolean flag) {
|
||||
helper4(i, 0, 0, flag);
|
||||
}
|
||||
|
||||
static public void main(String[] args) {
|
||||
boolean success = true;
|
||||
|
||||
@ -87,6 +116,35 @@ public class TestBadFoldCompare {
|
||||
System.out.println("Test2 failed");
|
||||
success = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20000; i++) {
|
||||
helper3(5, 0, 10, (i%2)==0);
|
||||
helper3(-1, 0, 10, (i%2)==0);
|
||||
helper3(15, 0, 10, (i%2)==0);
|
||||
test3(0, false);
|
||||
}
|
||||
test3_taken = false;
|
||||
test3(0, true);
|
||||
|
||||
if (!test3_taken) {
|
||||
System.out.println("Test3 failed");
|
||||
success = false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20000; i++) {
|
||||
helper4(5, 0, 10, (i%2)==0);
|
||||
helper4(-1, 0, 10, (i%2)==0);
|
||||
helper4(15, 0, 10, (i%2)==0);
|
||||
test4(0, false);
|
||||
}
|
||||
test4_taken = false;
|
||||
test4(0, true);
|
||||
|
||||
if (!test4_taken) {
|
||||
System.out.println("Test4 failed");
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
throw new RuntimeException("Some tests failed");
|
||||
}
|
||||
|
||||
@ -428,4 +428,28 @@ public final class Utils {
|
||||
public static long adjustTimeout(long tOut) {
|
||||
return Math.round(tOut * Utils.TIMEOUT_FACTOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs runnable and checks that it throws expected exception. If exceptionException is null it means
|
||||
* that we expect no exception to be thrown.
|
||||
* @param runnable what we run
|
||||
* @param expectedException expected exception
|
||||
*/
|
||||
public static void runAndCheckException(Runnable runnable, Class<? extends Throwable> expectedException) {
|
||||
try {
|
||||
runnable.run();
|
||||
if (expectedException != null) {
|
||||
throw new AssertionError("Didn't get expected exception " + expectedException.getSimpleName());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
if (expectedException == null) {
|
||||
throw new AssertionError("Got unexpected exception ", t);
|
||||
}
|
||||
if (!expectedException.isAssignableFrom(t.getClass())) {
|
||||
throw new AssertionError(String.format("Got unexpected exception %s instead of %s",
|
||||
t.getClass().getSimpleName(), expectedException.getSimpleName()), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
60
hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java
Normal file
60
hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test BlobSanityTest
|
||||
* @bug 8132980
|
||||
* @library /testlibrary /../../test/lib
|
||||
* @modules java.management/sun.management
|
||||
* @build BlobSanityTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI BlobSanityTest
|
||||
* @summary sanity testing of allocateCodeBlob, freeCodeBlob and getCodeBlob
|
||||
*/
|
||||
|
||||
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import jdk.test.lib.Utils;
|
||||
|
||||
public class BlobSanityTest {
|
||||
|
||||
private static void runTest(Consumer<Integer> consumer, int val, String testCaseName, Class<? extends Throwable>
|
||||
expectedException) {
|
||||
System.out.println("Calling " + testCaseName);
|
||||
Utils.runAndCheckException(() -> consumer.accept(val), expectedException);
|
||||
System.out.println("Looks ok");
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("Crash means that sanity check failed");
|
||||
|
||||
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||
|
||||
runTest(wb::freeCodeBlob, 0, "wb::freeCodeBlob(0)", null);
|
||||
runTest(wb::getCodeBlob, 0, "wb::getCodeBlob(0)", NullPointerException.class);
|
||||
runTest(x -> wb.allocateCodeBlob(x, 0), -1, "wb::allocateCodeBlob(-1,0)", IllegalArgumentException.class);
|
||||
}
|
||||
}
|
||||
@ -323,3 +323,4 @@ be357705874c4ba1a69c38fb211e5e31e35bf9cb jdk9-b77
|
||||
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
|
||||
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
|
||||
f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
|
||||
6a418934997fc4b56664b88f8417e2f0fe658091 jdk9-b81
|
||||
|
||||
@ -326,3 +326,4 @@ bd6ece68cf8aca34c8d992569892060c82cfd3f1 jdk9-b77
|
||||
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
|
||||
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
|
||||
e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
|
||||
139338618c77d793ab8b550f06819ddb8381316f jdk9-b81
|
||||
|
||||
@ -323,3 +323,4 @@ f376824d4940f45719d91838f3f6249f873440db jdk9-b72
|
||||
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
|
||||
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
|
||||
4947810137ae53abba3028cc366af953d90fa81a jdk9-b80
|
||||
fdc13a2d32867ca3c57b7fa2620c6b59c83168cb jdk9-b81
|
||||
|
||||
@ -38,7 +38,9 @@ include SetupJavaCompilers.gmk
|
||||
|
||||
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes", \
|
||||
ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
|
||||
SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
|
||||
COPY := boot.modules ext.modules))
|
||||
@ -126,11 +128,11 @@ TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes
|
||||
build.tools.cldrconverter.CLDRConverter
|
||||
|
||||
TOOL_GENMODULESXML = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
|
||||
-cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
|
||||
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
|
||||
build.tools.module.GenJdepsModulesXml
|
||||
|
||||
TOOL_IMAGEBUILDER = $(JAVA_SMALL) -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
|
||||
-cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
|
||||
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
|
||||
build.tools.module.ImageBuilder
|
||||
|
||||
##########################################################################################
|
||||
@ -157,28 +159,6 @@ $(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
|
||||
|
||||
##########################################################################################
|
||||
|
||||
# Tools needed on solaris because OBJCOPY is broken.
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
$(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK, \
|
||||
SRC := $(JDK_TOPDIR)/make/src/native/add_gnu_debuglink, \
|
||||
TOOLCHAIN := TOOLCHAIN_BUILD, \
|
||||
LDFLAGS := -lelf, \
|
||||
OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/add_gnu_debuglink, \
|
||||
OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
|
||||
PROGRAM := add_gnu_debuglink))
|
||||
|
||||
$(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
|
||||
SRC := $(JDK_TOPDIR)/make/src/native/fix_empty_sec_hdr_flags, \
|
||||
TOOLCHAIN := TOOLCHAIN_BUILD, \
|
||||
LDFLAGS := -lelf, \
|
||||
OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
|
||||
OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
|
||||
PROGRAM := fix_empty_sec_hdr_flags))
|
||||
|
||||
BUILD_TOOLS_JDK += $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS)
|
||||
endif
|
||||
|
||||
$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
|
||||
|
||||
java-tools: $(BUILD_TOOLS_JDK)
|
||||
|
||||
@ -77,9 +77,9 @@ $(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo: $(BEANS_SRC) \
|
||||
$(ECHO) Generating beaninfo
|
||||
$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing
|
||||
$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \
|
||||
-sourcepath "$(subst $(SPACE),$(PATH_SEP),\
|
||||
-sourcepath $(call PathList,\
|
||||
$(wildcard $(JDK_TOPDIR)/src/*/*/classes) \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/java.base)" \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/java.base) \
|
||||
-doclet build.tools.swingbeaninfo.GenDocletBeanInfo \
|
||||
-x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \
|
||||
-t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \
|
||||
|
||||
@ -28,9 +28,6 @@ include NativeCompilation.gmk
|
||||
# Prepare the find cache.
|
||||
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
|
||||
|
||||
# Build tools
|
||||
include Tools.gmk
|
||||
|
||||
# When building a legacy overlay image (on solaris 64 bit), the launchers
|
||||
# need to be built with a different rpath and a different output dir.
|
||||
ifeq ($(OVERLAY_IMAGES), true)
|
||||
|
||||
@ -27,9 +27,6 @@ include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include NativeCompilation.gmk
|
||||
|
||||
# Build tools
|
||||
include Tools.gmk
|
||||
|
||||
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
|
||||
|
||||
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2012, 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
|
||||
@ -39,6 +39,7 @@ SUNWprivate_1.1 {
|
||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||
@ -56,6 +57,7 @@ SUNWprivate_1.1 {
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 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
|
||||
@ -28,8 +28,7 @@
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
JNI_OnLoad;
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_init;
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable;
|
||||
Java_java_net_PlainDatagramSocketImpl_dataAvailable;
|
||||
Java_java_net_PlainSocketImpl_socketListen;
|
||||
Java_java_net_PlainDatagramSocketImpl_getTTL;
|
||||
Java_java_net_PlainDatagramSocketImpl_init;
|
||||
|
||||
@ -31,8 +31,9 @@ include RMICompilation.gmk
|
||||
|
||||
##########################################################################################
|
||||
|
||||
BTRMIC_CP := $(INTERIM_CORBA_JAR)$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes$(PATH_SEP)$(INTERIM_LANGTOOLS_JAR)
|
||||
BTRMIC_ARGS := "-Xbootclasspath/p:$(BTRMIC_CP)" -cp "$(BTRMIC_CP)"
|
||||
BTRMIC_CP := $(call PathList, $(INTERIM_CORBA_JAR) \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes $(INTERIM_LANGTOOLS_JAR))
|
||||
BTRMIC_ARGS := -Xbootclasspath/p:$(BTRMIC_CP) -cp $(BTRMIC_CP)
|
||||
RMIC := $(JAVA) $(BTRMIC_ARGS) sun.rmi.rmic.Main
|
||||
|
||||
CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
|
||||
|
||||
@ -27,15 +27,12 @@ package build.tools.cldrconverter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
class Bundle {
|
||||
static enum Type {
|
||||
@ -117,6 +114,7 @@ class Bundle {
|
||||
private final String cldrPath;
|
||||
private final EnumSet<Type> bundleTypes;
|
||||
private final String currencies;
|
||||
private Map<String, Object> targetMap;
|
||||
|
||||
static Bundle getBundle(String id) {
|
||||
return bundles.get(id);
|
||||
@ -176,6 +174,10 @@ class Bundle {
|
||||
* visible for the bundle's locale
|
||||
*/
|
||||
Map<String, Object> getTargetMap() throws Exception {
|
||||
if (targetMap != null) {
|
||||
return targetMap;
|
||||
}
|
||||
|
||||
String[] cldrBundles = getCLDRPath().split(",");
|
||||
|
||||
// myMap contains resources for id.
|
||||
@ -398,6 +400,7 @@ class Bundle {
|
||||
}
|
||||
}
|
||||
|
||||
targetMap = myMap;
|
||||
return myMap;
|
||||
}
|
||||
|
||||
@ -632,7 +635,7 @@ class Bundle {
|
||||
return null;
|
||||
}
|
||||
|
||||
static Object[][] jreTimeZoneNames = TimeZoneNames.getContents();
|
||||
static List<Object[]> jreTimeZoneNames = Arrays.asList(TimeZoneNames.getContents());
|
||||
private void fillInJREs(String key, Map<String, String> map) {
|
||||
String tzid = null;
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
package build.tools.cldrconverter;
|
||||
|
||||
import static build.tools.cldrconverter.Bundle.jreTimeZoneNames;
|
||||
import build.tools.cldrconverter.BundleGenerator.BundleType;
|
||||
import java.io.File;
|
||||
import java.nio.file.DirectoryStream;
|
||||
@ -564,6 +565,44 @@ public class CLDRConverter {
|
||||
|
||||
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
|
||||
Map<String, Object> names = new HashMap<>();
|
||||
|
||||
// Copy over missing time zone ids from JRE for English locale
|
||||
if (id.equals("en")) {
|
||||
Map<String[], String> jreMetaMap = new HashMap<>();
|
||||
jreTimeZoneNames.stream().forEach(e -> {
|
||||
String tzid = (String)e[0];
|
||||
String[] data = (String[])e[1];
|
||||
|
||||
if (map.get(TIMEZONE_ID_PREFIX + tzid) == null &&
|
||||
handlerMetaZones.get(tzid) == null) {
|
||||
// First, check the CLDR meta key
|
||||
Optional<Map.Entry<String, String>> cldrMeta =
|
||||
handlerMetaZones.getData().entrySet().stream()
|
||||
.filter(me ->
|
||||
Arrays.deepEquals(data,
|
||||
(String[])map.get(METAZONE_ID_PREFIX + me.getValue())))
|
||||
.findAny();
|
||||
if (cldrMeta.isPresent()) {
|
||||
names.put(tzid, cldrMeta.get().getValue());
|
||||
} else {
|
||||
// check the JRE meta key, add if there is not.
|
||||
Optional<Map.Entry<String[], String>> jreMeta =
|
||||
jreMetaMap.entrySet().stream()
|
||||
.filter(jm -> Arrays.deepEquals(data, jm.getKey()))
|
||||
.findAny();
|
||||
if (jreMeta.isPresent()) {
|
||||
names.put(tzid, jreMeta.get().getValue());
|
||||
} else {
|
||||
String metaName = "JRE_" + tzid.replaceAll("[/-]", "_");
|
||||
names.put(METAZONE_ID_PREFIX + metaName, data);
|
||||
names.put(tzid, metaName);
|
||||
jreMetaMap.put(data, metaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (String tzid : handlerMetaZones.keySet()) {
|
||||
String tzKey = TIMEZONE_ID_PREFIX + tzid;
|
||||
Object data = map.get(tzKey);
|
||||
|
||||
@ -266,22 +266,47 @@ class ResourceBundleGenerator implements BundleGenerator {
|
||||
out.println((CLDRConverter.isBaseModule ? "package sun.util.cldr;\n\n" :
|
||||
"package sun.util.resources.cldr.provider;\n\n")
|
||||
+ "import java.util.HashMap;\n"
|
||||
+ "import java.util.Locale;\n"
|
||||
+ "import java.util.Map;\n"
|
||||
+ "import java.util.ListResourceBundle;\n"
|
||||
+ "import sun.util.locale.provider.LocaleProviderAdapter;\n"
|
||||
+ "import sun.util.locale.provider.LocaleDataMetaInfo;\n");
|
||||
out.printf("public class %s extends ListResourceBundle implements LocaleDataMetaInfo {\n", className);
|
||||
out.println(" @Override\n" +
|
||||
" protected final Object[][] getContents() {\n" +
|
||||
" final Object[][] data = new Object[][] {");
|
||||
out.printf("public class %s implements LocaleDataMetaInfo {\n", className);
|
||||
out.println(" private static final Map<String, String> resourceNameToLocales = new HashMap<>();\n" +
|
||||
(CLDRConverter.isBaseModule ?
|
||||
" private static final Map<Locale, String[]> parentLocalesMap = new HashMap<>();\n\n" : "\n") +
|
||||
" static {\n");
|
||||
|
||||
for (String key : metaInfo.keySet()) {
|
||||
out.printf(" { \"%s\",\n", key);
|
||||
out.printf(" \"%s\" },\n",
|
||||
if (key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)) {
|
||||
String parentTag = key.substring(CLDRConverter.PARENT_LOCALE_PREFIX.length());
|
||||
if ("root".equals(parentTag)) {
|
||||
out.printf(" parentLocalesMap.put(Locale.ROOT,\n");
|
||||
} else {
|
||||
out.printf(" parentLocalesMap.put(Locale.forLanguageTag(\"%s\"),\n",
|
||||
parentTag);
|
||||
}
|
||||
String[] childlen = toLocaleList(metaInfo.get(key), true).split(" ");
|
||||
out.printf(" new String[] {\n" +
|
||||
" ");
|
||||
int count = 0;
|
||||
for (int i = 0; i < childlen.length; i++) {
|
||||
String child = childlen[i];
|
||||
out.printf("\"%s\", ", child);
|
||||
count += child.length() + 4;
|
||||
if (i != childlen.length - 1 && count > 64) {
|
||||
out.printf("\n ");
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
out.printf("\n });\n");
|
||||
} else {
|
||||
out.printf(" resourceNameToLocales.put(\"%s\",\n", key);
|
||||
out.printf(" \"%s\");\n",
|
||||
toLocaleList(key.equals("FormatData") ? metaInfo.get("AvailableLocales") :
|
||||
metaInfo.get(key),
|
||||
key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)));
|
||||
metaInfo.get(key), false));
|
||||
}
|
||||
}
|
||||
out.println(" };\n return data;\n }\n\n");
|
||||
out.println(" }\n\n");
|
||||
|
||||
out.println(" @Override\n" +
|
||||
" public LocaleProviderAdapter.Type getType() {\n" +
|
||||
@ -290,19 +315,13 @@ class ResourceBundleGenerator implements BundleGenerator {
|
||||
|
||||
out.println(" @Override\n" +
|
||||
" public String availableLanguageTags(String category) {\n" +
|
||||
" return getString(category);\n" +
|
||||
" };\n\n");
|
||||
" return resourceNameToLocales.getOrDefault(category, \"\");\n" +
|
||||
" }\n\n");
|
||||
|
||||
if (CLDRConverter.isBaseModule) {
|
||||
out.printf(" public Map<String, String> parentLocales() {\n" +
|
||||
" Map<String, String> ret = new HashMap<>();\n" +
|
||||
" keySet().stream()\n" +
|
||||
" .filter(key -> key.startsWith(\"%s\"))\n" +
|
||||
" .forEach(key -> ret.put(key.substring(%d), getString(key)));\n" +
|
||||
" return ret.isEmpty() ? null : ret;\n" +
|
||||
" };\n}",
|
||||
CLDRConverter.PARENT_LOCALE_PREFIX,
|
||||
CLDRConverter.PARENT_LOCALE_PREFIX.length());
|
||||
out.printf(" public Map<Locale, String[]> parentLocales() {\n" +
|
||||
" return parentLocalesMap;\n" +
|
||||
" }\n}");
|
||||
} else {
|
||||
out.println("}");
|
||||
}
|
||||
|
||||
@ -1,285 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Name: add_gnu_debuglink.c
|
||||
*
|
||||
* Description: Add a ".gnu_debuglink" section that refers to the specified
|
||||
* debug_info_path to the specified ELF object.
|
||||
*
|
||||
* This program is adapted from the example program shown on the
|
||||
* elf(3elf) man page and from code from the Solaris compiler
|
||||
* driver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* needed to define SHF_EXCLUDE
|
||||
*/
|
||||
#define ELF_TARGET_ALL
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <libelf.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void failure(void);
|
||||
static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
|
||||
size_t len);
|
||||
|
||||
void
|
||||
main(int argc, char ** argv) {
|
||||
/* new ELF section name */
|
||||
static char SEC_NAME[] = ".gnu_debuglink";
|
||||
|
||||
unsigned char buffer[8 * 1024]; /* I/O buffer */
|
||||
int buffer_len; /* buffer length */
|
||||
char * debug_info_path; /* debug info path */
|
||||
void * ehdr; /* ELF header */
|
||||
Elf * elf; /* ELF descriptor */
|
||||
char * elf_ident; /* ELF identity string */
|
||||
char * elf_obj; /* elf_obj file */
|
||||
int fd; /* descriptor for files */
|
||||
unsigned int file_crc = 0; /* CRC for debug info file */
|
||||
int is_elfclass64; /* is an ELFCLASS64 file? */
|
||||
Elf_Data * link_dat; /* ELF data for new debug info link */
|
||||
Elf_Data * name_dat; /* ELF data for new section name */
|
||||
Elf_Scn * new_scn; /* new ELF section descriptor */
|
||||
void * new_shdr; /* new ELF section header */
|
||||
Elf_Scn * scn; /* ELF section descriptor */
|
||||
void * shdr; /* ELF section header */
|
||||
|
||||
if (argc != 3) {
|
||||
(void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
debug_info_path = argv[1]; /* save for later */
|
||||
if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
|
||||
(void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
(void) printf("Computing CRC for '%s'\n", debug_info_path);
|
||||
(void) fflush(stdout);
|
||||
/* compute CRC for the debug info file */
|
||||
for (;;) {
|
||||
int len = read(fd, buffer, sizeof buffer);
|
||||
if (len <= 0) {
|
||||
break;
|
||||
}
|
||||
file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
|
||||
}
|
||||
(void) close(fd);
|
||||
|
||||
/* open the elf_obj */
|
||||
elf_obj = argv[2];
|
||||
if ((fd = open(elf_obj, O_RDWR)) == -1) {
|
||||
(void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
(void) printf("Opening '%s' for update\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_version(EV_CURRENT); /* coordinate ELF versions */
|
||||
|
||||
/* obtain the ELF descriptors from the input file */
|
||||
if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* determine if ELFCLASS64 or not? */
|
||||
elf_ident = elf_getident(elf, NULL);
|
||||
is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
|
||||
|
||||
/* get the ELF header */
|
||||
if (is_elfclass64) {
|
||||
ehdr = elf64_getehdr(elf);
|
||||
} else {
|
||||
ehdr = elf32_getehdr(elf);
|
||||
}
|
||||
if (ehdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the ELF section descriptor */
|
||||
if (is_elfclass64) {
|
||||
scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
|
||||
} else {
|
||||
scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
|
||||
}
|
||||
if (scn == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the section header */
|
||||
if (is_elfclass64) {
|
||||
shdr = elf64_getshdr(scn);
|
||||
} else {
|
||||
shdr = elf32_getshdr(scn);
|
||||
}
|
||||
if (shdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
(void) printf("Adding ELF data for new section name\n");
|
||||
(void) fflush(stdout);
|
||||
name_dat = elf_newdata(scn);
|
||||
name_dat->d_buf = (void *) SEC_NAME;
|
||||
if (is_elfclass64) {
|
||||
name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
|
||||
} else {
|
||||
name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
|
||||
}
|
||||
name_dat->d_align = 1;
|
||||
name_dat->d_size = strlen(SEC_NAME) + 1;
|
||||
|
||||
new_scn = elf_newscn(elf);
|
||||
|
||||
if (is_elfclass64) {
|
||||
new_shdr = elf64_getshdr(new_scn);
|
||||
((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
|
||||
((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
|
||||
((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
|
||||
((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
|
||||
((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
|
||||
} else {
|
||||
new_shdr = elf32_getshdr(new_scn);
|
||||
((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
|
||||
((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
|
||||
((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
|
||||
((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
|
||||
((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
|
||||
}
|
||||
|
||||
(void) printf("Adding ELF data for debug_info_path value\n");
|
||||
(void) fflush(stdout);
|
||||
(void) memset(buffer, 0, sizeof buffer);
|
||||
buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */
|
||||
(void) strncpy((char *) buffer, debug_info_path, buffer_len);
|
||||
if (buffer_len % 4 != 0) {
|
||||
/* not on a 4 byte boundary so pad to the next one */
|
||||
buffer_len += (4 - buffer_len % 4);
|
||||
}
|
||||
/* save the CRC */
|
||||
(void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
|
||||
buffer_len += sizeof file_crc;
|
||||
|
||||
link_dat = elf_newdata(new_scn);
|
||||
link_dat->d_type = ELF_T_BYTE;
|
||||
link_dat->d_size = buffer_len;
|
||||
link_dat->d_buf = buffer;
|
||||
link_dat->d_align = 1;
|
||||
|
||||
(void) printf("Saving updates to '%s'\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
|
||||
(void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
|
||||
(void) elf_end(elf); /* done with ELF obj */
|
||||
(void) close(fd);
|
||||
|
||||
(void) printf("Done updating '%s'\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
exit(0);
|
||||
} /* end main */
|
||||
|
||||
|
||||
static void
|
||||
failure() {
|
||||
(void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
|
||||
exit(5);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The CRC used in gnu_debuglink, retrieved from
|
||||
* http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
|
||||
*/
|
||||
|
||||
static unsigned int
|
||||
gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
|
||||
static const unsigned int crc32_table[256] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
||||
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
||||
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
||||
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
||||
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
||||
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
||||
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
||||
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
||||
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
||||
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
||||
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
||||
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
||||
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
||||
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
||||
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
||||
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
||||
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
||||
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
||||
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
||||
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
||||
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
||||
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
||||
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
||||
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
||||
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
||||
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
||||
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
||||
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
||||
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
||||
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
||||
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
||||
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
||||
0x2d02ef8d
|
||||
};
|
||||
|
||||
unsigned char *end;
|
||||
|
||||
crc = ~crc & 0xffffffff;
|
||||
for (end = buf + len; buf < end; ++buf) {
|
||||
crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
|
||||
}
|
||||
return ~crc & 0xffffffff;
|
||||
}
|
||||
@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Name: fix_empty_sec_hdr_flags.c
|
||||
*
|
||||
* Description: Remove the SHF_ALLOC flag from "empty" section headers.
|
||||
* An "empty" section header has sh_addr == 0 and sh_size == 0.
|
||||
*
|
||||
* This program is adapted from the example program shown on the
|
||||
* elf(3elf) man page and from code from the Solaris compiler
|
||||
* driver.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <libelf.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void failure(void);
|
||||
|
||||
void
|
||||
main(int argc, char ** argv) {
|
||||
void * ehdr; /* ELF header */
|
||||
unsigned int i; /* section counter */
|
||||
int fd; /* descriptor for file */
|
||||
Elf * elf; /* ELF descriptor */
|
||||
char * elf_ident; /* ELF identity string */
|
||||
char * elf_obj; /* elf_obj file */
|
||||
int fix_count; /* number of flags fixed */
|
||||
int is_elfclass64; /* is an ELFCLASS64 file? */
|
||||
Elf_Scn * scn; /* ELF section descriptor */
|
||||
void * shdr; /* ELF section header */
|
||||
Elf_Data * shstrtab; /* ELF section header string table */
|
||||
|
||||
if (argc != 2) {
|
||||
(void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* open the elf_obj */
|
||||
elf_obj = argv[1];
|
||||
if ((fd = open(elf_obj, O_RDWR)) == -1) {
|
||||
(void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
(void) printf("Opening '%s' for update\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_version(EV_CURRENT); /* coordinate ELF versions */
|
||||
|
||||
/* obtain the ELF descriptors from the input file */
|
||||
if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* determine if ELFCLASS64 or not? */
|
||||
elf_ident = elf_getident(elf, NULL);
|
||||
is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
|
||||
|
||||
/* get the ELF header */
|
||||
if (is_elfclass64) {
|
||||
ehdr = elf64_getehdr(elf);
|
||||
} else {
|
||||
ehdr = elf32_getehdr(elf);
|
||||
}
|
||||
if (ehdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the ELF section descriptor */
|
||||
if (is_elfclass64) {
|
||||
scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
|
||||
} else {
|
||||
scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
|
||||
}
|
||||
if (scn == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the section header string table */
|
||||
shstrtab = elf_getdata(scn, NULL);
|
||||
if (shstrtab == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
fix_count = 0;
|
||||
|
||||
/* traverse the sections of the input file */
|
||||
for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
|
||||
int has_flag_set; /* is SHF_ALLOC flag set? */
|
||||
int is_empty; /* is section empty? */
|
||||
char * name; /* short hand pointer */
|
||||
|
||||
/* get the section header */
|
||||
if (is_elfclass64) {
|
||||
shdr = elf64_getshdr(scn);
|
||||
} else {
|
||||
shdr = elf32_getshdr(scn);
|
||||
}
|
||||
if (shdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
if (is_elfclass64) {
|
||||
name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
|
||||
} else {
|
||||
name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
|
||||
}
|
||||
|
||||
if (is_elfclass64) {
|
||||
has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
|
||||
is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
|
||||
((Elf64_Shdr *) shdr)->sh_size == 0;
|
||||
} else {
|
||||
has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
|
||||
is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
|
||||
((Elf32_Shdr *) shdr)->sh_size == 0;
|
||||
}
|
||||
|
||||
if (is_empty && has_flag_set) {
|
||||
(void) printf("section[%u] '%s' is empty, "
|
||||
"but SHF_ALLOC flag is set.\n", i, name);
|
||||
(void) printf("Clearing the SHF_ALLOC flag.\n");
|
||||
|
||||
if (is_elfclass64) {
|
||||
((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
|
||||
} else {
|
||||
((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
|
||||
}
|
||||
fix_count++;
|
||||
}
|
||||
} /* end for each ELF section */
|
||||
|
||||
if (fix_count > 0) {
|
||||
(void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
|
||||
(void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
|
||||
} else {
|
||||
(void) printf("No SHF_ALLOC flags needed to be cleared.\n");
|
||||
}
|
||||
|
||||
(void) elf_end(elf); /* done with ELF obj */
|
||||
(void) close(fd);
|
||||
|
||||
(void) printf("Done %s '%s'\n",
|
||||
(fix_count > 0) ? "updating" : "with", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
exit(0);
|
||||
} /* end main */
|
||||
|
||||
|
||||
static void
|
||||
failure() {
|
||||
(void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
|
||||
exit(6);
|
||||
}
|
||||
@ -141,15 +141,19 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
|
||||
struct stat stat_buf;
|
||||
|
||||
/*
|
||||
* Try to open /proc/<pid>/cmdline
|
||||
* Stat /proc/<pid> to get the user id
|
||||
*/
|
||||
snprintf(fn, sizeof fn, "/proc/%d/cmdline", pid);
|
||||
if ((fd = open(fn, O_RDONLY)) < 0) {
|
||||
return;
|
||||
snprintf(fn, sizeof fn, "/proc/%d", pid);
|
||||
if (stat(fn, &stat_buf) == 0) {
|
||||
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
|
||||
}
|
||||
|
||||
if (fstat(fd, &stat_buf) == 0) {
|
||||
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
|
||||
/*
|
||||
* Try to open /proc/<pid>/cmdline
|
||||
*/
|
||||
strncat(fn, "/cmdline", sizeof fn - strnlen(fn, sizeof fn) - 1);
|
||||
if ((fd = open(fn, O_RDONLY)) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
do { // Block to break out of on errors
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -68,7 +68,6 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
||||
return null;
|
||||
}
|
||||
});
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -364,6 +363,5 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
||||
return connectDisabled;
|
||||
}
|
||||
|
||||
native int dataAvailable();
|
||||
private static native void init();
|
||||
abstract int dataAvailable();
|
||||
}
|
||||
|
||||
@ -233,8 +233,7 @@ public class DistributionPointFetcher {
|
||||
}
|
||||
CertStore ucs = null;
|
||||
try {
|
||||
ucs = URICertStore.getInstance
|
||||
(new URICertStore.URICertStoreParameters(uri));
|
||||
ucs = URICertStore.getInstance(new URICertStoreParameters(uri));
|
||||
} catch (InvalidAlgorithmParameterException |
|
||||
NoSuchAlgorithmException e) {
|
||||
if (debug != null) {
|
||||
|
||||
@ -26,15 +26,13 @@
|
||||
package sun.security.provider.certpath;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Objects;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import sun.security.x509.AttributeNameEnumeration;
|
||||
import sun.security.x509.CertAttrSet;
|
||||
import sun.security.x509.Extension;
|
||||
import sun.security.x509.PKIXExtensions;
|
||||
import sun.security.util.*;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.DerValue;
|
||||
|
||||
/**
|
||||
* Represent the OCSP Nonce Extension.
|
||||
@ -43,252 +41,139 @@ import sun.security.util.*;
|
||||
* and help to prevent replay attacks (see RFC 6960, section 4.4.1).
|
||||
*
|
||||
* @see Extension
|
||||
* @see CertAttrSet
|
||||
*/
|
||||
public class OCSPNonceExtension extends Extension
|
||||
implements CertAttrSet<String> {
|
||||
public final class OCSPNonceExtension extends Extension {
|
||||
|
||||
/**
|
||||
* Attribute name.
|
||||
*/
|
||||
public static final String NAME = "OCSPNonce";
|
||||
public static final String NONCE = "nonce";
|
||||
|
||||
private static final String EXTENSION_NAME = "OCSPNonce";
|
||||
private byte[] nonceData = null;
|
||||
private String extensionName;
|
||||
|
||||
/**
|
||||
* Encode this extension value to DER and assign it to the
|
||||
* {@code extensionName} data member.
|
||||
*
|
||||
* @throws IOException if any errors occur during DER encoding
|
||||
*/
|
||||
private void encodeInternal() throws IOException {
|
||||
if (nonceData == null) {
|
||||
this.extensionValue = null;
|
||||
return;
|
||||
}
|
||||
DerOutputStream os = new DerOutputStream();
|
||||
os.putOctetString(this.nonceData);
|
||||
this.extensionValue = os.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code OCSPNonceExtension} by providing the nonce length.
|
||||
* The criticality is set to false. The random bytes will be generated
|
||||
* using the SUN provider.
|
||||
* The criticality is set to false, and the OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param length the number of random bytes composing the nonce
|
||||
*
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if length is not a positive integer.
|
||||
*/
|
||||
public OCSPNonceExtension(int length) throws IOException {
|
||||
this(PKIXExtensions.OCSPNonce_Id, false, length, NAME);
|
||||
this(false, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the extension (also called by the subclass).
|
||||
* Create a {@code OCSPNonceExtension} by providing the nonce length and
|
||||
* criticality setting. The OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
|
||||
* extension
|
||||
* @param isCritical a boolean flag indicating if the criticality bit
|
||||
* is to be set for this extension
|
||||
* @param length the length of the nonce in bytes
|
||||
* @param extensionName the name of the extension
|
||||
* @param isCritical a boolean flag indicating whether the criticality bit
|
||||
* is set for this extension
|
||||
* @param length the number of random bytes composing the nonce
|
||||
*
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if length is not a positive integer.
|
||||
*/
|
||||
protected OCSPNonceExtension(ObjectIdentifier extensionId,
|
||||
boolean isCritical, int length, String extensionName)
|
||||
public OCSPNonceExtension(boolean isCritical, int length)
|
||||
throws IOException {
|
||||
SecureRandom rng = new SecureRandom();
|
||||
this.nonceData = new byte[length];
|
||||
rng.nextBytes(nonceData);
|
||||
this.extensionId = extensionId;
|
||||
this.extensionId = PKIXExtensions.OCSPNonce_Id;
|
||||
this.critical = isCritical;
|
||||
this.extensionName = extensionName;
|
||||
encodeInternal();
|
||||
|
||||
if (length > 0) {
|
||||
SecureRandom rng = new SecureRandom();
|
||||
this.nonceData = new byte[length];
|
||||
rng.nextBytes(nonceData);
|
||||
this.extensionValue = new DerValue(DerValue.tag_OctetString,
|
||||
nonceData).toByteArray();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Length must be a positive integer");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the extension using the provided criticality bit setting and
|
||||
* DER encoding.
|
||||
* Create a {@code OCSPNonceExtension} by providing a nonce value.
|
||||
* The criticality is set to false, and the OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param critical true if the extension is to be treated as critical.
|
||||
* @param value an array of DER encoded bytes of the extnValue for the
|
||||
* extension. It must not include the encapsulating OCTET STRING
|
||||
* tag and length. For an {@code OCSPNonceExtension} the data value
|
||||
* should be a simple OCTET STRING containing random bytes
|
||||
* (see RFC 6960, section 4.4.1).
|
||||
* @param incomingNonce The nonce data to be set for the extension. This
|
||||
* must be a non-null array of at least one byte long.
|
||||
*
|
||||
* @throws ClassCastException if value is not an array of bytes
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if the incomingNonce length is not a
|
||||
* positive integer.
|
||||
* @throws NullPointerException if the incomingNonce is null.
|
||||
*/
|
||||
public OCSPNonceExtension(Boolean critical, Object value)
|
||||
throws IOException {
|
||||
this(PKIXExtensions.OCSPNonce_Id, critical, value, NAME);
|
||||
public OCSPNonceExtension(byte[] incomingNonce) throws IOException {
|
||||
this(false, incomingNonce);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the extension (also called by the subclass).
|
||||
* Create a {@code OCSPNonceExtension} by providing a nonce value and
|
||||
* criticality setting. The OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
|
||||
* extension
|
||||
* @param critical a boolean flag indicating if the criticality bit
|
||||
* is to be set for this extension
|
||||
* @param value an array of DER encoded bytes of the extnValue for the
|
||||
* extension. It must not include the encapsulating OCTET STRING
|
||||
* tag and length. For an {@code OCSPNonceExtension} the data value
|
||||
* should be a simple OCTET STRING containing random bytes
|
||||
* (see RFC 6960, section 4.4.1).
|
||||
* @param extensionName the name of the extension
|
||||
* @param isCritical a boolean flag indicating whether the criticality bit
|
||||
* is set for this extension
|
||||
* @param incomingNonce The nonce data to be set for the extension. This
|
||||
* must be a non-null array of at least one byte long.
|
||||
*
|
||||
* @throws ClassCastException if value is not an array of bytes
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if the incomingNonce length is not a
|
||||
* positive integer.
|
||||
* @throws NullPointerException if the incomingNonce is null.
|
||||
*/
|
||||
protected OCSPNonceExtension(ObjectIdentifier extensionId,
|
||||
Boolean critical, Object value, String extensionName)
|
||||
public OCSPNonceExtension(boolean isCritical, byte[] incomingNonce)
|
||||
throws IOException {
|
||||
this.extensionId = extensionId;
|
||||
this.critical = critical;
|
||||
this.extensionValue = (byte[]) value;
|
||||
DerValue val = new DerValue(this.extensionValue);
|
||||
this.nonceData = val.getOctetString();
|
||||
this.extensionName = extensionName;
|
||||
}
|
||||
this.extensionId = PKIXExtensions.OCSPNonce_Id;
|
||||
this.critical = isCritical;
|
||||
|
||||
/**
|
||||
* Set the attribute value.
|
||||
*
|
||||
* @param name the name of the attribute.
|
||||
* @param obj an array of nonce bytes for the extension. It must not
|
||||
* contain any DER tags or length.
|
||||
*
|
||||
* @throws IOException if an unsupported name is provided or the supplied
|
||||
* {@code obj} is not a byte array
|
||||
*/
|
||||
@Override
|
||||
public void set(String name, Object obj) throws IOException {
|
||||
if (name.equalsIgnoreCase(NONCE)) {
|
||||
if (!(obj instanceof byte[])) {
|
||||
throw new IOException("Attribute must be of type byte[].");
|
||||
}
|
||||
nonceData = (byte[])obj;
|
||||
Objects.requireNonNull(incomingNonce, "Nonce data must be non-null");
|
||||
if (incomingNonce.length > 0) {
|
||||
this.nonceData = incomingNonce.clone();
|
||||
this.extensionValue = new DerValue(DerValue.tag_OctetString,
|
||||
nonceData).toByteArray();
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by"
|
||||
+ " CertAttrSet:" + extensionName + ".");
|
||||
}
|
||||
encodeInternal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attribute value.
|
||||
*
|
||||
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
|
||||
* is currently supported.
|
||||
*
|
||||
* @return an array of bytes that are the nonce data. It will not contain
|
||||
* any DER tags or length, only the random nonce bytes.
|
||||
*
|
||||
* @throws IOException if an unsupported name is provided.
|
||||
*/
|
||||
@Override
|
||||
public Object get(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(NONCE)) {
|
||||
return nonceData;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by"
|
||||
+ " CertAttrSet:" + extensionName + ".");
|
||||
throw new IllegalArgumentException(
|
||||
"Nonce data must be at least 1 byte in length");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the attribute value.
|
||||
* Return the nonce bytes themselves, without any DER encoding.
|
||||
*
|
||||
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
|
||||
* is currently supported.
|
||||
*
|
||||
* @throws IOException if an unsupported name is provided or an error
|
||||
* occurs during re-encoding of the extension.
|
||||
* @return A copy of the underlying nonce bytes
|
||||
*/
|
||||
@Override
|
||||
public void delete(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(NONCE)) {
|
||||
nonceData = null;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by"
|
||||
+ " CertAttrSet:" + extensionName + ".");
|
||||
}
|
||||
encodeInternal();
|
||||
public byte[] getNonceValue() {
|
||||
return nonceData.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a printable representation of the {@code OCSPNonceExtension}.
|
||||
*
|
||||
* @return a string representation of the extension.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = super.toString() + extensionName + ": " +
|
||||
((nonceData == null) ? "" : Debug.toString(nonceData))
|
||||
+ "\n";
|
||||
return (s);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(super.toString()).append(EXTENSION_NAME).append(": ");
|
||||
sb.append((nonceData == null) ? "" : Debug.toString(nonceData));
|
||||
sb.append("\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the extension to an {@code OutputStream}
|
||||
* Return the name of the extension as a {@code String}
|
||||
*
|
||||
* @param out the {@code OutputStream} to write the extension to.
|
||||
*
|
||||
* @throws IOException on encoding errors.
|
||||
* @return the name of the extension
|
||||
*/
|
||||
@Override
|
||||
public void encode(OutputStream out) throws IOException {
|
||||
encode(out, PKIXExtensions.OCSPNonce_Id, this.critical);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the extension to the DerOutputStream.
|
||||
*
|
||||
* @param out the {@code OutputStream} to write the extension to.
|
||||
* @param extensionId the {@code ObjectIdentifier} used for this extension
|
||||
* @param isCritical a flag indicating if the criticality bit is set for
|
||||
* this extension.
|
||||
*
|
||||
* @throws IOException on encoding errors.
|
||||
*/
|
||||
protected void encode(OutputStream out, ObjectIdentifier extensionId,
|
||||
boolean isCritical) throws IOException {
|
||||
|
||||
DerOutputStream tmp = new DerOutputStream();
|
||||
|
||||
if (this.extensionValue == null) {
|
||||
this.extensionId = extensionId;
|
||||
this.critical = isCritical;
|
||||
encodeInternal();
|
||||
}
|
||||
super.encode(tmp);
|
||||
out.write(tmp.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an enumeration of names of attributes existing within this
|
||||
* attribute.
|
||||
*/
|
||||
@Override
|
||||
public Enumeration<String> getElements() {
|
||||
AttributeNameEnumeration elements = new AttributeNameEnumeration();
|
||||
elements.addElement(NONCE);
|
||||
return (elements.elements());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of this attribute.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return (extensionName);
|
||||
return EXTENSION_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,9 +44,7 @@ import java.security.cert.CRLException;
|
||||
import java.security.cert.CRLSelector;
|
||||
import java.security.cert.URICertStoreParameters;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.cert.X509CertSelector;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.security.cert.X509CRLSelector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -160,12 +158,11 @@ class URICertStore extends CertStoreSpi {
|
||||
throw new InvalidAlgorithmParameterException
|
||||
("params must be instanceof URICertStoreParameters");
|
||||
}
|
||||
this.uri = ((URICertStoreParameters) params).uri;
|
||||
this.uri = ((URICertStoreParameters) params).getURI();
|
||||
// if ldap URI, use an LDAPCertStore to fetch certs and CRLs
|
||||
if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
|
||||
ldap = true;
|
||||
URICertStoreParameters lparams = new URICertStoreParameters(uri);
|
||||
ldapCertStore = CertStore.getInstance("LDAP", lparams);
|
||||
ldapCertStore = CertStore.getInstance("LDAP", params);
|
||||
}
|
||||
try {
|
||||
factory = CertificateFactory.getInstance("X.509");
|
||||
@ -183,7 +180,7 @@ class URICertStore extends CertStoreSpi {
|
||||
static synchronized CertStore getInstance(URICertStoreParameters params)
|
||||
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
||||
if (debug != null) {
|
||||
debug.println("CertStore URI:" + params.uri);
|
||||
debug.println("CertStore URI:" + params.getURI());
|
||||
}
|
||||
CertStore ucs = certStoreCache.get(params);
|
||||
if (ucs == null) {
|
||||
@ -212,8 +209,7 @@ class URICertStore extends CertStoreSpi {
|
||||
}
|
||||
URI uri = ((URIName) gn).getURI();
|
||||
try {
|
||||
return URICertStore.getInstance
|
||||
(new URICertStore.URICertStoreParameters(uri));
|
||||
return URICertStore.getInstance(new URICertStoreParameters(uri));
|
||||
} catch (Exception ex) {
|
||||
if (debug != null) {
|
||||
debug.println("exception creating CertStore: " + ex);
|
||||
@ -420,40 +416,6 @@ class URICertStore extends CertStoreSpi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CertStoreParameters for the URICertStore.
|
||||
*/
|
||||
static class URICertStoreParameters implements CertStoreParameters {
|
||||
private final URI uri;
|
||||
private volatile int hashCode = 0;
|
||||
URICertStoreParameters(URI uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
@Override public boolean equals(Object obj) {
|
||||
if (!(obj instanceof URICertStoreParameters)) {
|
||||
return false;
|
||||
}
|
||||
URICertStoreParameters params = (URICertStoreParameters) obj;
|
||||
return uri.equals(params.uri);
|
||||
}
|
||||
@Override public int hashCode() {
|
||||
if (hashCode == 0) {
|
||||
int result = 17;
|
||||
result = 37*result + uri.hashCode();
|
||||
hashCode = result;
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
@Override public Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
/* Cannot happen */
|
||||
throw new InternalError(e.toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows the URICertStore to be accessed as a CertStore.
|
||||
*/
|
||||
|
||||
@ -41,6 +41,7 @@ import java.util.Objects;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.stream.Stream;
|
||||
import sun.util.locale.provider.JRELocaleProviderAdapter;
|
||||
import sun.util.locale.provider.LocaleProviderAdapter;
|
||||
import sun.util.locale.provider.LocaleDataMetaInfo;
|
||||
@ -148,11 +149,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
||||
private List<Locale> applyParentLocales(String baseName, List<Locale> candidates) {
|
||||
if (Objects.isNull(parentLocalesMap)) {
|
||||
Map<Locale, Locale> map = new HashMap<>();
|
||||
Map<String, String> parentLocales = baseMetaInfo.parentLocales();
|
||||
parentLocales.keySet().forEach(parent -> {
|
||||
Arrays.asList(parentLocales.get(parent).split(" ")).stream().forEach(child -> {
|
||||
map.put(Locale.forLanguageTag(child),
|
||||
"root".equals(parent) ? Locale.ROOT : Locale.forLanguageTag(parent));
|
||||
baseMetaInfo.parentLocales().forEach((parent, children) -> {
|
||||
Stream.of(children).forEach(child -> {
|
||||
map.put(Locale.forLanguageTag(child), parent);
|
||||
});
|
||||
});
|
||||
parentLocalesMap = Collections.unmodifiableMap(map);
|
||||
|
||||
@ -57,6 +57,7 @@ Java_java_net_InetAddress_init(JNIEnv *env, jclass cls) {
|
||||
c = (*env)->FindClass(env,"java/net/InetAddress$InetAddressHolder");
|
||||
CHECK_NULL(c);
|
||||
iac_class = (*env)->NewGlobalRef(env, c);
|
||||
CHECK_NULL(iac_class);
|
||||
ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;");
|
||||
CHECK_NULL(ia_holderID);
|
||||
ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -130,6 +130,8 @@ class PlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
||||
|
||||
protected native void disconnect0(int family);
|
||||
|
||||
native int dataAvailable();
|
||||
|
||||
/**
|
||||
* Perform class load-time initializations.
|
||||
*/
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 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
|
||||
@ -31,3 +31,4 @@
|
||||
# and may not be available in a future release.
|
||||
#
|
||||
-server KNOWN
|
||||
-client IGNORE
|
||||
|
||||
@ -35,14 +35,20 @@
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __solaris__
|
||||
#if defined(__solaris__)
|
||||
#include <libscf.h>
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
#include "TimeZone_md.h"
|
||||
|
||||
#define SKIP_SPACE(p) while (*p == ' ' || *p == '\t') p++;
|
||||
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
#define dirent64 dirent
|
||||
#define readdir64_r readdir_r
|
||||
#endif
|
||||
|
||||
#if !defined(__solaris__) || defined(__sparcv9) || defined(amd64)
|
||||
#define fileopen fopen
|
||||
#define filegets fgets
|
||||
@ -50,19 +56,20 @@
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
||||
|
||||
|
||||
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
|
||||
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
|
||||
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
|
||||
#else
|
||||
#ifdef _AIX
|
||||
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
|
||||
#endif
|
||||
static const char *SYS_INIT_FILE = "/etc/default/init";
|
||||
static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
|
||||
static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
|
||||
#endif /*__linux__*/
|
||||
#endif /* defined(__linux__) || defined(_ALLBSD_SOURCE) */
|
||||
|
||||
#if defined(_AIX)
|
||||
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX) || defined(__solaris__)
|
||||
|
||||
/*
|
||||
* Returns a pointer to the zone ID portion of the given zoneinfo file
|
||||
@ -108,8 +115,8 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
||||
{
|
||||
DIR *dirp = NULL;
|
||||
struct stat statbuf;
|
||||
struct dirent *dp = NULL;
|
||||
struct dirent *entry = NULL;
|
||||
struct dirent64 *dp = NULL;
|
||||
struct dirent64 *entry = NULL;
|
||||
char *pathname = NULL;
|
||||
int fd = -1;
|
||||
char *dbuf = NULL;
|
||||
@ -120,19 +127,13 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entry = (struct dirent *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
|
||||
entry = (struct dirent64 *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
|
||||
if (entry == NULL) {
|
||||
(void) closedir(dirp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(_AIX) || defined(__linux__) || defined(MACOSX) || (defined(__solaris__) \
|
||||
&& (defined(_POSIX_PTHREAD_SEMANTICS) || defined(_LP64)))
|
||||
while (readdir_r(dirp, entry, &dp) == 0 && dp != NULL) {
|
||||
#else
|
||||
while ((dp = readdir_r(dirp, entry)) != NULL) {
|
||||
#endif
|
||||
|
||||
while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {
|
||||
/*
|
||||
* Skip '.' and '..' (and possibly other .* files)
|
||||
*/
|
||||
@ -145,7 +146,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
||||
*/
|
||||
if ((strcmp(dp->d_name, "ROC") == 0)
|
||||
|| (strcmp(dp->d_name, "posixrules") == 0)
|
||||
#ifdef __solaris__
|
||||
#if defined(__solaris__)
|
||||
/*
|
||||
* Skip the "src" and "tab" directories on Solaris.
|
||||
*/
|
||||
@ -230,7 +231,7 @@ getPlatformTimeZoneID()
|
||||
char *buf;
|
||||
size_t size;
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
/*
|
||||
* Try reading the /etc/timezone file for Debian distros. There's
|
||||
* no spec of the file format available. This parsing assumes that
|
||||
@ -254,7 +255,7 @@ getPlatformTimeZoneID()
|
||||
return tz;
|
||||
}
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
/*
|
||||
* Next, try /etc/localtime to find the zone ID.
|
||||
@ -318,8 +319,9 @@ getPlatformTimeZoneID()
|
||||
free((void *) buf);
|
||||
return tz;
|
||||
}
|
||||
#else
|
||||
#ifdef __solaris__
|
||||
|
||||
#elif defined(__solaris__)
|
||||
|
||||
#if !defined(__sparcv9) && !defined(amd64)
|
||||
|
||||
/*
|
||||
@ -444,8 +446,7 @@ filegets(char *s, int n, FILE *stream)
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
#endif /* not __sparcv9 */
|
||||
|
||||
#endif /* !defined(__sparcv9) && !defined(amd64) */
|
||||
|
||||
/*
|
||||
* Performs Solaris dependent mapping. Returns a zone ID if
|
||||
@ -546,7 +547,7 @@ cleanupScf(scf_handle_t *h,
|
||||
}
|
||||
|
||||
/*
|
||||
* Retruns a zone ID of Solaris when the TZ value is "localtime".
|
||||
* Returns a zone ID of Solaris when the TZ value is "localtime".
|
||||
* First, it tries scf. If scf fails, it looks for the same file as
|
||||
* /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
|
||||
*/
|
||||
@ -615,10 +616,11 @@ getSolarisDefaultZoneID() {
|
||||
free((void *) buf);
|
||||
return tz;
|
||||
}
|
||||
#endif /*__solaris__*/
|
||||
#endif /*__linux__*/
|
||||
|
||||
#ifdef _AIX
|
||||
#endif /* defined(__solaris__) */
|
||||
|
||||
#elif defined(_AIX)
|
||||
|
||||
static char *
|
||||
getPlatformTimeZoneID()
|
||||
{
|
||||
@ -644,178 +646,33 @@ getPlatformTimeZoneID()
|
||||
|
||||
return tz;
|
||||
}
|
||||
static char *mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* findJavaTZ_md() maps platform time zone ID to Java time zone ID
|
||||
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
|
||||
* trys some libc implementation dependent mappings. If it still
|
||||
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
|
||||
* form.
|
||||
*/
|
||||
/*ARGSUSED1*/
|
||||
char *
|
||||
findJavaTZ_md(const char *java_home_dir)
|
||||
{
|
||||
char *tz;
|
||||
char *javatz = NULL;
|
||||
char *freetz = NULL;
|
||||
|
||||
tz = getenv("TZ");
|
||||
|
||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
||||
if (tz == NULL) {
|
||||
#else
|
||||
#if defined (__solaris__) || defined(_AIX)
|
||||
if (tz == NULL || *tz == '\0') {
|
||||
#endif
|
||||
#endif
|
||||
tz = getPlatformTimeZoneID();
|
||||
freetz = tz;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove any preceding ':'
|
||||
*/
|
||||
if (tz != NULL && *tz == ':') {
|
||||
tz++;
|
||||
}
|
||||
|
||||
#ifdef __solaris__
|
||||
if (tz != NULL && strcmp(tz, "localtime") == 0) {
|
||||
tz = getSolarisDefaultZoneID();
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
freetz = tz;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tz != NULL) {
|
||||
#ifdef __linux__
|
||||
/*
|
||||
* Ignore "posix/" prefix.
|
||||
*/
|
||||
if (strncmp(tz, "posix/", 6) == 0) {
|
||||
tz += 6;
|
||||
}
|
||||
#endif
|
||||
javatz = strdup(tz);
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
|
||||
#ifdef _AIX
|
||||
freetz = mapPlatformToJavaTimezone(java_home_dir, javatz);
|
||||
if (javatz != NULL) {
|
||||
free((void *) javatz);
|
||||
}
|
||||
javatz = freetz;
|
||||
#endif
|
||||
}
|
||||
|
||||
return javatz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a GMT-offset-based zone ID. (e.g., "GMT-08:00")
|
||||
*/
|
||||
|
||||
#ifdef MACOSX
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
struct tm *local_tm;
|
||||
time_t clock;
|
||||
time_t currenttime;
|
||||
|
||||
clock = time(NULL);
|
||||
tzset();
|
||||
local_tm = localtime(&clock);
|
||||
if (local_tm->tm_gmtoff >= 0) {
|
||||
offset = (time_t) local_tm->tm_gmtoff;
|
||||
sign = '+';
|
||||
} else {
|
||||
offset = (time_t) -local_tm->tm_gmtoff;
|
||||
sign = '-';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
#else
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
#ifdef __solaris__
|
||||
struct tm localtm;
|
||||
time_t currenttime;
|
||||
|
||||
currenttime = time(NULL);
|
||||
if (localtime_r(¤ttime, &localtm) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
offset = localtm.tm_isdst ? altzone : timezone;
|
||||
#else
|
||||
offset = timezone;
|
||||
#endif /*__linux__*/
|
||||
|
||||
if (offset == 0) {
|
||||
return strdup("GMT");
|
||||
}
|
||||
|
||||
/* Note that the time offset direction is opposite. */
|
||||
if (offset > 0) {
|
||||
sign = '-';
|
||||
} else {
|
||||
offset = -offset;
|
||||
sign = '+';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
#endif /* MACOSX */
|
||||
|
||||
#ifdef _AIX
|
||||
static char *
|
||||
mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
||||
FILE *tzmapf;
|
||||
char mapfilename[PATH_MAX+1];
|
||||
char mapfilename[PATH_MAX + 1];
|
||||
char line[256];
|
||||
int linecount = 0;
|
||||
char temp[100], *temp_tz;
|
||||
char *tz_buf = NULL;
|
||||
char *temp_tz = NULL;
|
||||
char *javatz = NULL;
|
||||
char *str_tmp = NULL;
|
||||
size_t temp_tz_len = 0;
|
||||
size_t tz_len = 0;
|
||||
|
||||
/* On AIX, the TZ environment variable may end with a comma
|
||||
* followed by modifier fields. These are ignored here.
|
||||
*/
|
||||
strncpy(temp, tz, 100);
|
||||
temp_tz = strtok_r(temp, ",", &str_tmp);
|
||||
* followed by modifier fields. These are ignored here. */
|
||||
temp_tz = strchr(tz, ',');
|
||||
tz_len = (temp_tz == NULL) ? strlen(tz) : temp_tz - tz;
|
||||
tz_buf = (char *)malloc(tz_len + 1);
|
||||
memcpy(tz_buf, tz, tz_len);
|
||||
tz_buf[tz_len] = 0;
|
||||
|
||||
if(temp_tz == NULL)
|
||||
goto tzerr;
|
||||
|
||||
temp_tz_len = strlen(temp_tz);
|
||||
|
||||
if (strlen(java_home_dir) >= (PATH_MAX - 15)) {
|
||||
jio_fprintf(stderr, "java.home longer than maximum path length \n");
|
||||
/* Open tzmappings file, with buffer overrun check */
|
||||
if ((strlen(java_home_dir) + 15) > PATH_MAX) {
|
||||
jio_fprintf(stderr, "Path %s/lib/tzmappings exceeds maximum path length\n", java_home_dir);
|
||||
goto tzerr;
|
||||
}
|
||||
|
||||
strncpy(mapfilename, java_home_dir, PATH_MAX);
|
||||
strcpy(mapfilename, java_home_dir);
|
||||
strcat(mapfilename, "/lib/tzmappings");
|
||||
|
||||
if ((tzmapf = fopen(mapfilename, "r")) == NULL) {
|
||||
jio_fprintf(stderr, "can't open %s\n", mapfilename);
|
||||
goto tzerr;
|
||||
@ -848,7 +705,7 @@ mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
||||
}
|
||||
|
||||
*p++ = '\0';
|
||||
if ((result = strncmp(temp_tz, sol, temp_tz_len)) == 0) {
|
||||
if ((result = strncmp(tz_buf, sol, tz_len)) == 0) {
|
||||
/*
|
||||
* If this is the current platform zone ID,
|
||||
* take the Java time zone ID (2nd field).
|
||||
@ -874,11 +731,150 @@ mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
||||
(void) fclose(tzmapf);
|
||||
|
||||
tzerr:
|
||||
if (tz_buf != NULL ) {
|
||||
free((void *) tz_buf);
|
||||
}
|
||||
|
||||
if (javatz == NULL) {
|
||||
return getGMTOffsetID();
|
||||
}
|
||||
|
||||
return javatz;
|
||||
}
|
||||
|
||||
#endif /* defined(_AIX) */
|
||||
|
||||
/*
|
||||
* findJavaTZ_md() maps platform time zone ID to Java time zone ID
|
||||
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
|
||||
* trys some libc implementation dependent mappings. If it still
|
||||
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
|
||||
* form.
|
||||
*/
|
||||
/*ARGSUSED1*/
|
||||
char *
|
||||
findJavaTZ_md(const char *java_home_dir)
|
||||
{
|
||||
char *tz;
|
||||
char *javatz = NULL;
|
||||
char *freetz = NULL;
|
||||
|
||||
tz = getenv("TZ");
|
||||
|
||||
if (tz == NULL || *tz == '\0') {
|
||||
tz = getPlatformTimeZoneID();
|
||||
freetz = tz;
|
||||
}
|
||||
|
||||
if (tz != NULL) {
|
||||
/* Ignore preceding ':' */
|
||||
if (*tz == ':') {
|
||||
tz++;
|
||||
}
|
||||
#if defined(__linux__)
|
||||
/* Ignore "posix/" prefix on Linux. */
|
||||
if (strncmp(tz, "posix/", 6) == 0) {
|
||||
tz += 6;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_AIX)
|
||||
/* On AIX do the platform to Java mapping. */
|
||||
javatz = mapPlatformToJavaTimezone(java_home_dir, tz);
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
#else
|
||||
#if defined(__solaris__)
|
||||
/* Solaris might use localtime, so handle it here. */
|
||||
if (strcmp(tz, "localtime") == 0) {
|
||||
javatz = getSolarisDefaultZoneID();
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (freetz == NULL) {
|
||||
/* strdup if we are still working on getenv result. */
|
||||
javatz = strdup(tz);
|
||||
} else if (freetz != tz) {
|
||||
/* strdup and free the old buffer, if we moved the pointer. */
|
||||
javatz = strdup(tz);
|
||||
free((void *) freetz);
|
||||
} else {
|
||||
/* we are good if we already work on a freshly allocated buffer. */
|
||||
javatz = tz;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return javatz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a GMT-offset-based zone ID. (e.g., "GMT-08:00")
|
||||
*/
|
||||
|
||||
#if defined(MACOSX)
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
struct tm *local_tm;
|
||||
time_t clock;
|
||||
time_t currenttime;
|
||||
|
||||
clock = time(NULL);
|
||||
tzset();
|
||||
local_tm = localtime(&clock);
|
||||
if (local_tm->tm_gmtoff >= 0) {
|
||||
offset = (time_t) local_tm->tm_gmtoff;
|
||||
sign = '+';
|
||||
} else {
|
||||
offset = (time_t) -local_tm->tm_gmtoff;
|
||||
sign = '-';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
#if defined(__solaris__)
|
||||
struct tm localtm;
|
||||
time_t currenttime;
|
||||
|
||||
currenttime = time(NULL);
|
||||
if (localtime_r(¤ttime, &localtm) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
offset = localtm.tm_isdst ? altzone : timezone;
|
||||
#else
|
||||
offset = timezone;
|
||||
#endif
|
||||
|
||||
if (offset == 0) {
|
||||
return strdup("GMT");
|
||||
}
|
||||
|
||||
/* Note that the time offset direction is opposite. */
|
||||
if (offset > 0) {
|
||||
sign = '-';
|
||||
} else {
|
||||
offset = -offset;
|
||||
sign = '+';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
#endif /* MACOSX */
|
||||
|
||||
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef __solaris__
|
||||
#include <unistd.h>
|
||||
#include <stropts.h>
|
||||
|
||||
#ifndef BSD_COMP
|
||||
#define BSD_COMP
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_AbstractPlainDatagramSocketImpl.h"
|
||||
|
||||
static jfieldID IO_fd_fdID;
|
||||
|
||||
static jfieldID apdsi_fdID;
|
||||
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: init
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
||||
|
||||
apdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(apdsi_fdID);
|
||||
|
||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
int fd, retval;
|
||||
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID);
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
|
||||
if (ioctl(fd, FIONREAD, &retval) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -32,6 +32,12 @@
|
||||
|
||||
#ifdef __solaris__
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stropts.h>
|
||||
|
||||
#ifndef BSD_COMP
|
||||
#define BSD_COMP
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
@ -52,6 +58,8 @@
|
||||
#endif
|
||||
#endif // __linux__
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifndef IPTOS_TOS_MASK
|
||||
#define IPTOS_TOS_MASK 0x1e
|
||||
#endif
|
||||
@ -2240,3 +2248,28 @@ Java_java_net_PlainDatagramSocketImpl_leave(JNIEnv *env, jobject this,
|
||||
{
|
||||
mcast_join_leave(env, this, iaObj, niObj, JNI_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_PlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_java_net_PlainDatagramSocketImpl_dataAvailable(JNIEnv *env, jobject this)
|
||||
{
|
||||
int fd, retval;
|
||||
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
|
||||
if (ioctl(fd, FIONREAD, &retval) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -118,6 +118,8 @@ Java_sun_net_sdp_SdpSupport_convert0(JNIEnv *env, jclass cls, int fd)
|
||||
RESTARTABLE(dup2(s, fd), res);
|
||||
if (res < 0)
|
||||
JNU_ThrowIOExceptionWithLastError(env, "dup2");
|
||||
RESTARTABLE(close(s), res);
|
||||
res = close(s);
|
||||
if (res < 0 && !(*env)->ExceptionOccurred(env))
|
||||
JNU_ThrowIOExceptionWithLastError(env, "close");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -45,7 +45,7 @@ import java.security.PrivilegedAction;
|
||||
|
||||
class DefaultDatagramSocketImplFactory
|
||||
{
|
||||
static Class<?> prefixImplClass = null;
|
||||
private final static Class<?> prefixImplClass;
|
||||
|
||||
/* the windows version. */
|
||||
private static float version;
|
||||
@ -54,16 +54,19 @@ class DefaultDatagramSocketImplFactory
|
||||
private static boolean preferIPv4Stack = false;
|
||||
|
||||
/* If the version supports a dual stack TCP implementation */
|
||||
private static boolean useDualStackImpl = false;
|
||||
private final static boolean useDualStackImpl;
|
||||
|
||||
/* sun.net.useExclusiveBind */
|
||||
private static String exclBindProp;
|
||||
|
||||
/* True if exclusive binding is on for Windows */
|
||||
private static boolean exclusiveBind = true;
|
||||
|
||||
private final static boolean exclusiveBind;
|
||||
|
||||
static {
|
||||
Class<?> prefixImplClassLocal = null;
|
||||
boolean useDualStackImplLocal = false;
|
||||
boolean exclusiveBindLocal = true;
|
||||
|
||||
// Determine Windows Version.
|
||||
java.security.AccessController.doPrivileged(
|
||||
new PrivilegedAction<Object>() {
|
||||
@ -78,7 +81,7 @@ class DefaultDatagramSocketImplFactory
|
||||
"java.net.preferIPv4Stack"));
|
||||
exclBindProp = System.getProperty(
|
||||
"sun.net.useExclusiveBind");
|
||||
} catch (NumberFormatException e ) {
|
||||
} catch (NumberFormatException e) {
|
||||
assert false : e;
|
||||
}
|
||||
return null; // nothing to return
|
||||
@ -87,14 +90,14 @@ class DefaultDatagramSocketImplFactory
|
||||
|
||||
// (version >= 6.0) implies Vista or greater.
|
||||
if (version >= 6.0 && !preferIPv4Stack) {
|
||||
useDualStackImpl = true;
|
||||
useDualStackImplLocal = true;
|
||||
}
|
||||
if (exclBindProp != null) {
|
||||
// sun.net.useExclusiveBind is true
|
||||
exclusiveBind = exclBindProp.length() == 0 ? true
|
||||
exclusiveBindLocal = exclBindProp.length() == 0 ? true
|
||||
: Boolean.parseBoolean(exclBindProp);
|
||||
} else if (version < 6.0) {
|
||||
exclusiveBind = false;
|
||||
exclusiveBindLocal = false;
|
||||
}
|
||||
|
||||
// impl.prefix
|
||||
@ -103,12 +106,16 @@ class DefaultDatagramSocketImplFactory
|
||||
prefix = AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("impl.prefix", null));
|
||||
if (prefix != null)
|
||||
prefixImplClass = Class.forName("java.net."+prefix+"DatagramSocketImpl");
|
||||
prefixImplClassLocal = Class.forName("java.net."+prefix+"DatagramSocketImpl");
|
||||
} catch (Exception e) {
|
||||
System.err.println("Can't find class: java.net." +
|
||||
prefix +
|
||||
"DatagramSocketImpl: check impl.prefix property");
|
||||
}
|
||||
|
||||
prefixImplClass = prefixImplClassLocal;
|
||||
useDualStackImpl = useDualStackImplLocal;
|
||||
exclusiveBind = exclusiveBindLocal;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,12 +133,10 @@ class DefaultDatagramSocketImplFactory
|
||||
throw new SocketException("can't instantiate DatagramSocketImpl");
|
||||
}
|
||||
} else {
|
||||
if (isMulticast)
|
||||
exclusiveBind = false;
|
||||
if (useDualStackImpl && !isMulticast)
|
||||
return new DualStackPlainDatagramSocketImpl(exclusiveBind);
|
||||
else
|
||||
return new TwoStacksPlainDatagramSocketImpl(exclusiveBind);
|
||||
return new TwoStacksPlainDatagramSocketImpl(exclusiveBind && !isMulticast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -292,4 +292,6 @@ class DualStackPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
||||
int optionValue) throws SocketException;
|
||||
|
||||
private static native int socketGetIntOption(int fd, int cmd) throws SocketException;
|
||||
|
||||
native int dataAvailable();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -207,6 +207,8 @@ class TwoStacksPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
||||
|
||||
protected native void disconnect0(int family);
|
||||
|
||||
native int dataAvailable();
|
||||
|
||||
/**
|
||||
* Perform class load-time initializations.
|
||||
*/
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_AbstractPlainDatagramSocketImpl.h"
|
||||
|
||||
static jfieldID IO_fd_fdID = NULL;
|
||||
static jfieldID apdsi_fdID = NULL;
|
||||
|
||||
static jfieldID apdsi_fd1ID = NULL;
|
||||
static jclass two_stacks_clazz = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: init
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
||||
|
||||
apdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(apdsi_fdID);
|
||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
||||
CHECK_NULL(IO_fd_fdID);
|
||||
|
||||
two_stacks_clazz = (*env)->FindClass(env, "java/net/TwoStacksPlainDatagramSocketImpl");
|
||||
CHECK_NULL(two_stacks_clazz);
|
||||
|
||||
/* Handle both TwoStacks and DualStack here */
|
||||
|
||||
if (JNU_Equals(env, cls, two_stacks_clazz)) {
|
||||
/* fd1 present only in TwoStack.. */
|
||||
apdsi_fd1ID = (*env)->GetFieldID(env, cls, "fd1",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(apdsi_fd1ID);
|
||||
}
|
||||
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
SOCKET fd;
|
||||
SOCKET fd1;
|
||||
int rv = -1, rv1 = -1;
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID);
|
||||
|
||||
if (!IS_NULL(fdObj)) {
|
||||
int retval = 0;
|
||||
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IS_NULL(apdsi_fd1ID)) {
|
||||
/* TwoStacks */
|
||||
jobject fd1Obj = (*env)->GetObjectField(env, this, apdsi_fd1ID);
|
||||
if (!IS_NULL(fd1Obj)) {
|
||||
int retval = 0;
|
||||
fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
||||
rv1 = ioctlsocket(fd1, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0 && rv1 < 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -70,6 +70,9 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
||||
return got_icmp;
|
||||
}
|
||||
|
||||
static jfieldID IO_fd_fdID = NULL;
|
||||
static jfieldID pdsi_fdID = NULL;
|
||||
|
||||
/*
|
||||
* Class: java_net_DualStackPlainDatagramSocketImpl
|
||||
* Method: initIDs
|
||||
@ -78,6 +81,13 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
||||
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_initIDs
|
||||
(JNIEnv *env, jclass clazz)
|
||||
{
|
||||
pdsi_fdID = (*env)->GetFieldID(env, clazz, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(pdsi_fdID);
|
||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
||||
CHECK_NULL(IO_fd_fdID);
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
|
||||
initInetAddressIDs(env);
|
||||
}
|
||||
|
||||
@ -503,3 +513,32 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketGetI
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_DualStackPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
SOCKET fd;
|
||||
int rv = -1;
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
|
||||
if (!IS_NULL(fdObj)) {
|
||||
int retval = 0;
|
||||
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -45,9 +45,10 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_initIDs
|
||||
jclass cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
|
||||
CHECK_NULL(cls);
|
||||
isa_class = (*env)->NewGlobalRef(env, cls);
|
||||
CHECK_NULL(isa_class);
|
||||
isa_ctorID = (*env)->GetMethodID(env, cls, "<init>",
|
||||
"(Ljava/net/InetAddress;I)V");
|
||||
|
||||
CHECK_NULL(isa_ctorID);
|
||||
initInetAddressIDs(env);
|
||||
|
||||
// implement read timeout with select.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -2563,3 +2563,44 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_leave(JNIEnv *env, jobject this,
|
||||
{
|
||||
mcast_join_leave (env, this, iaObj, niObj, JNI_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_TwoStacksPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_TwoStacksPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
SOCKET fd;
|
||||
SOCKET fd1;
|
||||
int rv = -1, rv1 = -1;
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
jobject fd1Obj;
|
||||
|
||||
if (!IS_NULL(fdObj)) {
|
||||
int retval = 0;
|
||||
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
||||
if (!IS_NULL(fd1Obj)) {
|
||||
int retval = 0;
|
||||
fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
||||
rv1 = ioctlsocket(fd1, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0 && rv1 < 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ MimeTypeParameterList(rawdata.substring(semIndex));
|
||||
* Set the value to be associated with the given name, replacing
|
||||
* any previous association.
|
||||
*
|
||||
* @throw IllegalArgumentException if parameter or value is illegal
|
||||
* @throws IllegalArgumentException if parameter or value is illegal
|
||||
*/
|
||||
public void setParameter(String name, String value) {
|
||||
parameters.set(name, value);
|
||||
@ -233,7 +233,7 @@ MimeTypeParameterList(rawdata.substring(semIndex));
|
||||
/**
|
||||
* Remove any value associated with the given name.
|
||||
*
|
||||
* @throw IllegalArgumentException if parameter may not be deleted
|
||||
* @throws IllegalArgumentException if parameter may not be deleted
|
||||
*/
|
||||
public void removeParameter(String name) {
|
||||
parameters.remove(name);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -58,6 +58,7 @@ class AquaComboBoxButton extends JButton {
|
||||
this.list = list;
|
||||
|
||||
setModel(new DefaultButtonModel() {
|
||||
@Override
|
||||
public void setArmed(final boolean armed) {
|
||||
super.setArmed(isPressed() ? true : armed);
|
||||
}
|
||||
@ -66,12 +67,13 @@ class AquaComboBoxButton extends JButton {
|
||||
setEnabled(comboBox.isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return comboBox == null ? true : comboBox.isEnabled();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isFocusTraversable() {
|
||||
@Override
|
||||
public boolean isFocusable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -92,6 +94,7 @@ class AquaComboBoxButton extends JButton {
|
||||
return State.ACTIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(final Graphics g) {
|
||||
// Don't Paint the button as usual
|
||||
// super.paintComponent( g );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -303,7 +303,7 @@ public class AquaInternalFrameDockIconUI extends DesktopIconUI implements MouseL
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void hide() {
|
||||
final Container parent = getParent();
|
||||
final Rectangle r = this.getBounds();
|
||||
|
||||
@ -991,9 +991,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
"Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[]{"ESCAPE", "cancel"}),};
|
||||
|
||||
table.putDefaults(defaults);
|
||||
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(true, table);
|
||||
}
|
||||
|
||||
protected void initSystemColorDefaults(final UIDefaults table) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -125,9 +125,8 @@ public abstract class OSXSurfaceData extends BufImgSurfaceData {
|
||||
return fConfig;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void setBounds(int x, int y, int w, int h) {
|
||||
fBounds.reshape(x, y, w, y + h);
|
||||
fBounds.setBounds(x, y, w, y + h);
|
||||
}
|
||||
|
||||
// START compositing support API
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -77,7 +77,7 @@ public class CGLLayer extends CFRetainedResource {
|
||||
}
|
||||
|
||||
public Object getDestination() {
|
||||
return peer;
|
||||
return peer.getTarget();
|
||||
}
|
||||
|
||||
public SurfaceData replaceSurfaceData() {
|
||||
|
||||
@ -576,6 +576,14 @@ public class LWWindowPeer
|
||||
: getDefaultMaximizedBounds());
|
||||
}
|
||||
|
||||
public Rectangle getMaximizedBounds() {
|
||||
synchronized (getStateLock()) {
|
||||
return (maximizedBounds == null)
|
||||
? getDefaultMaximizedBounds()
|
||||
: maximizedBounds;
|
||||
}
|
||||
}
|
||||
|
||||
private void setPlatformMaximizedBounds(Rectangle bounds) {
|
||||
platformWindow.setMaximizedBounds(
|
||||
bounds.x, bounds.y,
|
||||
|
||||
@ -498,14 +498,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
// to be sure that there are no setBounds requests in the queue.
|
||||
LWCToolkit.flushNativeSelectors();
|
||||
this.normalBounds = peer.getBounds();
|
||||
|
||||
GraphicsConfiguration config = getPeer().getGraphicsConfiguration();
|
||||
Insets i = ((CGraphicsDevice)config.getDevice()).getScreenInsets();
|
||||
Rectangle toBounds = config.getBounds();
|
||||
setBounds(toBounds.x + i.left,
|
||||
toBounds.y + i.top,
|
||||
toBounds.width - i.left - i.right,
|
||||
toBounds.height - i.top - i.bottom);
|
||||
Rectangle maximizedBounds = peer.getMaximizedBounds();
|
||||
setBounds(maximizedBounds.x, maximizedBounds.y,
|
||||
maximizedBounds.width, maximizedBounds.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@
|
||||
package com.sun.java.swing.plaf.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.beans.*;
|
||||
import java.io.File;
|
||||
import java.lang.ref.*;
|
||||
@ -41,6 +40,8 @@ import javax.swing.text.DefaultEditorKit;
|
||||
|
||||
import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType;
|
||||
import com.sun.java.swing.plaf.gtk.GTKConstants.StateType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.UNIXToolkit;
|
||||
import sun.awt.OSInfo;
|
||||
@ -61,7 +62,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
||||
* We should assume ON - or some variation of ON as no GTK desktop
|
||||
* ships with it OFF.
|
||||
*/
|
||||
static Object aaTextInfo;
|
||||
static Map<Object, Object> aaTextInfo;
|
||||
|
||||
/**
|
||||
* Solaris, or Linux with Sun JDS in a CJK Locale.
|
||||
@ -1337,7 +1338,9 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
||||
if (fallbackFont != null) {
|
||||
table.put("TitledBorder.font", fallbackFont);
|
||||
}
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
if (aaTextInfo != null) {
|
||||
table.putAll(aaTextInfo);
|
||||
}
|
||||
}
|
||||
|
||||
protected void initSystemColorDefaults(UIDefaults table) {
|
||||
@ -1477,7 +1480,8 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
||||
* XRender.
|
||||
*/
|
||||
gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
|
||||
aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(gtkAAFontSettingsCond);
|
||||
aaTextInfo = new HashMap<>(2);
|
||||
SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
|
||||
}
|
||||
|
||||
static ReferenceQueue<GTKLookAndFeel> queue = new ReferenceQueue<GTKLookAndFeel>();
|
||||
|
||||
@ -39,6 +39,8 @@ import sun.swing.SwingUtilities2;
|
||||
import sun.swing.plaf.synth.SynthIcon;
|
||||
|
||||
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -115,10 +117,12 @@ class GTKStyle extends SynthStyle implements GTKConstants {
|
||||
@Override
|
||||
public void installDefaults(SynthContext context) {
|
||||
super.installDefaults(context);
|
||||
if (!context.getRegion().isSubregion()) {
|
||||
context.getComponent().putClientProperty(
|
||||
SwingUtilities2.AA_TEXT_PROPERTY_KEY,
|
||||
GTKLookAndFeel.aaTextInfo);
|
||||
Map<Object, Object> aaTextInfo = GTKLookAndFeel.aaTextInfo;
|
||||
if (aaTextInfo != null && !context.getRegion().isSubregion()) {
|
||||
context.getComponent().putClientProperty(KEY_TEXT_ANTIALIASING,
|
||||
aaTextInfo.get(KEY_TEXT_ANTIALIASING));
|
||||
context.getComponent().putClientProperty(KEY_TEXT_LCD_CONTRAST,
|
||||
aaTextInfo.get(KEY_TEXT_LCD_CONTRAST));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -556,8 +556,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
* for both client property and UIDefaults.
|
||||
* Also need to set up listeners for changes in these settings.
|
||||
*/
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(true, table);
|
||||
this.aaSettings =
|
||||
new FontDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
|
||||
}
|
||||
@ -835,12 +834,12 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
"InternalFrame.closeIcon",
|
||||
WindowsIconFactory.createFrameCloseIcon(),
|
||||
"InternalFrame.icon",
|
||||
(LazyValue) t -> new Object[]{
|
||||
(LazyValue) t -> new WindowsInternalFrameTitlePane.ScalableIconUIResource(new Object[]{
|
||||
// The constructor takes one arg: an array of UIDefaults.LazyValue
|
||||
// representing the icons
|
||||
SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"),
|
||||
SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png")
|
||||
},
|
||||
}),
|
||||
// Internal Frame Auditory Cue Mappings
|
||||
"InternalFrame.closeSound", "win.sound.close",
|
||||
"InternalFrame.maximizeSound", "win.sound.maximize",
|
||||
@ -2402,9 +2401,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
}
|
||||
|
||||
protected void updateUI() {
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(true, defaults);
|
||||
super.updateUI();
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ abstract class MultipleGradientPaintContext implements PaintContext {
|
||||
*
|
||||
* @param position the unmanipulated position, which will be mapped
|
||||
* into the range 0 to 1
|
||||
* @returns integer color to display
|
||||
* @return integer color to display
|
||||
*/
|
||||
protected final int indexIntoGradientsArrays(float position) {
|
||||
// first, manipulate position value depending on the cycle method
|
||||
|
||||
@ -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
|
||||
@ -33,13 +33,10 @@ import java.awt.image.DirectColorModel;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.awt.peer.RobotPeer;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.AccessController;
|
||||
|
||||
import sun.awt.AWTPermissions;
|
||||
import sun.awt.ComponentFactory;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.OSInfo;
|
||||
import sun.awt.image.SunWritableRaster;
|
||||
|
||||
/**
|
||||
@ -558,28 +555,8 @@ public class Robot {
|
||||
*/
|
||||
public synchronized void waitForIdle() {
|
||||
checkNotDispatchThread();
|
||||
|
||||
try {
|
||||
SunToolkit.flushPendingEvents();
|
||||
// 7185258: realSync() call blocks all DnD tests on OS X
|
||||
if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) {
|
||||
// post a dummy event to the queue so we know when
|
||||
// all the events before it have been processed
|
||||
EventQueue.invokeAndWait( new Runnable() {
|
||||
public void run() {
|
||||
// dummy implementation
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
||||
}
|
||||
} catch(InterruptedException ite) {
|
||||
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
|
||||
ite.printStackTrace();
|
||||
} catch(InvocationTargetException ine) {
|
||||
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
|
||||
ine.printStackTrace();
|
||||
}
|
||||
SunToolkit.flushPendingEvents();
|
||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
||||
}
|
||||
|
||||
private void checkNotDispatchThread() {
|
||||
@ -593,6 +570,7 @@ public class Robot {
|
||||
*
|
||||
* @return the string representation.
|
||||
*/
|
||||
@Override
|
||||
public synchronized String toString() {
|
||||
String params = "autoDelay = "+getAutoDelay()+", "+"autoWaitForIdle = "+isAutoWaitForIdle();
|
||||
return getClass().getName() + "[ " + params + " ]";
|
||||
|
||||
@ -448,7 +448,7 @@ public abstract class Toolkit {
|
||||
*
|
||||
* @param s the error message
|
||||
* @param e the original exception
|
||||
* @throw the new AWTError including the cause (the original exception)
|
||||
* @throws the new AWTError including the cause (the original exception)
|
||||
*/
|
||||
private static void newAWTError(Throwable e, String s) {
|
||||
AWTError newAWTError = new AWTError(s);
|
||||
|
||||
@ -133,13 +133,42 @@ public class JColorChooser extends JComponent implements Accessible {
|
||||
* returns true.
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Color showDialog(Component component,
|
||||
String title, Color initialColor) throws HeadlessException {
|
||||
String title, Color initialColor) throws HeadlessException {
|
||||
return showDialog(component, title, initialColor, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a modal color-chooser dialog and blocks until the
|
||||
* dialog is hidden. If the user presses the "OK" button, then
|
||||
* this method hides/disposes the dialog and returns the selected color.
|
||||
* If the user presses the "Cancel" button or closes the dialog without
|
||||
* pressing "OK", then this method hides/disposes the dialog and returns
|
||||
* <code>null</code>.
|
||||
*
|
||||
* @param component the parent <code>Component</code> for the dialog
|
||||
* @param title the String containing the dialog's title
|
||||
* @param initialColor the initial Color set when the color-chooser is shown
|
||||
* @param colorTransparencySelectionEnabled true if the transparency of
|
||||
* a color can be selected
|
||||
* @return the selected color or <code>null</code> if the user opted out
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true.
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Color showDialog(Component component, String title,
|
||||
Color initialColor, boolean colorTransparencySelectionEnabled)
|
||||
throws HeadlessException {
|
||||
|
||||
final JColorChooser pane = new JColorChooser(initialColor != null?
|
||||
initialColor : Color.white);
|
||||
|
||||
for (AbstractColorChooserPanel ccPanel : pane.getChooserPanels()) {
|
||||
ccPanel.setColorTransparencySelectionEnabled(
|
||||
colorTransparencySelectionEnabled);
|
||||
}
|
||||
|
||||
ColorTracker ok = new ColorTracker(pane);
|
||||
JDialog dialog = createDialog(component, title, true, pane, ok, null);
|
||||
|
||||
@ -150,7 +179,6 @@ public class JColorChooser extends JComponent implements Accessible {
|
||||
return ok.getColor();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates and returns a new dialog containing the specified
|
||||
* <code>ColorChooser</code> pane along with "OK", "Cancel", and "Reset"
|
||||
|
||||
@ -377,7 +377,8 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
/**
|
||||
* AA text hints.
|
||||
*/
|
||||
transient private Object aaTextInfo;
|
||||
transient private Object aaHint;
|
||||
transient private Object lcdRenderingHint;
|
||||
|
||||
static Graphics safelyGetGraphics(Component c) {
|
||||
return safelyGetGraphics(c, SwingUtilities.getRoot(c));
|
||||
@ -616,6 +617,15 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
*/
|
||||
public void updateUI() {}
|
||||
|
||||
/**
|
||||
* Returns the look and feel delegate that renders this component.
|
||||
*
|
||||
* @return the {@code ComponentUI} object that renders this component
|
||||
* @since 1.9
|
||||
*/
|
||||
public ComponentUI getUI() {
|
||||
return ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the look and feel delegate for this component.
|
||||
@ -655,8 +665,10 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
uninstallUIAndProperties();
|
||||
|
||||
// aaText shouldn't persist between look and feels, reset it.
|
||||
aaTextInfo =
|
||||
UIManager.getDefaults().get(SwingUtilities2.AA_TEXT_PROPERTY_KEY);
|
||||
aaHint = UIManager.getDefaults().get(
|
||||
RenderingHints.KEY_TEXT_ANTIALIASING);
|
||||
lcdRenderingHint = UIManager.getDefaults().get(
|
||||
RenderingHints.KEY_TEXT_LCD_CONTRAST);
|
||||
ComponentUI oldUI = ui;
|
||||
ui = newUI;
|
||||
if (ui != null) {
|
||||
@ -4048,8 +4060,10 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
* @see #putClientProperty
|
||||
*/
|
||||
public final Object getClientProperty(Object key) {
|
||||
if (key == SwingUtilities2.AA_TEXT_PROPERTY_KEY) {
|
||||
return aaTextInfo;
|
||||
if (key == RenderingHints.KEY_TEXT_ANTIALIASING) {
|
||||
return aaHint;
|
||||
} else if (key == RenderingHints.KEY_TEXT_LCD_CONTRAST) {
|
||||
return lcdRenderingHint;
|
||||
} else if (key == SwingUtilities2.COMPONENT_UI_PROPERTY_KEY) {
|
||||
return ui;
|
||||
}
|
||||
@ -4091,8 +4105,11 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
* @see #addPropertyChangeListener
|
||||
*/
|
||||
public final void putClientProperty(Object key, Object value) {
|
||||
if (key == SwingUtilities2.AA_TEXT_PROPERTY_KEY) {
|
||||
aaTextInfo = value;
|
||||
if (key == RenderingHints.KEY_TEXT_ANTIALIASING) {
|
||||
aaHint = value;
|
||||
return;
|
||||
} else if (key == RenderingHints.KEY_TEXT_LCD_CONTRAST) {
|
||||
lcdRenderingHint = value;
|
||||
return;
|
||||
}
|
||||
if (value == null && clientProperties == null) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -2304,8 +2304,10 @@ public class JTabbedPane extends JComponent
|
||||
}
|
||||
|
||||
public Rectangle getBounds() {
|
||||
return parent.getUI().getTabBounds(parent,
|
||||
parent.indexOfTab(title));
|
||||
int i = parent.indexOfTab(title);
|
||||
// Check for no title. Even though that's a bug in the app we should
|
||||
// inhibit an ArrayIndexOutOfBoundsException from getTabBounds.
|
||||
return (i == -1) ? null : parent.getUI().getTabBounds(parent, i);
|
||||
}
|
||||
|
||||
public void setBounds(Rectangle r) {
|
||||
|
||||
@ -50,6 +50,14 @@ import javax.swing.*;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public abstract class AbstractColorChooserPanel extends JPanel {
|
||||
|
||||
|
||||
/**
|
||||
* Identifies that the transparency of the color (alpha value) can be
|
||||
* selected
|
||||
*/
|
||||
public static final String TRANSPARENCY_ENABLED_PROPERTY
|
||||
= "TransparencyEnabled";
|
||||
|
||||
private final PropertyChangeListener enabledListener = new PropertyChangeListener() {
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
Object value = event.getNewValue();
|
||||
@ -201,6 +209,40 @@ public abstract class AbstractColorChooserPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether color chooser panel allows to select the transparency
|
||||
* (alpha value) of a color.
|
||||
* This method fires a property-changed event, using the string value of
|
||||
* {@code TRANSPARENCY_ENABLED_PROPERTY} as the name
|
||||
* of the property.
|
||||
*
|
||||
* <p>The value is a hint and may not be applicable to all types of chooser
|
||||
* panel.
|
||||
*
|
||||
* <p>The default value is {@code true}.
|
||||
*
|
||||
* @param b true if the transparency of a color can be selected
|
||||
*
|
||||
* @beaninfo
|
||||
* bound: true
|
||||
* description: Sets the transparency of a color selection on or off.
|
||||
*
|
||||
* @see #isColorTransparencySelectionEnabled()
|
||||
*/
|
||||
public void setColorTransparencySelectionEnabled(boolean b){
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether color chooser panel allows to select the transparency
|
||||
* (alpha value) of a color.
|
||||
*
|
||||
* @return true if the transparency of a color can be selected
|
||||
* @see #setColorTransparencySelectionEnabled(boolean)
|
||||
*/
|
||||
public boolean isColorTransparencySelectionEnabled(){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the panel.
|
||||
* @param g the <code>Graphics</code> object
|
||||
|
||||
@ -176,6 +176,21 @@ final class ColorChooserPanel extends AbstractColorChooserPanel implements Prope
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorTransparencySelectionEnabled(boolean b){
|
||||
boolean oldValue = isColorTransparencySelectionEnabled();
|
||||
if (b != oldValue) {
|
||||
panel.setColorTransparencySelectionEnabled(b);
|
||||
firePropertyChange(TRANSPARENCY_ENABLED_PROPERTY,
|
||||
oldValue, b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isColorTransparencySelectionEnabled(){
|
||||
return panel.isColorTransparencySelectionEnabled();
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
ColorSelectionModel model = getColorSelectionModel();
|
||||
if (model != null) {
|
||||
|
||||
@ -145,7 +145,7 @@ final class ColorPanel extends JPanel implements ActionListener {
|
||||
}
|
||||
|
||||
void colorChanged() {
|
||||
this.color = new Color(getColor(0), true);
|
||||
this.color = new Color(getColor(0), isColorTransparencySelectionEnabled());
|
||||
Object parent = getParent();
|
||||
if (parent instanceof ColorChooserPanel) {
|
||||
ColorChooserPanel chooser = (ColorChooserPanel) parent;
|
||||
@ -208,6 +208,17 @@ final class ColorPanel extends JPanel implements ActionListener {
|
||||
return this.model.getColor(this.values);
|
||||
}
|
||||
|
||||
void setColorTransparencySelectionEnabled(boolean b) {
|
||||
if (spinners[model.getCount() - 1].isVisible() != b) {
|
||||
spinners[model.getCount() - 1].setVisible(b);
|
||||
colorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
boolean isColorTransparencySelectionEnabled() {
|
||||
return spinners[model.getCount() - 1].isVisible();
|
||||
}
|
||||
|
||||
private void setValue(int index) {
|
||||
this.values[index] = this.spinners[index].getValue();
|
||||
}
|
||||
|
||||
@ -95,6 +95,10 @@ final class SlidingSpinner implements ChangeListener {
|
||||
this.spinner.setVisible(visible);
|
||||
}
|
||||
|
||||
boolean isVisible() {
|
||||
return this.slider.isVisible();
|
||||
}
|
||||
|
||||
public void stateChanged(ChangeEvent event) {
|
||||
if (!this.internal) {
|
||||
if (this.spinner == event.getSource()) {
|
||||
|
||||
@ -90,7 +90,7 @@ public class LayerUI<V extends Component>
|
||||
* and set the layer event mask to {@code 0}
|
||||
* in {@link #uninstallUI(javax.swing.JComponent)} after that.
|
||||
* By default this method calls the appropriate
|
||||
* {@code process<event type>Event}
|
||||
* {@code process<event} {@code type>Event}
|
||||
* method for the given class of event.
|
||||
* <p>
|
||||
* <b>Note:</b> Events are processed only for displayable {@code JLayer}s.
|
||||
|
||||
@ -35,11 +35,11 @@ import javax.swing.event.InternalFrameEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST;
|
||||
|
||||
import sun.swing.DefaultLookup;
|
||||
|
||||
import static sun.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY;
|
||||
|
||||
/**
|
||||
* The class that manages a basic title bar
|
||||
* <p>
|
||||
@ -217,8 +217,10 @@ public class BasicInternalFrameTitlePane extends JComponent
|
||||
}
|
||||
|
||||
private void updateProperties() {
|
||||
final Object aaTextInfo = frame.getClientProperty(AA_TEXT_PROPERTY_KEY);
|
||||
putClientProperty(AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
putClientProperty(KEY_TEXT_ANTIALIASING,
|
||||
frame.getClientProperty(KEY_TEXT_ANTIALIASING));
|
||||
putClientProperty(KEY_TEXT_LCD_CONTRAST,
|
||||
frame.getClientProperty(KEY_TEXT_LCD_CONTRAST));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
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