This commit is contained in:
Lana Steuck 2013-11-08 17:16:59 -08:00
commit 3dd473424f
1572 changed files with 38935 additions and 9572 deletions

View file

@ -235,3 +235,5 @@ b5d2bf482a3ea1cca08c994512804ffbc73de0a1 jdk8-b110
b9a0f6c693f347a6f4b9bb994957f4eaa05bdedd jdk8-b111 b9a0f6c693f347a6f4b9bb994957f4eaa05bdedd jdk8-b111
ad67c34f79c28a8e755f4a49f313868619d6702c jdk8-b112 ad67c34f79c28a8e755f4a49f313868619d6702c jdk8-b112
4a4dbcf7cb7d3e1a81beaa3b11cd909f69ebc79a jdk8-b113 4a4dbcf7cb7d3e1a81beaa3b11cd909f69ebc79a jdk8-b113
dfa34ab293faad9b543a24646dbb381bc3ab5586 jdk8-b114
3dd9732b17034f45d111996d1d50287b05a3998c jdk8-b115

View file

@ -235,3 +235,5 @@ b7e64be81c8a7690703df5711f4fc2375da8a9cb jdk8-b103
d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111 d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111
547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112 547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112
6ba4c7cb623ec612031e05cf8bf279d8f407bd1e jdk8-b113 6ba4c7cb623ec612031e05cf8bf279d8f407bd1e jdk8-b113
4f2011496393a26dcfd7b1f7787a3673ddd32599 jdk8-b114
763ada2a1d8c5962bc8c3d297e57c562d2e95338 jdk8-b115

View file

@ -514,7 +514,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
if test "x$IS_GNU_MAKE" = x; then if test "x$IS_GNU_MAKE" = x; then
AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.]) AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
else else
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[[12]]\)\|\(4\.\)'` IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[[12]]' -e '4\.'`
if test "x$IS_MODERN_MAKE" = x; then if test "x$IS_MODERN_MAKE" = x; then
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.]) AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
else else

View file

@ -3865,7 +3865,7 @@ fi
#CUSTOM_AUTOCONF_INCLUDE #CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks: # Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1382702260 DATE_WHEN_GENERATED=1383151988
############################################################################### ###############################################################################
# #
@ -8323,7 +8323,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else else
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
if test "x$IS_MODERN_MAKE" = x; then if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@ -8680,7 +8680,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else else
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
if test "x$IS_MODERN_MAKE" = x; then if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@ -9034,7 +9034,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else else
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
if test "x$IS_MODERN_MAKE" = x; then if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@ -9393,7 +9393,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else else
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
if test "x$IS_MODERN_MAKE" = x; then if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@ -9746,7 +9746,7 @@ $as_echo "$as_me: Testing potential make at $MAKE_CANDIDATE, found using $DESCRI
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;} $as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else else
IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'` IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP -e '3\.8[12]' -e '4\.'`
if test "x$IS_MODERN_MAKE" = x; then if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;} $as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}

View file

@ -235,3 +235,5 @@ a4bb3b4500164748a9c33b2283cfda76d89f25ab jdk8-b108
85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111 85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111
43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112 43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112
a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113 a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113
0bbccf77c23e566170b88b52c2cf28e5d31ce927 jdk8-b114
8d07115924b7d703a5048adb24e8aba751442f13 jdk8-b115

View file

@ -389,3 +389,7 @@ f6962730bbde82f279a0ae3a1c14bc5e58096c6e jdk8-b111
23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55 23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55
4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113 4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113
82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56 82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56
7fd913010dbbf75260688fd2fa8964763fa49a09 jdk8-b114
3b32d287da89a47a45d16f6d9ba5bd3cd9bf4b3e hs25-b57
9ebaac78a8a0061fb9597e07f806498cb626cdeb jdk8-b115
e510dfdec6dd701410f3398ed86ebcdff0cca63a hs25-b58

View file

@ -131,7 +131,7 @@ static bool process_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void
static bool ptrace_continue(pid_t pid, int signal) { static bool ptrace_continue(pid_t pid, int signal) {
// pass the signal to the process so we don't swallow it // pass the signal to the process so we don't swallow it
if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) { if (ptrace(PT_CONTINUE, pid, NULL, signal) < 0) {
print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid); print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
return false; return false;
} }
@ -434,7 +434,6 @@ static ps_prochandle_ops process_ops = {
// attach to the process. One and only one exposed stuff // attach to the process. One and only one exposed stuff
struct ps_prochandle* Pgrab(pid_t pid) { struct ps_prochandle* Pgrab(pid_t pid) {
struct ps_prochandle* ph = NULL; struct ps_prochandle* ph = NULL;
thread_info* thr = NULL;
if ( (ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle))) == NULL) { if ( (ph = (struct ps_prochandle*) calloc(1, sizeof(struct ps_prochandle))) == NULL) {
print_debug("can't allocate memory for ps_prochandle\n"); print_debug("can't allocate memory for ps_prochandle\n");

View file

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25 HS_MAJOR_VER=25
HS_MINOR_VER=0 HS_MINOR_VER=0
HS_BUILD_NUMBER=56 HS_BUILD_NUMBER=58
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=8

View file

@ -365,7 +365,7 @@ address CppInterpreterGenerator::generate_stack_to_native_abi_converter(BasicTyp
return entry; return entry;
} }
address CppInterpreter::return_entry(TosState state, int length) { address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
// make it look good in the debugger // make it look good in the debugger
return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation) + frame::pc_return_offset; return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation) + frame::pc_return_offset;
} }

View file

@ -3526,8 +3526,12 @@ void MacroAssembler::bang_stack_size(Register Rsize, Register Rtsp,
delayed()->sub(Rtsp, Roffset, Rtsp); delayed()->sub(Rtsp, Roffset, Rtsp);
// Bang down shadow pages too. // Bang down shadow pages too.
// The -1 because we already subtracted 1 page. // At this point, (tmp-0) is the last address touched, so don't
for (int i = 0; i< StackShadowPages-1; i++) { // touch it again. (It was touched as (tmp-pagesize) but then tmp
// was post-decremented.) Skip this address by starting at i=1, and
// touch a few more pages below. N.B. It is important to touch all
// the way down to and including i=StackShadowPages.
for (int i = 1; i <= StackShadowPages; i++) {
set((-i*offset)+STACK_BIAS, Rscratch); set((-i*offset)+STACK_BIAS, Rscratch);
st(G0, Rtsp, Rscratch); st(G0, Rtsp, Rscratch);
} }
@ -4099,7 +4103,7 @@ void MacroAssembler::decode_heap_oop_not_null(Register src, Register dst) {
void MacroAssembler::encode_klass_not_null(Register r) { void MacroAssembler::encode_klass_not_null(Register r) {
assert (UseCompressedClassPointers, "must be compressed"); assert (UseCompressedClassPointers, "must be compressed");
assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); if (Universe::narrow_klass_base() != NULL) {
assert(r != G6_heapbase, "bad register choice"); assert(r != G6_heapbase, "bad register choice");
set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
sub(r, G6_heapbase, r); sub(r, G6_heapbase, r);
@ -4108,6 +4112,10 @@ void MacroAssembler::encode_klass_not_null(Register r) {
srlx(r, LogKlassAlignmentInBytes, r); srlx(r, LogKlassAlignmentInBytes, r);
} }
reinit_heapbase(); reinit_heapbase();
} else {
assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
srlx(r, Universe::narrow_klass_shift(), r);
}
} }
void MacroAssembler::encode_klass_not_null(Register src, Register dst) { void MacroAssembler::encode_klass_not_null(Register src, Register dst) {
@ -4115,12 +4123,17 @@ void MacroAssembler::encode_klass_not_null(Register src, Register dst) {
encode_klass_not_null(src); encode_klass_not_null(src);
} else { } else {
assert (UseCompressedClassPointers, "must be compressed"); assert (UseCompressedClassPointers, "must be compressed");
assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); if (Universe::narrow_klass_base() != NULL) {
set((intptr_t)Universe::narrow_klass_base(), dst); set((intptr_t)Universe::narrow_klass_base(), dst);
sub(src, dst, dst); sub(src, dst, dst);
if (Universe::narrow_klass_shift() != 0) { if (Universe::narrow_klass_shift() != 0) {
srlx(dst, LogKlassAlignmentInBytes, dst); srlx(dst, LogKlassAlignmentInBytes, dst);
} }
} else {
// shift src into dst
assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
srlx(src, Universe::narrow_klass_shift(), dst);
}
} }
} }
@ -4129,14 +4142,16 @@ void MacroAssembler::encode_klass_not_null(Register src, Register dst) {
// the instructions they generate change, then this method needs to be updated. // the instructions they generate change, then this method needs to be updated.
int MacroAssembler::instr_size_for_decode_klass_not_null() { int MacroAssembler::instr_size_for_decode_klass_not_null() {
assert (UseCompressedClassPointers, "only for compressed klass ptrs"); assert (UseCompressedClassPointers, "only for compressed klass ptrs");
int num_instrs = 1; // shift src,dst or add
if (Universe::narrow_klass_base() != NULL) {
// set + add + set // set + add + set
int num_instrs = insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) + 1 + num_instrs += insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) +
insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base()); insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base());
if (Universe::narrow_klass_shift() == 0) { if (Universe::narrow_klass_shift() != 0) {
return num_instrs * BytesPerInstWord; num_instrs += 1; // sllx
} else { // sllx
return (num_instrs + 1) * BytesPerInstWord;
} }
}
return num_instrs * BytesPerInstWord;
} }
// !!! If the instructions that get generated here change then function // !!! If the instructions that get generated here change then function
@ -4145,13 +4160,17 @@ void MacroAssembler::decode_klass_not_null(Register r) {
// Do not add assert code to this unless you change vtableStubs_sparc.cpp // Do not add assert code to this unless you change vtableStubs_sparc.cpp
// pd_code_size_limit. // pd_code_size_limit.
assert (UseCompressedClassPointers, "must be compressed"); assert (UseCompressedClassPointers, "must be compressed");
assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); if (Universe::narrow_klass_base() != NULL) {
assert(r != G6_heapbase, "bad register choice"); assert(r != G6_heapbase, "bad register choice");
set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
if (Universe::narrow_klass_shift() != 0) if (Universe::narrow_klass_shift() != 0)
sllx(r, LogKlassAlignmentInBytes, r); sllx(r, LogKlassAlignmentInBytes, r);
add(r, G6_heapbase, r); add(r, G6_heapbase, r);
reinit_heapbase(); reinit_heapbase();
} else {
assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
sllx(r, Universe::narrow_klass_shift(), r);
}
} }
void MacroAssembler::decode_klass_not_null(Register src, Register dst) { void MacroAssembler::decode_klass_not_null(Register src, Register dst) {
@ -4161,7 +4180,7 @@ void MacroAssembler::decode_klass_not_null(Register src, Register dst) {
// Do not add assert code to this unless you change vtableStubs_sparc.cpp // Do not add assert code to this unless you change vtableStubs_sparc.cpp
// pd_code_size_limit. // pd_code_size_limit.
assert (UseCompressedClassPointers, "must be compressed"); assert (UseCompressedClassPointers, "must be compressed");
assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); if (Universe::narrow_klass_base() != NULL) {
if (Universe::narrow_klass_shift() != 0) { if (Universe::narrow_klass_shift() != 0) {
assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice"); assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice");
set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
@ -4172,6 +4191,11 @@ void MacroAssembler::decode_klass_not_null(Register src, Register dst) {
set((intptr_t)Universe::narrow_klass_base(), dst); set((intptr_t)Universe::narrow_klass_base(), dst);
add(src, dst, dst); add(src, dst, dst);
} }
} else {
// shift/mov src into dst.
assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
sllx(src, Universe::narrow_klass_shift(), dst);
}
} }
} }

View file

@ -1660,12 +1660,16 @@ void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
if (UseCompressedClassPointers) { if (UseCompressedClassPointers) {
assert(Universe::heap() != NULL, "java heap should be initialized"); assert(Universe::heap() != NULL, "java heap should be initialized");
st->print_cr("\tLDUW [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass"); st->print_cr("\tLDUW [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass");
if (Universe::narrow_klass_base() != 0) {
st->print_cr("\tSET Universe::narrow_klass_base,R_G6_heap_base"); st->print_cr("\tSET Universe::narrow_klass_base,R_G6_heap_base");
if (Universe::narrow_klass_shift() != 0) { if (Universe::narrow_klass_shift() != 0) {
st->print_cr("\tSLL R_G5,3,R_G5"); st->print_cr("\tSLL R_G5,Universe::narrow_klass_shift,R_G5");
} }
st->print_cr("\tADD R_G5,R_G6_heap_base,R_G5"); st->print_cr("\tADD R_G5,R_G6_heap_base,R_G5");
st->print_cr("\tSET Universe::narrow_ptrs_base,R_G6_heap_base"); st->print_cr("\tSET Universe::narrow_ptrs_base,R_G6_heap_base");
} else {
st->print_cr("\tSLL R_G5,Universe::narrow_klass_shift,R_G5");
}
} else { } else {
st->print_cr("\tLDX [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check"); st->print_cr("\tLDX [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check");
} }
@ -2912,6 +2916,9 @@ enc_class Fast_Unlock(iRegP oop, iRegP box, o7RegP scratch, iRegP scratch2) %{
__ bind(LSkip2); __ bind(LSkip2);
} }
// We have no guarantee that on 64 bit the higher half of limit_reg is 0
__ signx(limit_reg);
__ subcc(limit_reg, 1 * sizeof(jchar), chr1_reg); __ subcc(limit_reg, 1 * sizeof(jchar), chr1_reg);
__ br(Assembler::equal, true, Assembler::pn, Ldone); __ br(Assembler::equal, true, Assembler::pn, Ldone);
__ delayed()->mov(O7, result_reg); // result is difference in lengths __ delayed()->mov(O7, result_reg); // result is difference in lengths
@ -2969,6 +2976,9 @@ enc_class enc_String_Equals(o0RegP str1, o1RegP str2, g3RegI cnt, notemp_iRegI r
Register chr1_reg = result_reg; Register chr1_reg = result_reg;
Register chr2_reg = tmp1_reg; Register chr2_reg = tmp1_reg;
// We have no guarantee that on 64 bit the higher half of limit_reg is 0
__ signx(limit_reg);
//check for alignment and position the pointers to the ends //check for alignment and position the pointers to the ends
__ or3(str1_reg, str2_reg, chr1_reg); __ or3(str1_reg, str2_reg, chr1_reg);
__ andcc(chr1_reg, 0x3, chr1_reg); __ andcc(chr1_reg, 0x3, chr1_reg);

View file

@ -153,13 +153,9 @@ address TemplateInterpreterGenerator::generate_StackOverflowError_handler() {
} }
address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
TosState incoming_state = state;
Label cont;
address compiled_entry = __ pc();
address entry = __ pc(); address entry = __ pc();
#if !defined(_LP64) && defined(COMPILER2) #if !defined(_LP64) && defined(COMPILER2)
// All return values are where we want them, except for Longs. C2 returns // All return values are where we want them, except for Longs. C2 returns
// longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1. // longs in G1 in the 32-bit build whereas the interpreter wants them in O0/O1.
@ -170,14 +166,12 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
// do this here. Unfortunately if we did a rethrow we'd see an machepilog node // do this here. Unfortunately if we did a rethrow we'd see an machepilog node
// first which would move g1 -> O0/O1 and destroy the exception we were throwing. // first which would move g1 -> O0/O1 and destroy the exception we were throwing.
if (incoming_state == ltos) { if (state == ltos) {
__ srl (G1, 0, O1); __ srl (G1, 0, O1);
__ srlx(G1, 32, O0); __ srlx(G1, 32, O0);
} }
#endif // !_LP64 && COMPILER2 #endif // !_LP64 && COMPILER2
__ bind(cont);
// The callee returns with the stack possibly adjusted by adapter transition // The callee returns with the stack possibly adjusted by adapter transition
// We remove that possible adjustment here. // We remove that possible adjustment here.
// All interpreter local registers are untouched. Any result is passed back // All interpreter local registers are untouched. Any result is passed back
@ -186,28 +180,17 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
__ mov(Llast_SP, SP); // Remove any adapter added stack space. __ mov(Llast_SP, SP); // Remove any adapter added stack space.
Label L_got_cache, L_giant_index;
const Register cache = G3_scratch; const Register cache = G3_scratch;
const Register size = G1_scratch; const Register index = G1_scratch;
if (EnableInvokeDynamic) { __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
__ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode.
__ cmp_and_br_short(G1_scratch, Bytecodes::_invokedynamic, Assembler::equal, Assembler::pn, L_giant_index);
}
__ get_cache_and_index_at_bcp(cache, G1_scratch, 1);
__ bind(L_got_cache);
__ ld_ptr(cache, ConstantPoolCache::base_offset() +
ConstantPoolCacheEntry::flags_offset(), size);
__ and3(size, 0xFF, size); // argument size in words
__ sll(size, Interpreter::logStackElementSize, size); // each argument size in bytes
__ add(Lesp, size, Lesp); // pop arguments
__ dispatch_next(state, step);
// out of the main line of code... const Register flags = cache;
if (EnableInvokeDynamic) { __ ld_ptr(cache, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset(), flags);
__ bind(L_giant_index); const Register parameter_size = flags;
__ get_cache_and_index_at_bcp(cache, G1_scratch, 1, sizeof(u4)); __ and3(flags, ConstantPoolCacheEntry::parameter_size_mask, parameter_size); // argument size in words
__ ba_short(L_got_cache); __ sll(parameter_size, Interpreter::logStackElementSize, parameter_size); // each argument size in bytes
} __ add(Lesp, parameter_size, Lesp); // pop arguments
__ dispatch_next(state, step);
return entry; return entry;
} }

View file

@ -2932,9 +2932,7 @@ void TemplateTable::prepare_invoke(int byte_no,
ConstantPoolCacheEntry::verify_tos_state_shift(); ConstantPoolCacheEntry::verify_tos_state_shift();
// load return address // load return address
{ {
const address table_addr = (is_invokeinterface || is_invokedynamic) ? const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
(address)Interpreter::return_5_addrs_by_index_table() :
(address)Interpreter::return_3_addrs_by_index_table();
AddressLiteral table(table_addr); AddressLiteral table(table_addr);
__ set(table, temp); __ set(table, temp);
__ sll(ra, LogBytesPerWord, ra); __ sll(ra, LogBytesPerWord, ra);
@ -2984,7 +2982,7 @@ void TemplateTable::invokevirtual(int byte_no) {
__ verify_oop(O0_recv); __ verify_oop(O0_recv);
// get return address // get return address
AddressLiteral table(Interpreter::return_3_addrs_by_index_table()); AddressLiteral table(Interpreter::invoke_return_entry_table());
__ set(table, Rtemp); __ set(table, Rtemp);
__ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type
// Make sure we don't need to mask Rret after the above shift // Make sure we don't need to mask Rret after the above shift
@ -3026,7 +3024,7 @@ void TemplateTable::invokevfinal_helper(Register Rscratch, Register Rret) {
__ profile_final_call(O4); __ profile_final_call(O4);
// get return address // get return address
AddressLiteral table(Interpreter::return_3_addrs_by_index_table()); AddressLiteral table(Interpreter::invoke_return_entry_table());
__ set(table, Rtemp); __ set(table, Rtemp);
__ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type __ srl(Rret, ConstantPoolCacheEntry::tos_state_shift, Rret); // get return type
// Make sure we don't need to mask Rret after the above shift // Make sure we don't need to mask Rret after the above shift

View file

@ -1468,19 +1468,18 @@ void LIRGenerator::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {
addr = new LIR_Address(src.result(), offset, type); addr = new LIR_Address(src.result(), offset, type);
} }
if (data != dst) { // Because we want a 2-arg form of xchg and xadd
__ move(data, dst); __ move(data, dst);
data = dst;
}
if (x->is_add()) { if (x->is_add()) {
__ xadd(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr); __ xadd(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr);
} else { } else {
if (is_obj) { if (is_obj) {
// Do the pre-write barrier, if any. // Do the pre-write barrier, if any.
pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */, pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */,
true /* do_load */, false /* patch */, NULL); true /* do_load */, false /* patch */, NULL);
} }
__ xchg(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr); __ xchg(LIR_OprFact::address(addr), dst, dst, LIR_OprFact::illegalOpr);
if (is_obj) { if (is_obj) {
// Seems to be a precise address // Seems to be a precise address
post_barrier(LIR_OprFact::address(addr), data); post_barrier(LIR_OprFact::address(addr), data);

View file

@ -367,7 +367,7 @@ address CppInterpreterGenerator::generate_stack_to_native_abi_converter(BasicTyp
return entry; return entry;
} }
address CppInterpreter::return_entry(TosState state, int length) { address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
// make it look good in the debugger // make it look good in the debugger
return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation); return CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation);
} }

View file

@ -196,7 +196,7 @@ void InterpreterMacroAssembler::check_and_handle_earlyret(Register java_thread)
void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) { void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) {
assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode"); assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode");
movl(reg, Address(rsi, bcp_offset)); load_unsigned_short(reg, Address(rsi, bcp_offset));
bswapl(reg); bswapl(reg);
shrl(reg, 16); shrl(reg, 16);
} }

View file

@ -192,7 +192,7 @@ void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(
Register reg, Register reg,
int bcp_offset) { int bcp_offset) {
assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode"); assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode");
movl(reg, Address(r13, bcp_offset)); load_unsigned_short(reg, Address(r13, bcp_offset));
bswapl(reg); bswapl(reg);
shrl(reg, 16); shrl(reg, 16);
} }

View file

@ -1381,8 +1381,12 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
jcc(Assembler::greater, loop); jcc(Assembler::greater, loop);
// Bang down shadow pages too. // Bang down shadow pages too.
// The -1 because we already subtracted 1 page. // At this point, (tmp-0) is the last address touched, so don't
for (int i = 0; i< StackShadowPages-1; i++) { // touch it again. (It was touched as (tmp-pagesize) but then tmp
// was post-decremented.) Skip this address by starting at i=1, and
// touch a few more pages below. N.B. It is important to touch all
// the way down to and including i=StackShadowPages.
for (int i = 1; i <= StackShadowPages; i++) {
// this could be any sized move but this is can be a debugging crumb // this could be any sized move but this is can be a debugging crumb
// so the bigger the better. // so the bigger the better.
movptr(Address(tmp, (-i*os::vm_page_size())), size ); movptr(Address(tmp, (-i*os::vm_page_size())), size );
@ -5049,25 +5053,32 @@ void MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) {
} }
void MacroAssembler::encode_klass_not_null(Register r) { void MacroAssembler::encode_klass_not_null(Register r) {
assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); if (Universe::narrow_klass_base() != NULL) {
// Use r12 as a scratch register in which to temporarily load the narrow_klass_base. // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
assert(r != r12_heapbase, "Encoding a klass in r12"); assert(r != r12_heapbase, "Encoding a klass in r12");
mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
subq(r, r12_heapbase); subq(r, r12_heapbase);
}
if (Universe::narrow_klass_shift() != 0) { if (Universe::narrow_klass_shift() != 0) {
assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
shrq(r, LogKlassAlignmentInBytes); shrq(r, LogKlassAlignmentInBytes);
} }
if (Universe::narrow_klass_base() != NULL) {
reinit_heapbase(); reinit_heapbase();
}
} }
void MacroAssembler::encode_klass_not_null(Register dst, Register src) { void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
if (dst == src) { if (dst == src) {
encode_klass_not_null(src); encode_klass_not_null(src);
} else { } else {
if (Universe::narrow_klass_base() != NULL) {
mov64(dst, (int64_t)Universe::narrow_klass_base()); mov64(dst, (int64_t)Universe::narrow_klass_base());
negq(dst); negq(dst);
addq(dst, src); addq(dst, src);
} else {
movptr(dst, src);
}
if (Universe::narrow_klass_shift() != 0) { if (Universe::narrow_klass_shift() != 0) {
assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
shrq(dst, LogKlassAlignmentInBytes); shrq(dst, LogKlassAlignmentInBytes);
@ -5081,15 +5092,19 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
// generate change, then this method needs to be updated. // generate change, then this method needs to be updated.
int MacroAssembler::instr_size_for_decode_klass_not_null() { int MacroAssembler::instr_size_for_decode_klass_not_null() {
assert (UseCompressedClassPointers, "only for compressed klass ptrs"); assert (UseCompressedClassPointers, "only for compressed klass ptrs");
if (Universe::narrow_klass_base() != NULL) {
// mov64 + addq + shlq? + mov64 (for reinit_heapbase()). // mov64 + addq + shlq? + mov64 (for reinit_heapbase()).
return (Universe::narrow_klass_shift() == 0 ? 20 : 24); return (Universe::narrow_klass_shift() == 0 ? 20 : 24);
} else {
// longest load decode klass function, mov64, leaq
return 16;
}
} }
// !!! If the instructions that get generated here change then function // !!! If the instructions that get generated here change then function
// instr_size_for_decode_klass_not_null() needs to get updated. // instr_size_for_decode_klass_not_null() needs to get updated.
void MacroAssembler::decode_klass_not_null(Register r) { void MacroAssembler::decode_klass_not_null(Register r) {
// Note: it will change flags // Note: it will change flags
assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
assert (UseCompressedClassPointers, "should only be used for compressed headers"); assert (UseCompressedClassPointers, "should only be used for compressed headers");
assert(r != r12_heapbase, "Decoding a klass in r12"); assert(r != r12_heapbase, "Decoding a klass in r12");
// Cannot assert, unverified entry point counts instructions (see .ad file) // Cannot assert, unverified entry point counts instructions (see .ad file)
@ -5100,14 +5115,15 @@ void MacroAssembler::decode_klass_not_null(Register r) {
shlq(r, LogKlassAlignmentInBytes); shlq(r, LogKlassAlignmentInBytes);
} }
// Use r12 as a scratch register in which to temporarily load the narrow_klass_base. // Use r12 as a scratch register in which to temporarily load the narrow_klass_base.
if (Universe::narrow_klass_base() != NULL) {
mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base()); mov64(r12_heapbase, (int64_t)Universe::narrow_klass_base());
addq(r, r12_heapbase); addq(r, r12_heapbase);
reinit_heapbase(); reinit_heapbase();
}
} }
void MacroAssembler::decode_klass_not_null(Register dst, Register src) { void MacroAssembler::decode_klass_not_null(Register dst, Register src) {
// Note: it will change flags // Note: it will change flags
assert(Universe::narrow_klass_base() != NULL, "Base should be initialized");
assert (UseCompressedClassPointers, "should only be used for compressed headers"); assert (UseCompressedClassPointers, "should only be used for compressed headers");
if (dst == src) { if (dst == src) {
decode_klass_not_null(dst); decode_klass_not_null(dst);
@ -5115,7 +5131,6 @@ void MacroAssembler::decode_klass_not_null(Register dst, Register src) {
// Cannot assert, unverified entry point counts instructions (see .ad file) // Cannot assert, unverified entry point counts instructions (see .ad file)
// vtableStubs also counts instructions in pd_code_size_limit. // vtableStubs also counts instructions in pd_code_size_limit.
// Also do not verify_oop as this is called by verify_oop. // Also do not verify_oop as this is called by verify_oop.
mov64(dst, (int64_t)Universe::narrow_klass_base()); mov64(dst, (int64_t)Universe::narrow_klass_base());
if (Universe::narrow_klass_shift() != 0) { if (Universe::narrow_klass_shift() != 0) {
assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");

View file

@ -150,13 +150,12 @@ address TemplateInterpreterGenerator::generate_continuation_for(TosState state)
} }
address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
TosState incoming_state = state;
address entry = __ pc(); address entry = __ pc();
#ifdef COMPILER2 #ifdef COMPILER2
// The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases
if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) { if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) {
for (int i = 1; i < 8; i++) { for (int i = 1; i < 8; i++) {
__ ffree(i); __ ffree(i);
} }
@ -164,7 +163,7 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
__ empty_FPU_stack(); __ empty_FPU_stack();
} }
#endif #endif
if ((incoming_state == ftos && UseSSE < 1) || (incoming_state == dtos && UseSSE < 2)) { if ((state == ftos && UseSSE < 1) || (state == dtos && UseSSE < 2)) {
__ MacroAssembler::verify_FPU(1, "generate_return_entry_for compiled"); __ MacroAssembler::verify_FPU(1, "generate_return_entry_for compiled");
} else { } else {
__ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled"); __ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled");
@ -172,12 +171,12 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
// In SSE mode, interpreter returns FP results in xmm0 but they need // In SSE mode, interpreter returns FP results in xmm0 but they need
// to end up back on the FPU so it can operate on them. // to end up back on the FPU so it can operate on them.
if (incoming_state == ftos && UseSSE >= 1) { if (state == ftos && UseSSE >= 1) {
__ subptr(rsp, wordSize); __ subptr(rsp, wordSize);
__ movflt(Address(rsp, 0), xmm0); __ movflt(Address(rsp, 0), xmm0);
__ fld_s(Address(rsp, 0)); __ fld_s(Address(rsp, 0));
__ addptr(rsp, wordSize); __ addptr(rsp, wordSize);
} else if (incoming_state == dtos && UseSSE >= 2) { } else if (state == dtos && UseSSE >= 2) {
__ subptr(rsp, 2*wordSize); __ subptr(rsp, 2*wordSize);
__ movdbl(Address(rsp, 0), xmm0); __ movdbl(Address(rsp, 0), xmm0);
__ fld_d(Address(rsp, 0)); __ fld_d(Address(rsp, 0));
@ -194,32 +193,21 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
__ restore_bcp(); __ restore_bcp();
__ restore_locals(); __ restore_locals();
if (incoming_state == atos) { if (state == atos) {
Register mdp = rbx; Register mdp = rbx;
Register tmp = rcx; Register tmp = rcx;
__ profile_return_type(mdp, rax, tmp); __ profile_return_type(mdp, rax, tmp);
} }
Label L_got_cache, L_giant_index; const Register cache = rbx;
if (EnableInvokeDynamic) { const Register index = rcx;
__ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic); __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
__ jcc(Assembler::equal, L_giant_index);
}
__ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2));
__ bind(L_got_cache);
__ movl(rbx, Address(rbx, rcx,
Address::times_ptr, ConstantPoolCache::base_offset() +
ConstantPoolCacheEntry::flags_offset()));
__ andptr(rbx, 0xFF);
__ lea(rsp, Address(rsp, rbx, Interpreter::stackElementScale()));
__ dispatch_next(state, step);
// out of the main line of code... const Register flags = cache;
if (EnableInvokeDynamic) { __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
__ bind(L_giant_index); __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
__ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4)); __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
__ jmp(L_got_cache); __ dispatch_next(state, step);
}
return entry; return entry;
} }

View file

@ -166,7 +166,7 @@ address TemplateInterpreterGenerator::generate_continuation_for(TosState state)
} }
address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step, size_t index_size) {
address entry = __ pc(); address entry = __ pc();
// Restore stack bottom in case i2c adjusted stack // Restore stack bottom in case i2c adjusted stack
@ -183,27 +183,15 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
__ profile_return_type(mdp, rax, tmp); __ profile_return_type(mdp, rax, tmp);
} }
Label L_got_cache, L_giant_index; const Register cache = rbx;
if (EnableInvokeDynamic) { const Register index = rcx;
__ cmpb(Address(r13, 0), Bytecodes::_invokedynamic); __ get_cache_and_index_at_bcp(cache, index, 1, index_size);
__ jcc(Assembler::equal, L_giant_index);
}
__ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u2));
__ bind(L_got_cache);
__ movl(rbx, Address(rbx, rcx,
Address::times_ptr,
in_bytes(ConstantPoolCache::base_offset()) +
3 * wordSize));
__ andl(rbx, 0xFF);
__ lea(rsp, Address(rsp, rbx, Address::times_8));
__ dispatch_next(state, step);
// out of the main line of code... const Register flags = cache;
if (EnableInvokeDynamic) { __ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
__ bind(L_giant_index); __ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
__ get_cache_and_index_at_bcp(rbx, rcx, 1, sizeof(u4)); __ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
__ jmp(L_got_cache); __ dispatch_next(state, step);
}
return entry; return entry;
} }

View file

@ -558,7 +558,7 @@ void TemplateTable::aload() {
void TemplateTable::locals_index_wide(Register reg) { void TemplateTable::locals_index_wide(Register reg) {
__ movl(reg, at_bcp(2)); __ load_unsigned_short(reg, at_bcp(2));
__ bswapl(reg); __ bswapl(reg);
__ shrl(reg, 16); __ shrl(reg, 16);
__ negptr(reg); __ negptr(reg);
@ -1552,7 +1552,11 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
InvocationCounter::counter_offset(); InvocationCounter::counter_offset();
// Load up EDX with the branch displacement // Load up EDX with the branch displacement
if (is_wide) {
__ movl(rdx, at_bcp(1)); __ movl(rdx, at_bcp(1));
} else {
__ load_signed_short(rdx, at_bcp(1));
}
__ bswapl(rdx); __ bswapl(rdx);
if (!is_wide) __ sarl(rdx, 16); if (!is_wide) __ sarl(rdx, 16);
LP64_ONLY(__ movslq(rdx, rdx)); LP64_ONLY(__ movslq(rdx, rdx));
@ -2925,9 +2929,7 @@ void TemplateTable::prepare_invoke(int byte_no,
ConstantPoolCacheEntry::verify_tos_state_shift(); ConstantPoolCacheEntry::verify_tos_state_shift();
// load return address // load return address
{ {
const address table_addr = (is_invokeinterface || is_invokedynamic) ? const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
(address)Interpreter::return_5_addrs_by_index_table() :
(address)Interpreter::return_3_addrs_by_index_table();
ExternalAddress table(table_addr); ExternalAddress table(table_addr);
__ movptr(flags, ArrayAddress(table, Address(noreg, flags, Address::times_ptr))); __ movptr(flags, ArrayAddress(table, Address(noreg, flags, Address::times_ptr)));
} }

View file

@ -568,7 +568,7 @@ void TemplateTable::aload() {
} }
void TemplateTable::locals_index_wide(Register reg) { void TemplateTable::locals_index_wide(Register reg) {
__ movl(reg, at_bcp(2)); __ load_unsigned_short(reg, at_bcp(2));
__ bswapl(reg); __ bswapl(reg);
__ shrl(reg, 16); __ shrl(reg, 16);
__ negptr(reg); __ negptr(reg);
@ -1575,7 +1575,11 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
InvocationCounter::counter_offset(); InvocationCounter::counter_offset();
// Load up edx with the branch displacement // Load up edx with the branch displacement
if (is_wide) {
__ movl(rdx, at_bcp(1)); __ movl(rdx, at_bcp(1));
} else {
__ load_signed_short(rdx, at_bcp(1));
}
__ bswapl(rdx); __ bswapl(rdx);
if (!is_wide) { if (!is_wide) {
@ -2980,9 +2984,7 @@ void TemplateTable::prepare_invoke(int byte_no,
ConstantPoolCacheEntry::verify_tos_state_shift(); ConstantPoolCacheEntry::verify_tos_state_shift();
// load return address // load return address
{ {
const address table_addr = (is_invokeinterface || is_invokedynamic) ? const address table_addr = (address) Interpreter::invoke_return_entry_table_for(code);
(address)Interpreter::return_5_addrs_by_index_table() :
(address)Interpreter::return_3_addrs_by_index_table();
ExternalAddress table(table_addr); ExternalAddress table(table_addr);
__ lea(rscratch1, table); __ lea(rscratch1, table);
__ movptr(flags, Address(rscratch1, flags, Address::times_ptr)); __ movptr(flags, Address(rscratch1, flags, Address::times_ptr));

View file

@ -1006,7 +1006,7 @@ void BytecodeInterpreter::layout_interpreterState(interpreterState istate,
istate->set_stack_limit(stack_base - method->max_stack() - 1); istate->set_stack_limit(stack_base - method->max_stack() - 1);
} }
address CppInterpreter::return_entry(TosState state, int length) { address CppInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
ShouldNotCallThis(); ShouldNotCallThis();
return NULL; return NULL;
} }

View file

@ -57,6 +57,8 @@ define_pd_global(bool, UseMembar, true);
// GC Ergo Flags // GC Ergo Flags
define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread
define_pd_global(uintx, TypeProfileLevel, 0);
#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct)
#endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP #endif // CPU_ZERO_VM_GLOBALS_ZERO_HPP

View file

@ -945,17 +945,15 @@ extern "C" Thread* get_thread() {
// Used by VMSelfDestructTimer and the MemProfiler. // Used by VMSelfDestructTimer and the MemProfiler.
double os::elapsedTime() { double os::elapsedTime() {
return (double)(os::elapsed_counter()) * 0.000001; return ((double)os::elapsed_counter()) / os::elapsed_frequency();
} }
jlong os::elapsed_counter() { jlong os::elapsed_counter() {
timeval time; return javaTimeNanos() - initial_time_count;
int status = gettimeofday(&time, NULL);
return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count;
} }
jlong os::elapsed_frequency() { jlong os::elapsed_frequency() {
return (1000 * 1000); return NANOSECS_PER_SEC; // nanosecond resolution
} }
bool os::supports_vtime() { return true; } bool os::supports_vtime() { return true; }
@ -3582,7 +3580,7 @@ void os::init(void) {
Bsd::_main_thread = pthread_self(); Bsd::_main_thread = pthread_self();
Bsd::clock_init(); Bsd::clock_init();
initial_time_count = os::elapsed_counter(); initial_time_count = javaTimeNanos();
#ifdef __APPLE__ #ifdef __APPLE__
// XXXDARWIN // XXXDARWIN

View file

@ -1333,17 +1333,15 @@ void os::Linux::capture_initial_stack(size_t max_size) {
// Used by VMSelfDestructTimer and the MemProfiler. // Used by VMSelfDestructTimer and the MemProfiler.
double os::elapsedTime() { double os::elapsedTime() {
return (double)(os::elapsed_counter()) * 0.000001; return ((double)os::elapsed_counter()) / os::elapsed_frequency(); // nanosecond resolution
} }
jlong os::elapsed_counter() { jlong os::elapsed_counter() {
timeval time; return javaTimeNanos() - initial_time_count;
int status = gettimeofday(&time, NULL);
return jlong(time.tv_sec) * 1000 * 1000 + jlong(time.tv_usec) - initial_time_count;
} }
jlong os::elapsed_frequency() { jlong os::elapsed_frequency() {
return (1000 * 1000); return NANOSECS_PER_SEC; // nanosecond resolution
} }
bool os::supports_vtime() { return true; } bool os::supports_vtime() { return true; }
@ -4750,7 +4748,7 @@ void os::init(void) {
Linux::_main_thread = pthread_self(); Linux::_main_thread = pthread_self();
Linux::clock_init(); Linux::clock_init();
initial_time_count = os::elapsed_counter(); initial_time_count = javaTimeNanos();
// pthread_condattr initialization for monotonic clock // pthread_condattr initialization for monotonic clock
int status; int status;

View file

@ -79,6 +79,15 @@
# include <pthread_np.h> # include <pthread_np.h>
#endif #endif
// needed by current_stack_region() workaround for Mavericks
#if defined(__APPLE__)
# include <errno.h>
# include <sys/types.h>
# include <sys/sysctl.h>
# define DEFAULT_MAIN_THREAD_STACK_PAGES 2048
# define OS_X_10_9_0_KERNEL_MAJOR_VERSION 13
#endif
#ifdef AMD64 #ifdef AMD64
#define SPELL_REG_SP "rsp" #define SPELL_REG_SP "rsp"
#define SPELL_REG_FP "rbp" #define SPELL_REG_FP "rbp"
@ -828,6 +837,21 @@ static void current_stack_region(address * bottom, size_t * size) {
pthread_t self = pthread_self(); pthread_t self = pthread_self();
void *stacktop = pthread_get_stackaddr_np(self); void *stacktop = pthread_get_stackaddr_np(self);
*size = pthread_get_stacksize_np(self); *size = pthread_get_stacksize_np(self);
// workaround for OS X 10.9.0 (Mavericks)
// pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages
if (pthread_main_np() == 1) {
if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) {
char kern_osrelease[256];
size_t kern_osrelease_size = sizeof(kern_osrelease);
int ret = sysctlbyname("kern.osrelease", kern_osrelease, &kern_osrelease_size, NULL, 0);
if (ret == 0) {
// get the major number, atoi will ignore the minor amd micro portions of the version string
if (atoi(kern_osrelease) >= OS_X_10_9_0_KERNEL_MAJOR_VERSION) {
*size = (DEFAULT_MAIN_THREAD_STACK_PAGES*getpagesize());
}
}
}
}
*bottom = (address) stacktop - *size; *bottom = (address) stacktop - *size;
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
stack_t ss; stack_t ss;

View file

@ -122,7 +122,7 @@ void AbstractAssembler::bind(Label& L) {
void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) { void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
if (UseStackBanging) { if (UseStackBanging) {
// Each code entry causes one stack bang n pages down the stack where n // Each code entry causes one stack bang n pages down the stack where n
// is configurable by StackBangPages. The setting depends on the maximum // is configurable by StackShadowPages. The setting depends on the maximum
// depth of VM call stack or native before going back into java code, // depth of VM call stack or native before going back into java code,
// since only java code can raise a stack overflow exception using the // since only java code can raise a stack overflow exception using the
// stack banging mechanism. The VM and native code does not detect stack // stack banging mechanism. The VM and native code does not detect stack

View file

@ -1873,7 +1873,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
// number of implementors for decl_interface is 0 or 1. If // number of implementors for decl_interface is 0 or 1. If
// it's 0 then no class implements decl_interface and there's // it's 0 then no class implements decl_interface and there's
// no point in inlining. // no point in inlining.
if (!holder->is_loaded() || decl_interface->nof_implementors() != 1) { if (!holder->is_loaded() || decl_interface->nof_implementors() != 1 || decl_interface->has_default_methods()) {
singleton = NULL; singleton = NULL;
} }
} }

View file

@ -1138,8 +1138,10 @@ IntervalUseKind LinearScan::use_kind_of_input_operand(LIR_Op* op, LIR_Opr opr) {
} }
} }
} }
// We want to sometimes use logical operations on pointers, in particular in GC barriers.
} else if (opr_type != T_LONG) { // Since 64bit logical operations do not current support operands on stack, we have to make sure
// T_OBJECT doesn't get spilled along with T_LONG.
} else if (opr_type != T_LONG LP64_ONLY(&& opr_type != T_OBJECT)) {
// integer instruction (note: long operands must always be in register) // integer instruction (note: long operands must always be in register)
switch (op->code()) { switch (op->code()) {
case lir_cmp: case lir_cmp:

View file

@ -57,6 +57,7 @@ ciInstanceKlass::ciInstanceKlass(KlassHandle h_k) :
_init_state = ik->init_state(); _init_state = ik->init_state();
_nonstatic_field_size = ik->nonstatic_field_size(); _nonstatic_field_size = ik->nonstatic_field_size();
_has_nonstatic_fields = ik->has_nonstatic_fields(); _has_nonstatic_fields = ik->has_nonstatic_fields();
_has_default_methods = ik->has_default_methods();
_nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields: _nonstatic_fields = NULL; // initialized lazily by compute_nonstatic_fields:
_implementor = NULL; // we will fill these lazily _implementor = NULL; // we will fill these lazily

View file

@ -52,6 +52,7 @@ private:
bool _has_finalizer; bool _has_finalizer;
bool _has_subklass; bool _has_subklass;
bool _has_nonstatic_fields; bool _has_nonstatic_fields;
bool _has_default_methods;
ciFlags _flags; ciFlags _flags;
jint _nonstatic_field_size; jint _nonstatic_field_size;
@ -171,6 +172,11 @@ public:
} }
} }
bool has_default_methods() {
assert(is_loaded(), "must be loaded");
return _has_default_methods;
}
ciInstanceKlass* get_canonical_holder(int offset); ciInstanceKlass* get_canonical_holder(int offset);
ciField* get_field_by_offset(int field_offset, bool is_static); ciField* get_field_by_offset(int field_offset, bool is_static);
ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static); ciField* get_field_by_name(ciSymbol* name, ciSymbol* signature, bool is_static);

View file

@ -131,6 +131,17 @@ void ClassLoaderData::classes_do(void f(Klass * const)) {
} }
} }
void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
// Lock to avoid classes being modified/added/removed during iteration
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
// Do not filter ArrayKlass oops here...
if (k->oop_is_array() || (k->oop_is_instance() && InstanceKlass::cast(k)->is_loaded())) {
klass_closure->do_klass(k);
}
}
}
void ClassLoaderData::classes_do(void f(InstanceKlass*)) { void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
for (Klass* k = _klasses; k != NULL; k = k->next_link()) { for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
if (k->oop_is_instance()) { if (k->oop_is_instance()) {
@ -600,6 +611,12 @@ void ClassLoaderDataGraph::classes_do(void f(Klass* const)) {
} }
} }
void ClassLoaderDataGraph::loaded_classes_do(KlassClosure* klass_closure) {
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
cld->loaded_classes_do(klass_closure);
}
}
void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) { void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!"); assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) { for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {

View file

@ -78,6 +78,7 @@ class ClassLoaderDataGraph : public AllStatic {
static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
static void classes_do(KlassClosure* klass_closure); static void classes_do(KlassClosure* klass_closure);
static void classes_do(void f(Klass* const)); static void classes_do(void f(Klass* const));
static void loaded_classes_do(KlassClosure* klass_closure);
static void classes_unloading_do(void f(Klass* const)); static void classes_unloading_do(void f(Klass* const));
static bool do_unloading(BoolObjectClosure* is_alive); static bool do_unloading(BoolObjectClosure* is_alive);
@ -186,6 +187,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
bool keep_alive() const { return _keep_alive; } bool keep_alive() const { return _keep_alive; }
bool is_alive(BoolObjectClosure* is_alive_closure) const; bool is_alive(BoolObjectClosure* is_alive_closure) const;
void classes_do(void f(Klass*)); void classes_do(void f(Klass*));
void loaded_classes_do(KlassClosure* klass_closure);
void classes_do(void f(InstanceKlass*)); void classes_do(void f(InstanceKlass*));
// Deallocate free list during class unloading. // Deallocate free list during class unloading.

View file

@ -392,10 +392,16 @@ class MethodFamily : public ResourceObj {
} }
GrowableArray<Method*> qualified_methods; GrowableArray<Method*> qualified_methods;
int num_defaults = 0;
int default_index = -1;
for (int i = 0; i < _members.length(); ++i) { for (int i = 0; i < _members.length(); ++i) {
Pair<Method*,QualifiedState> entry = _members.at(i); Pair<Method*,QualifiedState> entry = _members.at(i);
if (entry.second == QUALIFIED) { if (entry.second == QUALIFIED) {
qualified_methods.append(entry.first); qualified_methods.append(entry.first);
default_index++;
if (entry.first->is_default_method()) {
num_defaults++;
}
} }
} }
@ -408,6 +414,9 @@ class MethodFamily : public ResourceObj {
if (!method->is_abstract()) { if (!method->is_abstract()) {
_selected_target = qualified_methods.at(0); _selected_target = qualified_methods.at(0);
} }
// If only one qualified method is default, select that
} else if (num_defaults == 1) {
_selected_target = qualified_methods.at(default_index);
} else { } else {
_exception_message = generate_conflicts_message(&qualified_methods,CHECK); _exception_message = generate_conflicts_message(&qualified_methods,CHECK);
_exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();

View file

@ -27,6 +27,7 @@
#include "code/codeCache.hpp" #include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp" #include "compiler/compileBroker.hpp"
#include "oops/metadata.hpp" #include "oops/metadata.hpp"
#include "prims/jvmtiImpl.hpp"
#include "runtime/synchronizer.hpp" #include "runtime/synchronizer.hpp"
#include "runtime/thread.hpp" #include "runtime/thread.hpp"
#include "utilities/growableArray.hpp" #include "utilities/growableArray.hpp"
@ -48,6 +49,7 @@ MetadataOnStackMark::MetadataOnStackMark() {
Threads::metadata_do(Metadata::mark_on_stack); Threads::metadata_do(Metadata::mark_on_stack);
CodeCache::alive_nmethods_do(nmethod::mark_on_stack); CodeCache::alive_nmethods_do(nmethod::mark_on_stack);
CompileBroker::mark_on_stack(); CompileBroker::mark_on_stack();
JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
} }
MetadataOnStackMark::~MetadataOnStackMark() { MetadataOnStackMark::~MetadataOnStackMark() {

View file

@ -173,8 +173,6 @@ class SymbolPropertyTable;
/* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
do_klass(nio_Buffer_klass, java_nio_Buffer, Opt ) \ do_klass(nio_Buffer_klass, java_nio_Buffer, Opt ) \
\ \
do_klass(PostVMInitHook_klass, sun_misc_PostVMInitHook, Opt ) \
\
/* Preload boxing klasses */ \ /* Preload boxing klasses */ \
do_klass(Boolean_klass, java_lang_Boolean, Pre ) \ do_klass(Boolean_klass, java_lang_Boolean, Pre ) \
do_klass(Character_klass, java_lang_Character, Pre ) \ do_klass(Character_klass, java_lang_Character, Pre ) \

View file

@ -780,6 +780,10 @@ CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS)
void CompileBroker::compilation_init() { void CompileBroker::compilation_init() {
_last_method_compiled[0] = '\0'; _last_method_compiled[0] = '\0';
// No need to initialize compilation system if we do not use it.
if (!UseCompiler) {
return;
}
#ifndef SHARK #ifndef SHARK
// Set the interface to the current compiler(s). // Set the interface to the current compiler(s).
int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple);

View file

@ -158,8 +158,8 @@ class AbstractInterpreter: AllStatic {
// Runtime support // Runtime support
// length = invoke bytecode length (to advance to next bytecode) // length = invoke bytecode length (to advance to next bytecode)
static address deopt_entry (TosState state, int length) { ShouldNotReachHere(); return NULL; } static address deopt_entry(TosState state, int length) { ShouldNotReachHere(); return NULL; }
static address return_entry (TosState state, int length) { ShouldNotReachHere(); return NULL; } static address return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotReachHere(); return NULL; }
static address rethrow_exception_entry() { return _rethrow_exception_entry; } static address rethrow_exception_entry() { return _rethrow_exception_entry; }

View file

@ -78,7 +78,7 @@ class CppInterpreter: public AbstractInterpreter {
static address stack_result_to_stack(int index) { return _stack_to_stack[index]; } static address stack_result_to_stack(int index) { return _stack_to_stack[index]; }
static address stack_result_to_native(int index) { return _stack_to_native_abi[index]; } static address stack_result_to_native(int index) { return _stack_to_native_abi[index]; }
static address return_entry (TosState state, int length); static address return_entry (TosState state, int length, Bytecodes::Code code);
static address deopt_entry (TosState state, int length); static address deopt_entry (TosState state, int length);
#ifdef TARGET_ARCH_x86 #ifdef TARGET_ARCH_x86

View file

@ -329,15 +329,21 @@ void AbstractInterpreter::print_method_kind(MethodKind kind) {
//------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------
// Deoptimization support // Deoptimization support
// If deoptimization happens, this function returns the point of next bytecode to continue execution /**
* If a deoptimization happens, this function returns the point of next bytecode to continue execution.
*/
address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) { address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
assert(method->contains(bcp), "just checkin'"); assert(method->contains(bcp), "just checkin'");
// Get the original and rewritten bytecode.
Bytecodes::Code code = Bytecodes::java_code_at(method, bcp); Bytecodes::Code code = Bytecodes::java_code_at(method, bcp);
assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute"); assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute");
int bci = method->bci_from(bcp);
int length = -1; // initial value for debugging const int bci = method->bci_from(bcp);
// compute continuation length // compute continuation length
length = Bytecodes::length_at(method, bcp); const int length = Bytecodes::length_at(method, bcp);
// compute result type // compute result type
BasicType type = T_ILLEGAL; BasicType type = T_ILLEGAL;
@ -393,7 +399,7 @@ address AbstractInterpreter::deopt_continue_after_entry(Method* method, address
return return
is_top_frame is_top_frame
? Interpreter::deopt_entry (as_TosState(type), length) ? Interpreter::deopt_entry (as_TosState(type), length)
: Interpreter::return_entry(as_TosState(type), length); : Interpreter::return_entry(as_TosState(type), length, code);
} }
// If deoptimization happens, this function returns the point where the interpreter reexecutes // If deoptimization happens, this function returns the point where the interpreter reexecutes

View file

@ -184,8 +184,9 @@ EntryPoint TemplateInterpreter::_deopt_entry [TemplateInterpreter::number_of_deo
EntryPoint TemplateInterpreter::_continuation_entry; EntryPoint TemplateInterpreter::_continuation_entry;
EntryPoint TemplateInterpreter::_safept_entry; EntryPoint TemplateInterpreter::_safept_entry;
address TemplateInterpreter::_return_3_addrs_by_index[TemplateInterpreter::number_of_return_addrs]; address TemplateInterpreter::_invoke_return_entry[TemplateInterpreter::number_of_return_addrs];
address TemplateInterpreter::_return_5_addrs_by_index[TemplateInterpreter::number_of_return_addrs]; address TemplateInterpreter::_invokeinterface_return_entry[TemplateInterpreter::number_of_return_addrs];
address TemplateInterpreter::_invokedynamic_return_entry[TemplateInterpreter::number_of_return_addrs];
DispatchTable TemplateInterpreter::_active_table; DispatchTable TemplateInterpreter::_active_table;
DispatchTable TemplateInterpreter::_normal_table; DispatchTable TemplateInterpreter::_normal_table;
@ -237,22 +238,37 @@ void TemplateInterpreterGenerator::generate_all() {
#endif // !PRODUCT #endif // !PRODUCT
{ CodeletMark cm(_masm, "return entry points"); { CodeletMark cm(_masm, "return entry points");
const int index_size = sizeof(u2);
for (int i = 0; i < Interpreter::number_of_return_entries; i++) { for (int i = 0; i < Interpreter::number_of_return_entries; i++) {
Interpreter::_return_entry[i] = Interpreter::_return_entry[i] =
EntryPoint( EntryPoint(
generate_return_entry_for(itos, i), generate_return_entry_for(itos, i, index_size),
generate_return_entry_for(itos, i), generate_return_entry_for(itos, i, index_size),
generate_return_entry_for(itos, i), generate_return_entry_for(itos, i, index_size),
generate_return_entry_for(atos, i), generate_return_entry_for(atos, i, index_size),
generate_return_entry_for(itos, i), generate_return_entry_for(itos, i, index_size),
generate_return_entry_for(ltos, i), generate_return_entry_for(ltos, i, index_size),
generate_return_entry_for(ftos, i), generate_return_entry_for(ftos, i, index_size),
generate_return_entry_for(dtos, i), generate_return_entry_for(dtos, i, index_size),
generate_return_entry_for(vtos, i) generate_return_entry_for(vtos, i, index_size)
); );
} }
} }
{ CodeletMark cm(_masm, "invoke return entry points");
const TosState states[] = {itos, itos, itos, itos, ltos, ftos, dtos, atos, vtos};
const int invoke_length = Bytecodes::length_for(Bytecodes::_invokestatic);
const int invokeinterface_length = Bytecodes::length_for(Bytecodes::_invokeinterface);
const int invokedynamic_length = Bytecodes::length_for(Bytecodes::_invokedynamic);
for (int i = 0; i < Interpreter::number_of_return_addrs; i++) {
TosState state = states[i];
Interpreter::_invoke_return_entry[i] = generate_return_entry_for(state, invoke_length, sizeof(u2));
Interpreter::_invokeinterface_return_entry[i] = generate_return_entry_for(state, invokeinterface_length, sizeof(u2));
Interpreter::_invokedynamic_return_entry[i] = generate_return_entry_for(state, invokedynamic_length, sizeof(u4));
}
}
{ CodeletMark cm(_masm, "earlyret entry points"); { CodeletMark cm(_masm, "earlyret entry points");
Interpreter::_earlyret_entry = Interpreter::_earlyret_entry =
EntryPoint( EntryPoint(
@ -298,13 +314,6 @@ void TemplateInterpreterGenerator::generate_all() {
} }
} }
for (int j = 0; j < number_of_states; j++) {
const TosState states[] = {btos, ctos, stos, itos, ltos, ftos, dtos, atos, vtos};
int index = Interpreter::TosState_as_index(states[j]);
Interpreter::_return_3_addrs_by_index[index] = Interpreter::return_entry(states[j], 3);
Interpreter::_return_5_addrs_by_index[index] = Interpreter::return_entry(states[j], 5);
}
{ CodeletMark cm(_masm, "continuation entry points"); { CodeletMark cm(_masm, "continuation entry points");
Interpreter::_continuation_entry = Interpreter::_continuation_entry =
EntryPoint( EntryPoint(
@ -534,9 +543,46 @@ void TemplateInterpreterGenerator::generate_and_dispatch(Template* t, TosState t
//------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------
// Entry points // Entry points
address TemplateInterpreter::return_entry(TosState state, int length) { /**
* Returns the return entry table for the given invoke bytecode.
*/
address* TemplateInterpreter::invoke_return_entry_table_for(Bytecodes::Code code) {
switch (code) {
case Bytecodes::_invokestatic:
case Bytecodes::_invokespecial:
case Bytecodes::_invokevirtual:
case Bytecodes::_invokehandle:
return Interpreter::invoke_return_entry_table();
case Bytecodes::_invokeinterface:
return Interpreter::invokeinterface_return_entry_table();
case Bytecodes::_invokedynamic:
return Interpreter::invokedynamic_return_entry_table();
default:
fatal(err_msg("invalid bytecode: %s", Bytecodes::name(code)));
return NULL;
}
}
/**
* Returns the return entry address for the given top-of-stack state and bytecode.
*/
address TemplateInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) {
guarantee(0 <= length && length < Interpreter::number_of_return_entries, "illegal length"); guarantee(0 <= length && length < Interpreter::number_of_return_entries, "illegal length");
const int index = TosState_as_index(state);
switch (code) {
case Bytecodes::_invokestatic:
case Bytecodes::_invokespecial:
case Bytecodes::_invokevirtual:
case Bytecodes::_invokehandle:
return _invoke_return_entry[index];
case Bytecodes::_invokeinterface:
return _invokeinterface_return_entry[index];
case Bytecodes::_invokedynamic:
return _invokedynamic_return_entry[index];
default:
assert(!Bytecodes::is_invoke(code), err_msg("invoke instructions should be handled separately: %s", Bytecodes::name(code)));
return _return_entry[length].entry(state); return _return_entry[length].entry(state);
}
} }

View file

@ -120,8 +120,9 @@ class TemplateInterpreter: public AbstractInterpreter {
static EntryPoint _continuation_entry; static EntryPoint _continuation_entry;
static EntryPoint _safept_entry; static EntryPoint _safept_entry;
static address _return_3_addrs_by_index[number_of_return_addrs]; // for invokevirtual return entries static address _invoke_return_entry[number_of_return_addrs]; // for invokestatic, invokespecial, invokevirtual return entries
static address _return_5_addrs_by_index[number_of_return_addrs]; // for invokeinterface return entries static address _invokeinterface_return_entry[number_of_return_addrs]; // for invokeinterface return entries
static address _invokedynamic_return_entry[number_of_return_addrs]; // for invokedynamic return entries
static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch) static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch)
static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode) static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode)
@ -161,12 +162,15 @@ class TemplateInterpreter: public AbstractInterpreter {
static address* normal_table() { return _normal_table.table_for(); } static address* normal_table() { return _normal_table.table_for(); }
// Support for invokes // Support for invokes
static address* return_3_addrs_by_index_table() { return _return_3_addrs_by_index; } static address* invoke_return_entry_table() { return _invoke_return_entry; }
static address* return_5_addrs_by_index_table() { return _return_5_addrs_by_index; } static address* invokeinterface_return_entry_table() { return _invokeinterface_return_entry; }
static int TosState_as_index(TosState state); // computes index into return_3_entry_by_index table static address* invokedynamic_return_entry_table() { return _invokedynamic_return_entry; }
static int TosState_as_index(TosState state);
static address return_entry (TosState state, int length); static address* invoke_return_entry_table_for(Bytecodes::Code code);
static address deopt_entry (TosState state, int length);
static address deopt_entry(TosState state, int length);
static address return_entry(TosState state, int length, Bytecodes::Code code);
// Safepoint support // Safepoint support
static void notice_safepoints(); // stops the thread when reaching a safepoint static void notice_safepoints(); // stops the thread when reaching a safepoint

View file

@ -53,7 +53,7 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator {
address generate_ClassCastException_handler(); address generate_ClassCastException_handler();
address generate_ArrayIndexOutOfBounds_handler(const char* name); address generate_ArrayIndexOutOfBounds_handler(const char* name);
address generate_continuation_for(TosState state); address generate_continuation_for(TosState state);
address generate_return_entry_for(TosState state, int step); address generate_return_entry_for(TosState state, int step, size_t index_size);
address generate_earlyret_entry_for(TosState state); address generate_earlyret_entry_for(TosState state);
address generate_deopt_entry_for(TosState state, int step); address generate_deopt_entry_for(TosState state, int step);
address generate_safept_entry_for(TosState state, address runtime_entry); address generate_safept_entry_for(TosState state, address runtime_entry);

View file

@ -56,7 +56,7 @@ size_t const allocation_from_dictionary_limit = 4 * K;
MetaWord* last_allocated = 0; MetaWord* last_allocated = 0;
size_t Metaspace::_class_metaspace_size; size_t Metaspace::_compressed_class_space_size;
// Used in declarations in SpaceManager and ChunkManager // Used in declarations in SpaceManager and ChunkManager
enum ChunkIndex { enum ChunkIndex {
@ -2843,6 +2843,8 @@ ChunkManager* Metaspace::_chunk_manager_class = NULL;
#define VIRTUALSPACEMULTIPLIER 2 #define VIRTUALSPACEMULTIPLIER 2
#ifdef _LP64 #ifdef _LP64
static const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1);
void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address cds_base) { void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address cds_base) {
// Figure out the narrow_klass_base and the narrow_klass_shift. The // Figure out the narrow_klass_base and the narrow_klass_shift. The
// narrow_klass_base is the lower of the metaspace base and the cds base // narrow_klass_base is the lower of the metaspace base and the cds base
@ -2852,14 +2854,22 @@ void Metaspace::set_narrow_klass_base_and_shift(address metaspace_base, address
address higher_address; address higher_address;
if (UseSharedSpaces) { if (UseSharedSpaces) {
higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()), higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()),
(address)(metaspace_base + class_metaspace_size())); (address)(metaspace_base + compressed_class_space_size()));
lower_base = MIN2(metaspace_base, cds_base); lower_base = MIN2(metaspace_base, cds_base);
} else { } else {
higher_address = metaspace_base + class_metaspace_size(); higher_address = metaspace_base + compressed_class_space_size();
lower_base = metaspace_base; lower_base = metaspace_base;
uint64_t klass_encoding_max = UnscaledClassSpaceMax << LogKlassAlignmentInBytes;
// If compressed class space fits in lower 32G, we don't need a base.
if (higher_address <= (address)klass_encoding_max) {
lower_base = 0; // effectively lower base is zero.
} }
}
Universe::set_narrow_klass_base(lower_base); Universe::set_narrow_klass_base(lower_base);
if ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint) {
if ((uint64_t)(higher_address - lower_base) <= UnscaledClassSpaceMax) {
Universe::set_narrow_klass_shift(0); Universe::set_narrow_klass_shift(0);
} else { } else {
assert(!UseSharedSpaces, "Cannot shift with UseSharedSpaces"); assert(!UseSharedSpaces, "Cannot shift with UseSharedSpaces");
@ -2874,24 +2884,24 @@ bool Metaspace::can_use_cds_with_metaspace_addr(char* metaspace_base, address cd
assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs"); assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs");
address lower_base = MIN2((address)metaspace_base, cds_base); address lower_base = MIN2((address)metaspace_base, cds_base);
address higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()), address higher_address = MAX2((address)(cds_base + FileMapInfo::shared_spaces_size()),
(address)(metaspace_base + class_metaspace_size())); (address)(metaspace_base + compressed_class_space_size()));
return ((uint64_t)(higher_address - lower_base) < (uint64_t)max_juint); return ((uint64_t)(higher_address - lower_base) <= UnscaledClassSpaceMax);
} }
// Try to allocate the metaspace at the requested addr. // Try to allocate the metaspace at the requested addr.
void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base) { void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base) {
assert(using_class_space(), "called improperly"); assert(using_class_space(), "called improperly");
assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs"); assert(UseCompressedClassPointers, "Only use with CompressedKlassPtrs");
assert(class_metaspace_size() < KlassEncodingMetaspaceMax, assert(compressed_class_space_size() < KlassEncodingMetaspaceMax,
"Metaspace size is too big"); "Metaspace size is too big");
assert_is_ptr_aligned(requested_addr, _reserve_alignment); assert_is_ptr_aligned(requested_addr, _reserve_alignment);
assert_is_ptr_aligned(cds_base, _reserve_alignment); assert_is_ptr_aligned(cds_base, _reserve_alignment);
assert_is_size_aligned(class_metaspace_size(), _reserve_alignment); assert_is_size_aligned(compressed_class_space_size(), _reserve_alignment);
// Don't use large pages for the class space. // Don't use large pages for the class space.
bool large_pages = false; bool large_pages = false;
ReservedSpace metaspace_rs = ReservedSpace(class_metaspace_size(), ReservedSpace metaspace_rs = ReservedSpace(compressed_class_space_size(),
_reserve_alignment, _reserve_alignment,
large_pages, large_pages,
requested_addr, 0); requested_addr, 0);
@ -2906,7 +2916,7 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a
while (!metaspace_rs.is_reserved() && (addr + increment > addr) && while (!metaspace_rs.is_reserved() && (addr + increment > addr) &&
can_use_cds_with_metaspace_addr(addr + increment, cds_base)) { can_use_cds_with_metaspace_addr(addr + increment, cds_base)) {
addr = addr + increment; addr = addr + increment;
metaspace_rs = ReservedSpace(class_metaspace_size(), metaspace_rs = ReservedSpace(compressed_class_space_size(),
_reserve_alignment, large_pages, addr, 0); _reserve_alignment, large_pages, addr, 0);
} }
} }
@ -2917,11 +2927,11 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a
// initialization has happened that depends on UseCompressedClassPointers. // initialization has happened that depends on UseCompressedClassPointers.
// So, UseCompressedClassPointers cannot be turned off at this point. // So, UseCompressedClassPointers cannot be turned off at this point.
if (!metaspace_rs.is_reserved()) { if (!metaspace_rs.is_reserved()) {
metaspace_rs = ReservedSpace(class_metaspace_size(), metaspace_rs = ReservedSpace(compressed_class_space_size(),
_reserve_alignment, large_pages); _reserve_alignment, large_pages);
if (!metaspace_rs.is_reserved()) { if (!metaspace_rs.is_reserved()) {
vm_exit_during_initialization(err_msg("Could not allocate metaspace: %d bytes", vm_exit_during_initialization(err_msg("Could not allocate metaspace: %d bytes",
class_metaspace_size())); compressed_class_space_size()));
} }
} }
} }
@ -2943,8 +2953,8 @@ void Metaspace::allocate_metaspace_compressed_klass_ptrs(char* requested_addr, a
if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT, gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT,
Universe::narrow_klass_base(), Universe::narrow_klass_shift()); Universe::narrow_klass_base(), Universe::narrow_klass_shift());
gclog_or_tty->print_cr("Metaspace Size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT, gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
class_metaspace_size(), metaspace_rs.base(), requested_addr); compressed_class_space_size(), metaspace_rs.base(), requested_addr);
} }
} }
@ -3010,7 +3020,7 @@ void Metaspace::ergo_initialize() {
MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _commit_alignment); MaxMetaspaceExpansion = restricted_align_down(MaxMetaspaceExpansion, _commit_alignment);
CompressedClassSpaceSize = restricted_align_down(CompressedClassSpaceSize, _reserve_alignment); CompressedClassSpaceSize = restricted_align_down(CompressedClassSpaceSize, _reserve_alignment);
set_class_metaspace_size(CompressedClassSpaceSize); set_compressed_class_space_size(CompressedClassSpaceSize);
} }
void Metaspace::global_initialize() { void Metaspace::global_initialize() {
@ -3039,12 +3049,12 @@ void Metaspace::global_initialize() {
} }
#ifdef _LP64 #ifdef _LP64
if (cds_total + class_metaspace_size() > (uint64_t)max_juint) { if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
vm_exit_during_initialization("Unable to dump shared archive.", vm_exit_during_initialization("Unable to dump shared archive.",
err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space (" err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed " SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
"klass limit: " SIZE_FORMAT, cds_total, class_metaspace_size(), "klass limit: " SIZE_FORMAT, cds_total, compressed_class_space_size(),
cds_total + class_metaspace_size(), (size_t)max_juint)); cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
} }
// Set the compressed klass pointer base so that decoding of these pointers works // Set the compressed klass pointer base so that decoding of these pointers works
@ -3092,7 +3102,8 @@ void Metaspace::global_initialize() {
cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment); cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment);
allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address); allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
} else { } else {
allocate_metaspace_compressed_klass_ptrs((char *)CompressedKlassPointersBase, 0); char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment);
allocate_metaspace_compressed_klass_ptrs(base, 0);
} }
} }
#endif #endif
@ -3354,6 +3365,11 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
return result; return result;
} }
size_t Metaspace::class_chunk_size(size_t word_size) {
assert(using_class_space(), "Has to use class space");
return class_vsm()->calc_chunk_size(word_size);
}
void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) { void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) {
// If result is still null, we are out of memory. // If result is still null, we are out of memory.
if (Verbose && TraceMetadataChunkAllocation) { if (Verbose && TraceMetadataChunkAllocation) {
@ -3365,9 +3381,19 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s
MetaspaceAux::dump(gclog_or_tty); MetaspaceAux::dump(gclog_or_tty);
} }
bool out_of_compressed_class_space = false;
if (is_class_space_allocation(mdtype)) {
Metaspace* metaspace = loader_data->metaspace_non_null();
out_of_compressed_class_space =
MetaspaceAux::committed_bytes(Metaspace::ClassType) +
(metaspace->class_chunk_size(word_size) * BytesPerWord) >
CompressedClassSpaceSize;
}
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
const char* space_string = is_class_space_allocation(mdtype) ? "Compressed class space" : const char* space_string = out_of_compressed_class_space ?
"Metadata space"; "Compressed class space" : "Metaspace";
report_java_out_of_memory(space_string); report_java_out_of_memory(space_string);
if (JvmtiExport::should_post_resource_exhausted()) { if (JvmtiExport::should_post_resource_exhausted()) {
@ -3380,7 +3406,7 @@ void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_s
vm_exit_during_initialization("OutOfMemoryError", space_string); vm_exit_during_initialization("OutOfMemoryError", space_string);
} }
if (is_class_space_allocation(mdtype)) { if (out_of_compressed_class_space) {
THROW_OOP(Universe::out_of_memory_error_class_metaspace()); THROW_OOP(Universe::out_of_memory_error_class_metaspace());
} else { } else {
THROW_OOP(Universe::out_of_memory_error_metaspace()); THROW_OOP(Universe::out_of_memory_error_metaspace());

View file

@ -115,13 +115,13 @@ class Metaspace : public CHeapObj<mtClass> {
static size_t align_word_size_up(size_t); static size_t align_word_size_up(size_t);
// Aligned size of the metaspace. // Aligned size of the metaspace.
static size_t _class_metaspace_size; static size_t _compressed_class_space_size;
static size_t class_metaspace_size() { static size_t compressed_class_space_size() {
return _class_metaspace_size; return _compressed_class_space_size;
} }
static void set_class_metaspace_size(size_t metaspace_size) { static void set_compressed_class_space_size(size_t size) {
_class_metaspace_size = metaspace_size; _compressed_class_space_size = size;
} }
static size_t _first_chunk_word_size; static size_t _first_chunk_word_size;
@ -192,6 +192,8 @@ class Metaspace : public CHeapObj<mtClass> {
AllocRecord * _alloc_record_head; AllocRecord * _alloc_record_head;
AllocRecord * _alloc_record_tail; AllocRecord * _alloc_record_tail;
size_t class_chunk_size(size_t word_size);
public: public:
Metaspace(Mutex* lock, MetaspaceType type); Metaspace(Mutex* lock, MetaspaceType type);
@ -252,6 +254,7 @@ class Metaspace : public CHeapObj<mtClass> {
static bool is_class_space_allocation(MetadataType mdType) { static bool is_class_space_allocation(MetadataType mdType) {
return mdType == ClassType && using_class_space(); return mdType == ClassType && using_class_space();
} }
}; };
class MetaspaceAux : AllStatic { class MetaspaceAux : AllStatic {

View file

@ -677,13 +677,13 @@ jint universe_init() {
// HeapBased - Use compressed oops with heap base + encoding. // HeapBased - Use compressed oops with heap base + encoding.
// 4Gb // 4Gb
static const uint64_t NarrowOopHeapMax = (uint64_t(max_juint) + 1); static const uint64_t UnscaledOopHeapMax = (uint64_t(max_juint) + 1);
// 32Gb // 32Gb
// OopEncodingHeapMax == NarrowOopHeapMax << LogMinObjAlignmentInBytes; // OopEncodingHeapMax == UnscaledOopHeapMax << LogMinObjAlignmentInBytes;
char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_OOP_MODE mode) { char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_OOP_MODE mode) {
assert(is_size_aligned((size_t)OopEncodingHeapMax, alignment), "Must be"); assert(is_size_aligned((size_t)OopEncodingHeapMax, alignment), "Must be");
assert(is_size_aligned((size_t)NarrowOopHeapMax, alignment), "Must be"); assert(is_size_aligned((size_t)UnscaledOopHeapMax, alignment), "Must be");
assert(is_size_aligned(heap_size, alignment), "Must be"); assert(is_size_aligned(heap_size, alignment), "Must be");
uintx heap_base_min_address_aligned = align_size_up(HeapBaseMinAddress, alignment); uintx heap_base_min_address_aligned = align_size_up(HeapBaseMinAddress, alignment);
@ -702,20 +702,40 @@ char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_O
// If the total size is small enough to allow UnscaledNarrowOop then // If the total size is small enough to allow UnscaledNarrowOop then
// just use UnscaledNarrowOop. // just use UnscaledNarrowOop.
} else if ((total_size <= OopEncodingHeapMax) && (mode != HeapBasedNarrowOop)) { } else if ((total_size <= OopEncodingHeapMax) && (mode != HeapBasedNarrowOop)) {
if ((total_size <= NarrowOopHeapMax) && (mode == UnscaledNarrowOop) && if ((total_size <= UnscaledOopHeapMax) && (mode == UnscaledNarrowOop) &&
(Universe::narrow_oop_shift() == 0)) { (Universe::narrow_oop_shift() == 0)) {
// Use 32-bits oops without encoding and // Use 32-bits oops without encoding and
// place heap's top on the 4Gb boundary // place heap's top on the 4Gb boundary
base = (NarrowOopHeapMax - heap_size); base = (UnscaledOopHeapMax - heap_size);
} else { } else {
// Can't reserve with NarrowOopShift == 0 // Can't reserve with NarrowOopShift == 0
Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
if (mode == UnscaledNarrowOop || if (mode == UnscaledNarrowOop ||
mode == ZeroBasedNarrowOop && total_size <= NarrowOopHeapMax) { mode == ZeroBasedNarrowOop && total_size <= UnscaledOopHeapMax) {
// Use zero based compressed oops with encoding and // Use zero based compressed oops with encoding and
// place heap's top on the 32Gb boundary in case // place heap's top on the 32Gb boundary in case
// total_size > 4Gb or failed to reserve below 4Gb. // total_size > 4Gb or failed to reserve below 4Gb.
base = (OopEncodingHeapMax - heap_size); uint64_t heap_top = OopEncodingHeapMax;
// For small heaps, save some space for compressed class pointer
// space so it can be decoded with no base.
if (UseCompressedClassPointers && !UseSharedSpaces &&
OopEncodingHeapMax <= 32*G) {
uint64_t class_space = align_size_up(CompressedClassSpaceSize, alignment);
assert(is_size_aligned((size_t)OopEncodingHeapMax-class_space,
alignment), "difference must be aligned too");
uint64_t new_top = OopEncodingHeapMax-class_space;
if (total_size <= new_top) {
heap_top = new_top;
}
}
// Align base to the adjusted top of the heap
base = heap_top - heap_size;
} }
} }
} else { } else {
@ -737,7 +757,7 @@ char* Universe::preferred_heap_base(size_t heap_size, size_t alignment, NARROW_O
// Set to a non-NULL value so the ReservedSpace ctor computes // Set to a non-NULL value so the ReservedSpace ctor computes
// the correct no-access prefix. // the correct no-access prefix.
// The final value will be set in initialize_heap() below. // The final value will be set in initialize_heap() below.
Universe::set_narrow_oop_base((address)NarrowOopHeapMax); Universe::set_narrow_oop_base((address)UnscaledOopHeapMax);
#ifdef _WIN64 #ifdef _WIN64
if (UseLargePages) { if (UseLargePages) {
// Cannot allocate guard pages for implicit checks in indexed // Cannot allocate guard pages for implicit checks in indexed
@ -833,7 +853,7 @@ jint Universe::initialize_heap() {
Universe::set_narrow_oop_use_implicit_null_checks(true); Universe::set_narrow_oop_use_implicit_null_checks(true);
} }
#endif // _WIN64 #endif // _WIN64
if((uint64_t)Universe::heap()->reserved_region().end() > NarrowOopHeapMax) { if((uint64_t)Universe::heap()->reserved_region().end() > UnscaledOopHeapMax) {
// Can't reserve heap below 4Gb. // Can't reserve heap below 4Gb.
Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes); Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
} else { } else {
@ -1029,7 +1049,7 @@ bool universe_post_init() {
Handle msg = java_lang_String::create_from_str("Java heap space", CHECK_false); Handle msg = java_lang_String::create_from_str("Java heap space", CHECK_false);
java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg()); java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg());
msg = java_lang_String::create_from_str("Metadata space", CHECK_false); msg = java_lang_String::create_from_str("Metaspace", CHECK_false);
java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg()); java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg());
msg = java_lang_String::create_from_str("Compressed class space", CHECK_false); msg = java_lang_String::create_from_str("Compressed class space", CHECK_false);
java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg()); java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg());

View file

@ -2393,15 +2393,38 @@ address InstanceKlass::static_field_addr(int offset) {
const char* InstanceKlass::signature_name() const { const char* InstanceKlass::signature_name() const {
int hash_len = 0;
char hash_buf[40];
// If this is an anonymous class, append a hash to make the name unique
if (is_anonymous()) {
assert(EnableInvokeDynamic, "EnableInvokeDynamic was not set.");
intptr_t hash = (java_mirror() != NULL) ? java_mirror()->identity_hash() : 0;
sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash);
hash_len = (int)strlen(hash_buf);
}
// Get the internal name as a c string
const char* src = (const char*) (name()->as_C_string()); const char* src = (const char*) (name()->as_C_string());
const int src_length = (int)strlen(src); const int src_length = (int)strlen(src);
char* dest = NEW_RESOURCE_ARRAY(char, src_length + 3);
int src_index = 0; char* dest = NEW_RESOURCE_ARRAY(char, src_length + hash_len + 3);
// Add L as type indicator
int dest_index = 0; int dest_index = 0;
dest[dest_index++] = 'L'; dest[dest_index++] = 'L';
while (src_index < src_length) {
// Add the actual class name
for (int src_index = 0; src_index < src_length; ) {
dest[dest_index++] = src[src_index++]; dest[dest_index++] = src[src_index++];
} }
// If we have a hash, append it
for (int hash_index = 0; hash_index < hash_len; ) {
dest[dest_index++] = hash_buf[hash_index++];
}
// Add the semicolon and the NULL
dest[dest_index++] = ';'; dest[dest_index++] = ';';
dest[dest_index] = '\0'; dest[dest_index] = '\0';
return dest; return dest;

View file

@ -1515,7 +1515,10 @@ Bytecodes::Code Method::orig_bytecode_at(int bci) const {
return bp->orig_bytecode(); return bp->orig_bytecode();
} }
} }
ShouldNotReachHere(); {
ResourceMark rm;
fatal(err_msg("no original bytecode found in %s at bci %d", name_and_sig_as_C_string(), bci));
}
return Bytecodes::_shouldnotreachhere; return Bytecodes::_shouldnotreachhere;
} }

View file

@ -848,6 +848,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
} }
#endif #endif
NOT_PRODUCT( verify_barriers(); )
// Now that we know the size of all the monitors we can add a fixed slot // Now that we know the size of all the monitors we can add a fixed slot
// for the original deopt pc. // for the original deopt pc.
@ -3018,7 +3019,13 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
// Phi nodes shouldn't be moved. They would only match below if they // Phi nodes shouldn't be moved. They would only match below if they
// had the same control as the MathExactNode. The only time that // had the same control as the MathExactNode. The only time that
// would happen is if the Phi is also an input to the MathExact // would happen is if the Phi is also an input to the MathExact
if (!out->is_Phi()) { //
// Cmp nodes shouldn't have control set at all.
if (out->is_Phi() ||
out->is_Cmp()) {
continue;
}
if (out->in(0) == NULL) { if (out->in(0) == NULL) {
out->set_req(0, non_throwing); out->set_req(0, non_throwing);
} else if (out->in(0) == ctrl) { } else if (out->in(0) == ctrl) {
@ -3027,7 +3034,6 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) {
} }
} }
} }
}
break; break;
default: default:
assert( !n->is_Call(), "" ); assert( !n->is_Call(), "" );
@ -3368,6 +3374,72 @@ void Compile::verify_graph_edges(bool no_dead_code) {
} }
} }
} }
// Verify GC barriers consistency
// Currently supported:
// - G1 pre-barriers (see GraphKit::g1_write_barrier_pre())
void Compile::verify_barriers() {
if (UseG1GC) {
// Verify G1 pre-barriers
const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active());
ResourceArea *area = Thread::current()->resource_area();
Unique_Node_List visited(area);
Node_List worklist(area);
// We're going to walk control flow backwards starting from the Root
worklist.push(_root);
while (worklist.size() > 0) {
Node* x = worklist.pop();
if (x == NULL || x == top()) continue;
if (visited.member(x)) {
continue;
} else {
visited.push(x);
}
if (x->is_Region()) {
for (uint i = 1; i < x->req(); i++) {
worklist.push(x->in(i));
}
} else {
worklist.push(x->in(0));
// We are looking for the pattern:
// /->ThreadLocal
// If->Bool->CmpI->LoadB->AddP->ConL(marking_offset)
// \->ConI(0)
// We want to verify that the If and the LoadB have the same control
// See GraphKit::g1_write_barrier_pre()
if (x->is_If()) {
IfNode *iff = x->as_If();
if (iff->in(1)->is_Bool() && iff->in(1)->in(1)->is_Cmp()) {
CmpNode *cmp = iff->in(1)->in(1)->as_Cmp();
if (cmp->Opcode() == Op_CmpI && cmp->in(2)->is_Con() && cmp->in(2)->bottom_type()->is_int()->get_con() == 0
&& cmp->in(1)->is_Load()) {
LoadNode* load = cmp->in(1)->as_Load();
if (load->Opcode() == Op_LoadB && load->in(2)->is_AddP() && load->in(2)->in(2)->Opcode() == Op_ThreadLocal
&& load->in(2)->in(3)->is_Con()
&& load->in(2)->in(3)->bottom_type()->is_intptr_t()->get_con() == marking_offset) {
Node* if_ctrl = iff->in(0);
Node* load_ctrl = load->in(0);
if (if_ctrl != load_ctrl) {
// Skip possible CProj->NeverBranch in infinite loops
if ((if_ctrl->is_Proj() && if_ctrl->Opcode() == Op_CProj)
&& (if_ctrl->in(0)->is_MultiBranch() && if_ctrl->in(0)->Opcode() == Op_NeverBranch)) {
if_ctrl = if_ctrl->in(0)->in(0);
}
}
assert(load_ctrl != NULL && if_ctrl == load_ctrl, "controls must match");
}
}
}
}
}
}
}
}
#endif #endif
// The Compile object keeps track of failure reasons separately from the ciEnv. // The Compile object keeps track of failure reasons separately from the ciEnv.

View file

@ -1148,6 +1148,9 @@ class Compile : public Phase {
// graph is strongly connected from root in both directions. // graph is strongly connected from root in both directions.
void verify_graph_edges(bool no_dead_code = false) PRODUCT_RETURN; void verify_graph_edges(bool no_dead_code = false) PRODUCT_RETURN;
// Verify GC barrier patterns
void verify_barriers() PRODUCT_RETURN;
// End-of-run dumps. // End-of-run dumps.
static void print_statistics() PRODUCT_RETURN; static void print_statistics() PRODUCT_RETURN;

View file

@ -2056,7 +2056,7 @@ bool LibraryCallKit::inline_math_subtractExactL(bool is_decrement) {
if (is_decrement) { if (is_decrement) {
arg2 = longcon(1); arg2 = longcon(1);
} else { } else {
Node* arg2 = argument(2); // type long arg2 = argument(2); // type long
// argument(3) == TOP // argument(3) == TOP
} }

View file

@ -713,6 +713,10 @@ bool IdealLoopTree::policy_unroll( PhaseIdealLoop *phase ) const {
case Op_ModL: body_size += 30; break; case Op_ModL: body_size += 30; break;
case Op_DivL: body_size += 30; break; case Op_DivL: body_size += 30; break;
case Op_MulL: body_size += 10; break; case Op_MulL: body_size += 10; break;
case Op_FlagsProj:
// Can't handle unrolling of loops containing
// nodes that generate a FlagsProj at the moment
return false;
case Op_StrComp: case Op_StrComp:
case Op_StrEquals: case Op_StrEquals:
case Op_StrIndexOf: case Op_StrIndexOf:
@ -1960,7 +1964,7 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
// Find loads off the surviving projection; remove their control edge // Find loads off the surviving projection; remove their control edge
for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) { for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
Node* cd = dp->fast_out(i); // Control-dependent node Node* cd = dp->fast_out(i); // Control-dependent node
if( cd->is_Load() ) { // Loads can now float around in the loop if (cd->is_Load() && cd->depends_only_on_test()) { // Loads can now float around in the loop
// Allow the load to float around in the loop, or before it // Allow the load to float around in the loop, or before it
// but NOT before the pre-loop. // but NOT before the pre-loop.
_igvn.replace_input_of(cd, 0, ctrl); // ctrl, not NULL _igvn.replace_input_of(cd, 0, ctrl); // ctrl, not NULL

View file

@ -204,6 +204,17 @@ public:
protected: protected:
const Type* load_array_final_field(const TypeKlassPtr *tkls, const Type* load_array_final_field(const TypeKlassPtr *tkls,
ciKlass* klass) const; ciKlass* klass) const;
// depends_only_on_test is almost always true, and needs to be almost always
// true to enable key hoisting & commoning optimizations. However, for the
// special case of RawPtr loads from TLS top & end, and other loads performed by
// GC barriers, the control edge carries the dependence preventing hoisting past
// a Safepoint instead of the memory edge. (An unfortunate consequence of having
// Safepoints not set Raw Memory; itself an unfortunate consequence of having Nodes
// which produce results (new raw memory state) inside of loops preventing all
// manner of other optimizations). Basically, it's ugly but so is the alternative.
// See comment in macro.cpp, around line 125 expand_allocate_common().
virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM; }
}; };
//------------------------------LoadBNode-------------------------------------- //------------------------------LoadBNode--------------------------------------
@ -370,16 +381,6 @@ public:
virtual uint ideal_reg() const { return Op_RegP; } virtual uint ideal_reg() const { return Op_RegP; }
virtual int store_Opcode() const { return Op_StoreP; } virtual int store_Opcode() const { return Op_StoreP; }
virtual BasicType memory_type() const { return T_ADDRESS; } virtual BasicType memory_type() const { return T_ADDRESS; }
// depends_only_on_test is almost always true, and needs to be almost always
// true to enable key hoisting & commoning optimizations. However, for the
// special case of RawPtr loads from TLS top & end, the control edge carries
// the dependence preventing hoisting past a Safepoint instead of the memory
// edge. (An unfortunate consequence of having Safepoints not set Raw
// Memory; itself an unfortunate consequence of having Nodes which produce
// results (new raw memory state) inside of loops preventing all manner of
// other optimizations). Basically, it's ugly but so is the alternative.
// See comment in macro.cpp, around line 125 expand_allocate_common().
virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM; }
}; };
@ -393,16 +394,6 @@ public:
virtual uint ideal_reg() const { return Op_RegN; } virtual uint ideal_reg() const { return Op_RegN; }
virtual int store_Opcode() const { return Op_StoreN; } virtual int store_Opcode() const { return Op_StoreN; }
virtual BasicType memory_type() const { return T_NARROWOOP; } virtual BasicType memory_type() const { return T_NARROWOOP; }
// depends_only_on_test is almost always true, and needs to be almost always
// true to enable key hoisting & commoning optimizations. However, for the
// special case of RawPtr loads from TLS top & end, the control edge carries
// the dependence preventing hoisting past a Safepoint instead of the memory
// edge. (An unfortunate consequence of having Safepoints not set Raw
// Memory; itself an unfortunate consequence of having Nodes which produce
// results (new raw memory state) inside of loops preventing all manner of
// other optimizations). Basically, it's ugly but so is the alternative.
// See comment in macro.cpp, around line 125 expand_allocate_common().
virtual bool depends_only_on_test() const { return adr_type() != TypeRawPtr::BOTTOM; }
}; };
//------------------------------LoadKlassNode---------------------------------- //------------------------------LoadKlassNode----------------------------------

View file

@ -97,7 +97,8 @@ int PhaseChaitin::yank( Node *old, Block *current_block, Node_List *value, Node_
static bool expected_yanked_node(Node *old, Node *orig_old) { static bool expected_yanked_node(Node *old, Node *orig_old) {
// This code is expected only next original nodes: // This code is expected only next original nodes:
// - load from constant table node which may have next data input nodes: // - load from constant table node which may have next data input nodes:
// MachConstantBase, Phi, MachTemp, MachSpillCopy // MachConstantBase, MachTemp, MachSpillCopy
// - Phi nodes that are considered Junk
// - load constant node which may have next data input nodes: // - load constant node which may have next data input nodes:
// MachTemp, MachSpillCopy // MachTemp, MachSpillCopy
// - MachSpillCopy // - MachSpillCopy
@ -112,7 +113,9 @@ static bool expected_yanked_node(Node *old, Node *orig_old) {
return (old == orig_old); return (old == orig_old);
} else if (old->is_MachTemp()) { } else if (old->is_MachTemp()) {
return orig_old->is_Con(); return orig_old->is_Con();
} else if (old->is_Phi() || old->is_MachConstantBase()) { } else if (old->is_Phi()) { // Junk phi's
return true;
} else if (old->is_MachConstantBase()) {
return (orig_old->is_Con() && orig_old->is_MachConstant()); return (orig_old->is_Con() && orig_old->is_MachConstant());
} }
return false; return false;
@ -522,11 +525,9 @@ void PhaseChaitin::post_allocate_copy_removal() {
u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input
} }
if (u != NodeSentinel) { // Junk Phi. Remove if (u != NodeSentinel) { // Junk Phi. Remove
block->remove_node(j--);
phi_dex--;
_cfg.unmap_node_from_block(phi);
phi->replace_by(u); phi->replace_by(u);
phi->disconnect_inputs(NULL, C); j -= yank_if_dead(phi, block, &value, &regnd);
phi_dex--;
continue; continue;
} }
// Note that if value[pidx] exists, then we merged no new values here // Note that if value[pidx] exists, then we merged no new values here

View file

@ -2787,13 +2787,11 @@ intptr_t TypeOopPtr::get_con() const {
//-----------------------------filter------------------------------------------ //-----------------------------filter------------------------------------------
// Do not allow interface-vs.-noninterface joins to collapse to top. // Do not allow interface-vs.-noninterface joins to collapse to top.
const Type *TypeOopPtr::filter( const Type *kills ) const { const Type *TypeOopPtr::filter(const Type *kills) const {
const Type* ft = join(kills); const Type* ft = join(kills);
const TypeInstPtr* ftip = ft->isa_instptr(); const TypeInstPtr* ftip = ft->isa_instptr();
const TypeInstPtr* ktip = kills->isa_instptr(); const TypeInstPtr* ktip = kills->isa_instptr();
const TypeKlassPtr* ftkp = ft->isa_klassptr();
const TypeKlassPtr* ktkp = kills->isa_klassptr();
if (ft->empty()) { if (ft->empty()) {
// Check for evil case of 'this' being a class and 'kills' expecting an // Check for evil case of 'this' being a class and 'kills' expecting an
@ -2807,8 +2805,6 @@ const Type *TypeOopPtr::filter( const Type *kills ) const {
// uplift the type. // uplift the type.
if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface())
return kills; // Uplift to interface return kills; // Uplift to interface
if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
return kills; // Uplift to interface
return Type::TOP; // Canonical empty value return Type::TOP; // Canonical empty value
} }
@ -2825,14 +2821,6 @@ const Type *TypeOopPtr::filter( const Type *kills ) const {
assert(!ftip->klass_is_exact(), "interface could not be exact"); assert(!ftip->klass_is_exact(), "interface could not be exact");
return ktip->cast_to_ptr_type(ftip->ptr()); return ktip->cast_to_ptr_type(ftip->ptr());
} }
// Interface klass type could be exact in opposite to interface type,
// return it here instead of incorrect Constant ptr J/L/Object (6894807).
if (ftkp != NULL && ktkp != NULL &&
ftkp->is_loaded() && ftkp->klass()->is_interface() &&
!ftkp->klass_is_exact() && // Keep exact interface klass
ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
return ktkp->cast_to_ptr_type(ftkp->ptr());
}
return ft; return ft;
} }
@ -4385,6 +4373,33 @@ bool TypeKlassPtr::singleton(void) const {
return (_offset == 0) && !below_centerline(_ptr); return (_offset == 0) && !below_centerline(_ptr);
} }
// Do not allow interface-vs.-noninterface joins to collapse to top.
const Type *TypeKlassPtr::filter(const Type *kills) const {
// logic here mirrors the one from TypeOopPtr::filter. See comments
// there.
const Type* ft = join(kills);
const TypeKlassPtr* ftkp = ft->isa_klassptr();
const TypeKlassPtr* ktkp = kills->isa_klassptr();
if (ft->empty()) {
if (!empty() && ktkp != NULL && ktkp->klass()->is_loaded() && ktkp->klass()->is_interface())
return kills; // Uplift to interface
return Type::TOP; // Canonical empty value
}
// Interface klass type could be exact in opposite to interface type,
// return it here instead of incorrect Constant ptr J/L/Object (6894807).
if (ftkp != NULL && ktkp != NULL &&
ftkp->is_loaded() && ftkp->klass()->is_interface() &&
!ftkp->klass_is_exact() && // Keep exact interface klass
ktkp->is_loaded() && !ktkp->klass()->is_interface()) {
return ktkp->cast_to_ptr_type(ftkp->ptr());
}
return ft;
}
//----------------------compute_klass------------------------------------------ //----------------------compute_klass------------------------------------------
// Compute the defining klass for this class // Compute the defining klass for this class
ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const { ciKlass* TypeAryPtr::compute_klass(DEBUG_ONLY(bool verify)) const {

View file

@ -1202,6 +1202,9 @@ public:
virtual intptr_t get_con() const; virtual intptr_t get_con() const;
// Do not allow interface-vs.-noninterface joins to collapse to top.
virtual const Type *filter( const Type *kills ) const;
// Convenience common pre-built types. // Convenience common pre-built types.
static const TypeKlassPtr* OBJECT; // Not-null object klass or below static const TypeKlassPtr* OBJECT; // Not-null object klass or below
static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same static const TypeKlassPtr* OBJECT_OR_NULL; // Maybe-null version of same

View file

@ -29,8 +29,43 @@
#include "runtime/thread.hpp" #include "runtime/thread.hpp"
// The closure for GetLoadedClasses
class LoadedClassesClosure : public KlassClosure {
private:
Stack<jclass, mtInternal> _classStack;
JvmtiEnv* _env;
// The closure for GetLoadedClasses and GetClassLoaderClasses public:
LoadedClassesClosure(JvmtiEnv* env) {
_env = env;
}
void do_klass(Klass* k) {
// Collect all jclasses
_classStack.push((jclass) _env->jni_reference(k->java_mirror()));
}
int extract(jclass* result_list) {
// The size of the Stack will be 0 after extract, so get it here
int count = (int)_classStack.size();
int i = count;
// Pop all jclasses, fill backwards
while (!_classStack.is_empty()) {
result_list[--i] = _classStack.pop();
}
// Return the number of elements written
return count;
}
// Return current size of the Stack
int get_count() {
return (int)_classStack.size();
}
};
// The closure for GetClassLoaderClasses
class JvmtiGetLoadedClassesClosure : public StackObj { class JvmtiGetLoadedClassesClosure : public StackObj {
// Since the SystemDictionary::classes_do callback // Since the SystemDictionary::classes_do callback
// doesn't pass a closureData pointer, // doesn't pass a closureData pointer,
@ -165,19 +200,6 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
} }
} }
// Finally, the static methods that are the callbacks
static void increment(Klass* k) {
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
if (that->get_initiatingLoader() == NULL) {
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
that->set_count(that->get_count() + 1);
}
} else if (k != NULL) {
// if initiating loader not null, just include the instance with 1 dimension
that->set_count(that->get_count() + 1);
}
}
static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) { static void increment_with_loader(Klass* k, ClassLoaderData* loader_data) {
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
oop class_loader = loader_data->class_loader(); oop class_loader = loader_data->class_loader();
@ -196,24 +218,6 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
} }
} }
static void add(Klass* k) {
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
if (that->available()) {
if (that->get_initiatingLoader() == NULL) {
for (Klass* l = k; l != NULL; l = l->array_klass_or_null()) {
oop mirror = l->java_mirror();
that->set_element(that->get_index(), mirror);
that->set_index(that->get_index() + 1);
}
} else if (k != NULL) {
// if initiating loader not null, just include the instance with 1 dimension
oop mirror = k->java_mirror();
that->set_element(that->get_index(), mirror);
that->set_index(that->get_index() + 1);
}
}
}
static void add_with_loader(Klass* k, ClassLoaderData* loader_data) { static void add_with_loader(Klass* k, ClassLoaderData* loader_data) {
JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this(); JvmtiGetLoadedClassesClosure* that = JvmtiGetLoadedClassesClosure::get_this();
if (that->available()) { if (that->available()) {
@ -255,39 +259,30 @@ class JvmtiGetLoadedClassesClosure : public StackObj {
jvmtiError jvmtiError
JvmtiGetLoadedClasses::getLoadedClasses(JvmtiEnv *env, jint* classCountPtr, jclass** classesPtr) { JvmtiGetLoadedClasses::getLoadedClasses(JvmtiEnv *env, jint* classCountPtr, jclass** classesPtr) {
// Since SystemDictionary::classes_do only takes a function pointer
// and doesn't call back with a closure data pointer,
// we can only pass static methods.
JvmtiGetLoadedClassesClosure closure; LoadedClassesClosure closure(env);
{ {
// To get a consistent list of classes we need MultiArray_lock to ensure // To get a consistent list of classes we need MultiArray_lock to ensure
// array classes aren't created, and SystemDictionary_lock to ensure that // array classes aren't created.
// classes aren't added to the system dictionary,
MutexLocker ma(MultiArray_lock); MutexLocker ma(MultiArray_lock);
MutexLocker sd(SystemDictionary_lock);
// First, count the classes // Iterate through all classes in ClassLoaderDataGraph
SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::increment); // and collect them using the LoadedClassesClosure
Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::increment); ClassLoaderDataGraph::loaded_classes_do(&closure);
// Next, fill in the classes
closure.allocate();
SystemDictionary::classes_do(&JvmtiGetLoadedClassesClosure::add);
Universe::basic_type_classes_do(&JvmtiGetLoadedClassesClosure::add);
// Drop the SystemDictionary_lock, so the results could be wrong from here,
// but we still have a snapshot.
} }
// Post results
// Return results by extracting the collected contents into a list
// allocated via JvmtiEnv
jclass* result_list; jclass* result_list;
jvmtiError err = env->Allocate(closure.get_count() * sizeof(jclass), jvmtiError error = env->Allocate(closure.get_count() * sizeof(jclass),
(unsigned char**)&result_list); (unsigned char**)&result_list);
if (err != JVMTI_ERROR_NONE) {
return err; if (error == JVMTI_ERROR_NONE) {
} int count = closure.extract(result_list);
closure.extract(env, result_list); *classCountPtr = count;
*classCountPtr = closure.get_count();
*classesPtr = result_list; *classesPtr = result_list;
return JVMTI_ERROR_NONE; }
return error;
} }
jvmtiError jvmtiError

View file

@ -210,6 +210,14 @@ void GrowableCache::oops_do(OopClosure* f) {
} }
} }
void GrowableCache::metadata_do(void f(Metadata*)) {
int len = _elements->length();
for (int i=0; i<len; i++) {
GrowableElement *e = _elements->at(i);
e->metadata_do(f);
}
}
void GrowableCache::gc_epilogue() { void GrowableCache::gc_epilogue() {
int len = _elements->length(); int len = _elements->length();
for (int i=0; i<len; i++) { for (int i=0; i<len; i++) {
@ -224,20 +232,20 @@ void GrowableCache::gc_epilogue() {
JvmtiBreakpoint::JvmtiBreakpoint() { JvmtiBreakpoint::JvmtiBreakpoint() {
_method = NULL; _method = NULL;
_bci = 0; _bci = 0;
_class_loader = NULL; _class_holder = NULL;
} }
JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) { JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) {
_method = m_method; _method = m_method;
_class_loader = _method->method_holder()->class_loader_data()->class_loader(); _class_holder = _method->method_holder()->klass_holder();
#ifdef CHECK_UNHANDLED_OOPS #ifdef CHECK_UNHANDLED_OOPS
// _class_loader can't be wrapped in a Handle, because JvmtiBreakpoint:s are // _class_holder can't be wrapped in a Handle, because JvmtiBreakpoints are
// eventually allocated on the heap. // sometimes allocated on the heap.
// //
// The code handling JvmtiBreakpoint:s allocated on the stack can't be // The code handling JvmtiBreakpoints allocated on the stack can't be
// interrupted by a GC until _class_loader is reachable by the GC via the // interrupted by a GC until _class_holder is reachable by the GC via the
// oops_do method. // oops_do method.
Thread::current()->allow_unhandled_oop(&_class_loader); Thread::current()->allow_unhandled_oop(&_class_holder);
#endif // CHECK_UNHANDLED_OOPS #endif // CHECK_UNHANDLED_OOPS
assert(_method != NULL, "_method != NULL"); assert(_method != NULL, "_method != NULL");
_bci = (int) location; _bci = (int) location;
@ -247,7 +255,7 @@ JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) {
void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) { void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {
_method = bp._method; _method = bp._method;
_bci = bp._bci; _bci = bp._bci;
_class_loader = bp._class_loader; _class_holder = bp._class_holder;
} }
bool JvmtiBreakpoint::lessThan(JvmtiBreakpoint& bp) { bool JvmtiBreakpoint::lessThan(JvmtiBreakpoint& bp) {
@ -365,6 +373,13 @@ void VM_ChangeBreakpoints::oops_do(OopClosure* f) {
} }
} }
void VM_ChangeBreakpoints::metadata_do(void f(Metadata*)) {
// Walk metadata in breakpoints to keep from being deallocated with RedefineClasses
if (_bp != NULL) {
_bp->metadata_do(f);
}
}
// //
// class JvmtiBreakpoints // class JvmtiBreakpoints
// //
@ -381,6 +396,10 @@ void JvmtiBreakpoints::oops_do(OopClosure* f) {
_bps.oops_do(f); _bps.oops_do(f);
} }
void JvmtiBreakpoints::metadata_do(void f(Metadata*)) {
_bps.metadata_do(f);
}
void JvmtiBreakpoints::gc_epilogue() { void JvmtiBreakpoints::gc_epilogue() {
_bps.gc_epilogue(); _bps.gc_epilogue();
} }
@ -499,6 +518,12 @@ void JvmtiCurrentBreakpoints::oops_do(OopClosure* f) {
} }
} }
void JvmtiCurrentBreakpoints::metadata_do(void f(Metadata*)) {
if (_jvmti_breakpoints != NULL) {
_jvmti_breakpoints->metadata_do(f);
}
}
void JvmtiCurrentBreakpoints::gc_epilogue() { void JvmtiCurrentBreakpoints::gc_epilogue() {
if (_jvmti_breakpoints != NULL) { if (_jvmti_breakpoints != NULL) {
_jvmti_breakpoints->gc_epilogue(); _jvmti_breakpoints->gc_epilogue();

View file

@ -69,6 +69,7 @@ public:
virtual bool lessThan(GrowableElement *e)=0; virtual bool lessThan(GrowableElement *e)=0;
virtual GrowableElement *clone() =0; virtual GrowableElement *clone() =0;
virtual void oops_do(OopClosure* f) =0; virtual void oops_do(OopClosure* f) =0;
virtual void metadata_do(void f(Metadata*)) =0;
}; };
class GrowableCache VALUE_OBJ_CLASS_SPEC { class GrowableCache VALUE_OBJ_CLASS_SPEC {
@ -115,6 +116,8 @@ public:
void clear(); void clear();
// apply f to every element and update the cache // apply f to every element and update the cache
void oops_do(OopClosure* f); void oops_do(OopClosure* f);
// walk metadata to preserve for RedefineClasses
void metadata_do(void f(Metadata*));
// update the cache after a full gc // update the cache after a full gc
void gc_epilogue(); void gc_epilogue();
}; };
@ -148,6 +151,7 @@ public:
void remove (int index) { _cache.remove(index); } void remove (int index) { _cache.remove(index); }
void clear() { _cache.clear(); } void clear() { _cache.clear(); }
void oops_do(OopClosure* f) { _cache.oops_do(f); } void oops_do(OopClosure* f) { _cache.oops_do(f); }
void metadata_do(void f(Metadata*)) { _cache.metadata_do(f); }
void gc_epilogue() { _cache.gc_epilogue(); } void gc_epilogue() { _cache.gc_epilogue(); }
}; };
@ -169,7 +173,7 @@ private:
Method* _method; Method* _method;
int _bci; int _bci;
Bytecodes::Code _orig_bytecode; Bytecodes::Code _orig_bytecode;
oop _class_loader; oop _class_holder; // keeps _method memory from being deallocated
public: public:
JvmtiBreakpoint(); JvmtiBreakpoint();
@ -191,9 +195,15 @@ public:
bool lessThan(GrowableElement* e) { Unimplemented(); return false; } bool lessThan(GrowableElement* e) { Unimplemented(); return false; }
bool equals(GrowableElement* e) { return equals((JvmtiBreakpoint&) *e); } bool equals(GrowableElement* e) { return equals((JvmtiBreakpoint&) *e); }
void oops_do(OopClosure* f) { void oops_do(OopClosure* f) {
// Mark the method loader as live // Mark the method loader as live so the Method* class loader doesn't get
f->do_oop(&_class_loader); // unloaded and Method* memory reclaimed.
f->do_oop(&_class_holder);
} }
void metadata_do(void f(Metadata*)) {
// walk metadata to preserve for RedefineClasses
f(_method);
}
GrowableElement *clone() { GrowableElement *clone() {
JvmtiBreakpoint *bp = new JvmtiBreakpoint(); JvmtiBreakpoint *bp = new JvmtiBreakpoint();
bp->copy(*this); bp->copy(*this);
@ -239,6 +249,7 @@ public:
int length(); int length();
void oops_do(OopClosure* f); void oops_do(OopClosure* f);
void metadata_do(void f(Metadata*));
void print(); void print();
int set(JvmtiBreakpoint& bp); int set(JvmtiBreakpoint& bp);
@ -288,6 +299,7 @@ public:
static inline bool is_breakpoint(address bcp); static inline bool is_breakpoint(address bcp);
static void oops_do(OopClosure* f); static void oops_do(OopClosure* f);
static void metadata_do(void f(Metadata*));
static void gc_epilogue(); static void gc_epilogue();
}; };
@ -332,6 +344,7 @@ public:
VMOp_Type type() const { return VMOp_ChangeBreakpoints; } VMOp_Type type() const { return VMOp_ChangeBreakpoints; }
void doit(); void doit();
void oops_do(OopClosure* f); void oops_do(OopClosure* f);
void metadata_do(void f(Metadata*));
}; };

View file

@ -1988,6 +1988,15 @@ void Arguments::check_deprecated_gc_flags() {
warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. " warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
"Use MaxRAMFraction instead."); "Use MaxRAMFraction instead.");
} }
if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) {
warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.");
}
if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) {
warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.");
}
if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) {
warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release.");
}
} }
// Check stack pages settings // Check stack pages settings

View file

@ -45,7 +45,7 @@
oop* HandleArea::allocate_handle(oop obj) { oop* HandleArea::allocate_handle(oop obj) {
assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark"); assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark"); assert(_no_handle_mark_nesting == 0, "allocating handle inside NoHandleMark");
assert(obj->is_oop(), "sanity check"); assert(obj->is_oop(), err_msg("not an oop: " INTPTR_FORMAT, (intptr_t*) obj));
return real_allocate_handle(obj); return real_allocate_handle(obj);
} }

View file

@ -1097,7 +1097,7 @@ static const char* get_java_runtime_version(TRAPS) {
// General purpose hook into Java code, run once when the VM is initialized. // General purpose hook into Java code, run once when the VM is initialized.
// The Java library method itself may be changed independently from the VM. // The Java library method itself may be changed independently from the VM.
static void call_postVMInitHook(TRAPS) { static void call_postVMInitHook(TRAPS) {
Klass* k = SystemDictionary::PostVMInitHook_klass(); Klass* k = SystemDictionary::resolve_or_null(vmSymbols::sun_misc_PostVMInitHook(), THREAD);
instanceKlassHandle klass (THREAD, k); instanceKlassHandle klass (THREAD, k);
if (klass.not_null()) { if (klass.not_null()) {
JavaValue result(T_VOID); JavaValue result(T_VOID);

View file

@ -78,6 +78,7 @@ typedef enum {
JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */ JMM_COMPILE_TOTAL_TIME_MS = 8, /* Total accumulated time spent in compilation */
JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */ JMM_GC_TIME_MS = 9, /* Total accumulated time spent in collection */
JMM_GC_COUNT = 10, /* Total number of collections */ JMM_GC_COUNT = 10, /* Total number of collections */
JMM_JVM_UPTIME_MS = 11, /* The JVM uptime in milliseconds */
JMM_INTERNAL_ATTRIBUTE_INDEX = 100, JMM_INTERNAL_ATTRIBUTE_INDEX = 100,
JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */ JMM_CLASS_LOADED_BYTES = 101, /* Number of bytes loaded instance classes */

View file

@ -1032,6 +1032,9 @@ static jlong get_long_attribute(jmmLongAttribute att) {
case JMM_JVM_INIT_DONE_TIME_MS: case JMM_JVM_INIT_DONE_TIME_MS:
return Management::vm_init_done_time(); return Management::vm_init_done_time();
case JMM_JVM_UPTIME_MS:
return Management::ticks_to_ms(os::elapsed_counter());
case JMM_COMPILE_TOTAL_TIME_MS: case JMM_COMPILE_TOTAL_TIME_MS:
return Management::ticks_to_ms(CompileBroker::total_compilation_ticks()); return Management::ticks_to_ms(CompileBroker::total_compilation_ticks());

View file

@ -368,8 +368,6 @@ const int KlassAlignment = KlassAlignmentInBytes / HeapWordSize;
// Klass encoding metaspace max size // Klass encoding metaspace max size
const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes; const uint64_t KlassEncodingMetaspaceMax = (uint64_t(max_juint) + 1) << LogKlassAlignmentInBytes;
const jlong CompressedKlassPointersBase = NOT_LP64(0) LP64_ONLY(CONST64(0x800000000)); // 32*G
// Machine dependent stuff // Machine dependent stuff
#ifdef TARGET_ARCH_x86 #ifdef TARGET_ARCH_x86

View file

@ -0,0 +1,64 @@
/*
* Copyright (c) 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.
*/
/*
* @test
* @bug 8026735
* @summary CHA in C1 should make correct decisions about default methods
* @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod::test -XX:TieredStopAtLevel=1 InlineDefaultMethod
*/
interface InterfaceWithDefaultMethod0 {
default public int defaultMethod() {
return 1;
}
}
interface InterfaceWithDefaultMethod1 extends InterfaceWithDefaultMethod0 { }
abstract class Subtype implements InterfaceWithDefaultMethod1 { }
class Decoy extends Subtype {
public int defaultMethod() {
return 2;
}
}
class Instance extends Subtype { }
public class InlineDefaultMethod {
public static int test(InterfaceWithDefaultMethod1 x) {
return x.defaultMethod();
}
public static void main(String[] args) {
InterfaceWithDefaultMethod1 a = new Decoy();
InterfaceWithDefaultMethod1 b = new Instance();
if (test(a) != 2 ||
test(b) != 1) {
System.err.println("FAILED");
System.exit(97);
}
System.err.println("PASSED");
}
}

View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 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.
*/
/*
* @test
* @bug 8026722
* @summary Verify that the compare after addExact is a signed compare
* @compile CompareTest.java
* @run main CompareTest
*
*/
public class CompareTest {
public static long store = 0;
public static long addValue = 1231;
public static void main(String[] args) {
for (int i = 0; i < 20000; ++i) {
runTest(i, i);
runTest(i-1, i);
}
}
public static long create(long value, int v) {
if ((value | v) == 0) {
return 0;
}
// C2 turned this test into unsigned test when a control edge was set on the Cmp
if (value < -31557014167219200L || value > 31556889864403199L) {
throw new RuntimeException("error");
}
return value;
}
public static void runTest(long value, int value2) {
long res = Math.addExact(value, addValue);
store = create(res, Math.floorMod(value2, 100000));
}
}

View file

@ -1,12 +1,10 @@
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this * published by the Free Software Foundation.
* 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 * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@ -22,18 +20,35 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package java.lang.invoke;
/** <P> MagicLambdaImpl (named for similarity to MagicAccessorImpl and /*
others, not because it actually implements an interface) is a * @test
marker class in the hierarchy. All subclasses of this class are * @bug 8027444
"magically" granted access by the VM to otherwise inaccessible * @summary Test nested loops
fields and methods of other classes. It is distinct from MagicAccessorImpl * @compile NestedMathExactTest.java
because, while we want to bypass accessibility checks, we do not want to * @run main NestedMathExactTest
bypass verification.</P> *
*/
<P> Do not change the name of this class without also changing the public class NestedMathExactTest {
VM's code. </P> */ public static final int LIMIT = 100;
public static int[] result = new int[LIMIT];
public static int value = 17;
class MagicLambdaImpl { public static void main(String[] args) {
for (int i = 0; i < 100; ++i) {
result[i] = runTest();
}
}
public static int runTest() {
int sum = 0;
for (int j = 0; j < 100000; j = Math.addExact(j, 1)) {
sum = 1;
for (int i = 0; i < 5; ++i) {
sum *= value;
}
}
return sum;
}
} }

View file

@ -24,6 +24,7 @@
/* /*
* @test * @test
* @bug 8026844 * @bug 8026844
* @bug 8027353
* @summary Test constant subtractExact * @summary Test constant subtractExact
* @compile SubExactLConstantTest.java Verify.java * @compile SubExactLConstantTest.java Verify.java
* @run main SubExactLConstantTest * @run main SubExactLConstantTest

View file

@ -24,6 +24,7 @@
/* /*
* @test * @test
* @bug 8026844 * @bug 8026844
* @bug 8027353
* @summary Test non constant subtractExact * @summary Test non constant subtractExact
* @compile SubExactLNonConstantTest.java Verify.java * @compile SubExactLNonConstantTest.java Verify.java
* @run main SubExactLNonConstantTest * @run main SubExactLNonConstantTest

View file

@ -0,0 +1,82 @@
/*
* Copyright (c) 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.
*/
/*
* @test
* @bug 8027445
* @summary String.equals() may be called with a length whose upper bits are not cleared
* @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestStringEqualsBadLength
*
*/
import java.util.Arrays;
public class TestStringEqualsBadLength {
int v1;
int v2;
boolean m(String s1) {
int l = v2 - v1; // 0 - (-1) = 1. On 64 bit: 0xffffffff00000001
char[] arr = new char[l];
arr[0] = 'a';
String s2 = new String(arr);
// The string length is not reloaded but the value computed is
// reused so pointer computation must not use
// 0xffffffff00000001
return s2.equals(s1);
}
// Same thing with String.compareTo()
int m2(String s1) {
int l = v2 - v1;
char[] arr = new char[l+1];
arr[0] = 'a';
arr[1] = 'b';
String s2 = new String(arr);
return s2.compareTo(s1);
}
// Same thing with equals() for arrays
boolean m3(char[] arr1) {
int l = v2 - v1; // 0 - (-1) = 1. On 64 bit: 0xffffffff00000001
char[] arr2 = new char[l];
arr2[0] = 'a';
return Arrays.equals(arr2, arr1);
}
static public void main(String[] args) {
TestStringEqualsBadLength tse = new TestStringEqualsBadLength();
tse.v1 = -1;
tse.v2 = 0;
char[] arr = new char[1];
arr[0] = 'a';
for (int i = 0; i < 20000; i++) {
tse.m("a");
tse.m2("ab");
tse.m3(arr);
}
System.out.println("TEST PASSED");
}
}

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 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.
*/
/*
* @test
* @bug 8027751
* @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill
* @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp
*
* G1 barriers use logical operators (xor) on T_OBJECT mixed with T_LONG or T_INT.
* The current implementation of logical operations on x86 in C1 doesn't allow for long operands to be on stack.
* There is a special code in the register allocator that forces long arguments in registers on x86. However T_OBJECT
* can be spilled just fine, and in that case the xor emission will fail.
*/
import java.util.concurrent.atomic.*;
class C1ObjectSpillInLogicOp {
static public void main(String[] args) {
AtomicReferenceArray<Integer> x = new AtomicReferenceArray(128);
Integer y = new Integer(0);
for (int i = 0; i < 50000; i++) {
x.getAndSet(i % x.length(), y);
}
}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 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.
*/
/*
* @test
* @bug 8026949
* @summary Test ensures correct VM output during startup
* @library ../../testlibrary
*
*/
import com.oracle.java.testlibrary.*;
public class StartupOutput {
public static void main(String[] args) throws Exception {
ProcessBuilder pb;
OutputAnalyzer out;
pb = ProcessTools.createJavaProcessBuilder("-Xint", "-XX:+DisplayVMOutputToStdout", "-version");
out = new OutputAnalyzer(pb.start());
out.shouldNotContain("no space to run compilers");
out.shouldHaveExitValue(0);
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 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.
*/
/*
* @test TestCMSForegroundFlags
* @key gc
* @bug 8027132
* @summary Test that the deprecated CMS foreground collector flags print warning messages
* @library /testlibrary
* @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection
* @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction
* @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing
*/
import com.oracle.java.testlibrary.OutputAnalyzer;
import com.oracle.java.testlibrary.ProcessTools;
public class TestCMSForegroundFlags {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
throw new Exception("Expected two arguments,flagValue and flagName");
}
String flagValue = args[0];
String flagName = args[1];
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release.");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
}

View file

@ -0,0 +1,91 @@
/*
* Copyright (c) 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.
*/
/*
* @test
* @bug 8026365
* @summary Test invokespecial of host class method from an anonymous class
* @author Robert Field
* @library /testlibrary
* @compile -XDignore.symbol.file InvokeSpecialAnonTest.java
* @run main ClassFileInstaller InvokeSpecialAnonTest AnonTester
* @run main/othervm -Xbootclasspath/a:. -Xverify:all InvokeSpecialAnonTest
*/
import jdk.internal.org.objectweb.asm.*;
import java.lang.reflect.Constructor;
import sun.misc.Unsafe;
public class InvokeSpecialAnonTest implements Opcodes {
static byte[] anonClassBytes() throws Exception {
ClassWriter cw = new ClassWriter(0);
MethodVisitor mv;
cw.visit(V1_8, ACC_FINAL + ACC_SUPER, "Anon", null, "java/lang/Object", null);
{
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
mv.visitInsn(RETURN);
mv.visitMaxs(2, 2);
mv.visitEnd();
}
{
mv = cw.visitMethod(ACC_PUBLIC, "m", "(LInvokeSpecialAnonTest;)I", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitMethodInsn(INVOKESPECIAL, "InvokeSpecialAnonTest", "privMethod", "()I");
mv.visitInsn(IRETURN);
mv.visitMaxs(2, 3);
mv.visitEnd();
}
cw.visitEnd();
return cw.toByteArray();
}
private int privMethod() { return 1234; }
public static void main(String[] args) throws Exception {
Class<?> klass = InvokeSpecialAnonTest.class;
try {
Class<?> result = AnonTester.defineTest(klass, anonClassBytes());
System.out.println("Passed.");
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
}
class AnonTester {
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
public static Class<?> defineTest(Class<?> targetClass, byte[] classBytes) throws Exception {
return UNSAFE.defineAnonymousClass(targetClass, classBytes, null);
}
}

View file

@ -0,0 +1,136 @@
/*
* Copyright (c) 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.
*/
/*
* @test
* @bug 8024927
* @summary Testing address of compressed class pointer space as best as possible.
* @library /testlibrary
*/
import com.oracle.java.testlibrary.*;
public class CompressedClassPointers {
public static void smallHeapTest() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedBaseAddress=8g",
"-Xmx128m",
"-XX:+PrintCompressedOopsMode",
"-XX:+VerifyBeforeGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("Narrow klass base: 0x0000000000000000");
output.shouldHaveExitValue(0);
}
public static void smallHeapTestWith3G() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:CompressedClassSpaceSize=3g",
"-Xmx128m",
"-XX:+PrintCompressedOopsMode",
"-XX:+VerifyBeforeGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("Narrow klass base: 0x0000000000000000, Narrow klass shift: 3");
output.shouldHaveExitValue(0);
}
public static void largeHeapTest() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-Xmx30g",
"-XX:+PrintCompressedOopsMode",
"-XX:+VerifyBeforeGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("Narrow klass base: 0x0000000000000000");
output.shouldContain("Narrow klass shift: 0");
output.shouldHaveExitValue(0);
}
public static void largePagesTest() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-Xmx128m",
"-XX:+UseLargePages",
"-XX:+PrintCompressedOopsMode",
"-XX:+VerifyBeforeGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("Narrow klass base:");
output.shouldHaveExitValue(0);
}
public static void sharingTest() throws Exception {
// Test small heaps
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./sample.jsa",
"-Xmx128m",
"-XX:SharedBaseAddress=8g",
"-XX:+PrintCompressedOopsMode",
"-XX:+VerifyBeforeGC",
"-Xshare:dump");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
try {
output.shouldContain("Loading classes to share");
output.shouldHaveExitValue(0);
pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions",
"-XX:SharedArchiveFile=./sample.jsa",
"-Xmx128m",
"-XX:SharedBaseAddress=8g",
"-XX:+PrintCompressedOopsMode",
"-Xshare:on",
"-version");
output = new OutputAnalyzer(pb.start());
output.shouldContain("sharing");
output.shouldHaveExitValue(0);
} catch (RuntimeException e) {
output.shouldContain("Unable to use shared archive");
output.shouldHaveExitValue(1);
}
}
public static void main(String[] args) throws Exception {
if (!Platform.is64bit()) {
// Can't test this on 32 bit, just pass
System.out.println("Skipping test on 32bit");
return;
}
// Solaris 10 can't mmap compressed oops space without a base
if (Platform.isSolaris()) {
String name = System.getProperty("os.version");
if (name.equals("5.10")) {
System.out.println("Skipping test on Solaris 10");
return;
}
}
smallHeapTest();
smallHeapTestWith3G();
largeHeapTest();
largePagesTest();
sharingTest();
}
}

View file

@ -235,3 +235,5 @@ d6a32e3831aab20a9a3bc78cdc0a60aaad725c6c jdk8-b107
17ee0d3e97fdb412e48f14d87f504946a708f846 jdk8-b111 17ee0d3e97fdb412e48f14d87f504946a708f846 jdk8-b111
c1f9158fbb9c2da50f6946fffd974e8236e08447 jdk8-b112 c1f9158fbb9c2da50f6946fffd974e8236e08447 jdk8-b112
0046d2278204b7eff76803fc4623cb48c7e6384d jdk8-b113 0046d2278204b7eff76803fc4623cb48c7e6384d jdk8-b113
1b1e12117fe2840e5d21ae9a4b309e4f981f3ea8 jdk8-b114
f610fd46463e6b0533dd92bce11a1e7d84984e64 jdk8-b115

View file

@ -187,6 +187,19 @@ public final class XalanConstants {
public static final String XML_SECURITY_PROPERTY_MANAGER = public static final String XML_SECURITY_PROPERTY_MANAGER =
ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager"; ORACLE_JAXP_PROPERTY_PREFIX + "xmlSecurityPropertyManager";
/**
* Feature enableExtensionFunctions
*/
public static final String ORACLE_ENABLE_EXTENSION_FUNCTION =
ORACLE_JAXP_PROPERTY_PREFIX + "enableExtensionFunctions";
public static final String SP_ORACLE_ENABLE_EXTENSION_FUNCTION = "javax.xml.enableExtensionFunctions";
/**
* Values for a feature
*/
public static final String FEATURE_TRUE = "true";
public static final String FEATURE_FALSE = "false";
/** /**
* Check if we're in jdk8 or above * Check if we're in jdk8 or above
*/ */

View file

@ -0,0 +1,124 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.org.apache.xalan.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants;
/**
* This class manages security related properties
*
*/
public final class FeatureManager extends FeaturePropertyBase {
/**
* States of the settings of a property, in the order: default value, value
* set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
* properties, and jaxp api properties
*/
public static enum State {
//this order reflects the overriding order
DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
}
/**
* Xalan Features
*/
public static enum Feature {
ORACLE_ENABLE_EXTENSION_FUNCTION(XalanConstants.ORACLE_ENABLE_EXTENSION_FUNCTION,
"true");
final String name;
final String defaultValue;
Feature(String name, String value) {
this.name = name;
this.defaultValue = value;
}
public boolean equalsName(String propertyName) {
return (propertyName == null) ? false : name.equals(propertyName);
}
String defaultValue() {
return defaultValue;
}
}
/**
* Default constructor. Establishes default values
*/
public FeatureManager() {
values = new String[Feature.values().length];
for (Feature feature : Feature.values()) {
values[feature.ordinal()] = feature.defaultValue();
}
//read system properties or jaxp.properties
readSystemProperties();
}
/**
* Check if the feature is enabled
* @param feature name of the feature
* @return true if enabled, false otherwise
*/
public boolean isFeatureEnabled(Feature feature) {
return Boolean.parseBoolean(values[feature.ordinal()]);
}
/**
* Check if the feature is enabled
* @param propertyName name of the feature
* @return true if enabled, false otherwise
*/
public boolean isFeatureEnabled(String propertyName) {
return Boolean.parseBoolean(values[getIndex(propertyName)]);
}
/**
* Get the index by property name
* @param propertyName property name
* @return the index of the property if found; return -1 if not
*/
public int getIndex(String propertyName){
for (Feature feature : Feature.values()) {
if (feature.equalsName(propertyName)) {
return feature.ordinal();
}
}
return -1;
}
/**
* Read from system properties, or those in jaxp.properties
*/
private void readSystemProperties() {
getSystemProperty(Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
XalanConstants.SP_ORACLE_ENABLE_EXTENSION_FUNCTION);
}
}

View file

@ -0,0 +1,215 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.org.apache.xalan.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants;
/**
* This is the base class for features and properties
*
*/
public abstract class FeaturePropertyBase {
/**
* States of the settings of a property, in the order: default value, value
* set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
* properties, and jaxp api properties
*/
public static enum State {
//this order reflects the overriding order
DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
}
/**
* Values of the properties as defined in enum Properties
*/
String[] values = null;
/**
* States of the settings for each property in Properties above
*/
State[] states = {State.DEFAULT, State.DEFAULT};
/**
* Set the value for a specific property.
*
* @param property the property
* @param state the state of the property
* @param value the value of the property
*/
public void setValue(Enum property, State state, String value) {
//only update if it shall override
if (state.compareTo(states[property.ordinal()]) >= 0) {
values[property.ordinal()] = value;
states[property.ordinal()] = state;
}
}
/**
* Set the value of a property by its index
* @param index the index of the property
* @param state the state of the property
* @param value the value of the property
*/
public void setValue(int index, State state, String value) {
//only update if it shall override
if (state.compareTo(states[index]) >= 0) {
values[index] = value;
states[index] = state;
}
}
/**
* Set value by property name and state
* @param propertyName property name
* @param state the state of the property
* @param value the value of the property
* @return true if the property is managed by the security property manager;
* false if otherwise.
*/
public boolean setValue(String propertyName, State state, Object value) {
int index = getIndex(propertyName);
if (index > -1) {
setValue(index, state, (String)value);
return true;
}
return false;
}
/**
* Set value by property name and state
* @param propertyName property name
* @param state the state of the property
* @param value the value of the property
* @return true if the property is managed by the security property manager;
* false if otherwise.
*/
public boolean setValue(String propertyName, State state, boolean value) {
int index = getIndex(propertyName);
if (index > -1) {
if (value) {
setValue(index, state, XalanConstants.FEATURE_TRUE);
} else {
setValue(index, state, XalanConstants.FEATURE_FALSE);
}
return true;
}
return false;
}
/**
* Return the value of the specified property
*
* @param property the property
* @return the value of the property
*/
public String getValue(Enum property) {
return values[property.ordinal()];
}
/**
* Return the value of the specified property
*
* @param property the property
* @return the value of the property
*/
public String getValue(String property) {
int index = getIndex(property);
if (index > -1) {
return getValueByIndex(index);
}
return null;
}
/**
* Return the value of the specified property.
*
* @param propertyName the property name
* @return the value of the property as a string. If a property is managed
* by this manager, its value shall not be null.
*/
public String getValueAsString(String propertyName) {
int index = getIndex(propertyName);
if (index > -1) {
return getValueByIndex(index);
}
return null;
}
/**
* Return the value of a property by its ordinal
* @param index the index of a property
* @return value of a property
*/
public String getValueByIndex(int index) {
return values[index];
}
/**
* Get the index by property name
* @param propertyName property name
* @return the index of the property if found; return -1 if not
*/
public abstract int getIndex(String propertyName);
public <E extends Enum<E>> int getIndex(Class<E> property, String propertyName) {
for (Enum<E> enumItem : property.getEnumConstants()) {
if (enumItem.toString().equals(propertyName)) {
//internally, ordinal is used as index
return enumItem.ordinal();
}
}
return -1;
};
/**
* Read from system properties, or those in jaxp.properties
*
* @param property the property
* @param systemProperty the name of the system property
*/
void getSystemProperty(Enum property, String systemProperty) {
try {
String value = SecuritySupport.getSystemProperty(systemProperty);
if (value != null) {
values[property.ordinal()] = value;
states[property.ordinal()] = State.SYSTEMPROPERTY;
return;
}
value = SecuritySupport.readJAXPProperty(systemProperty);
if (value != null) {
values[property.ordinal()] = value;
states[property.ordinal()] = State.JAXPDOTPROPERTIES;
}
} catch (NumberFormatException e) {
//invalid setting ignored
}
}
}

View file

@ -1,42 +1,28 @@
/* /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. * 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.
* *
* The contents of this file are subject to the terms of either the GNU * This code is distributed in the hope that it will be useful, but WITHOUT
* General Public License Version 2 only ("GPL") or the Common Development * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* and Distribution License("CDDL") (collectively, the "License"). You * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* may not use this file except in compliance with the License. You can * version 2 for more details (a copy is included in the LICENSE file that
* obtain a copy of the License at * accompanied this code).
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
* *
* When distributing the software, include this License Header Notice in each * You should have received a copy of the GNU General Public License version
* file and include the License file at packager/legal/LICENSE.txt. * 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* GPL Classpath Exception: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* Oracle designates this particular file as subject to the "Classpath" * or visit www.oracle.com if you need additional information or have any
* exception as provided by Oracle in the GPL Version 2 section of the License * questions.
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/ */
package com.sun.org.apache.xalan.internal.utils; package com.sun.org.apache.xalan.internal.utils;
import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.XalanConstants;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,20 +33,10 @@ import javax.xml.XMLConstants;
* This class manages security related properties * This class manages security related properties
* *
*/ */
public final class XMLSecurityPropertyManager { public final class XMLSecurityPropertyManager extends FeaturePropertyBase {
/** /**
* States of the settings of a property, in the order: default value, value * Properties managed by the security property manager
* set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
* properties, and jaxp api properties
*/
public static enum State {
//this order reflects the overriding order
DEFAULT, FSP, JAXPDOTPROPERTIES, SYSTEMPROPERTY, APIPROPERTY
}
/**
* Limits managed by the security manager
*/ */
public static enum Property { public static enum Property {
ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD, ACCESS_EXTERNAL_DTD(XMLConstants.ACCESS_EXTERNAL_DTD,
@ -72,15 +62,6 @@ public final class XMLSecurityPropertyManager {
} }
/**
* Values of the properties as defined in enum Properties
*/
private final String[] values;
/**
* States of the settings for each property in Properties above
*/
private State[] states = {State.DEFAULT, State.DEFAULT};
/** /**
* Default constructor. Establishes default values * Default constructor. Establishes default values
*/ */
@ -93,86 +74,6 @@ public final class XMLSecurityPropertyManager {
readSystemProperties(); readSystemProperties();
} }
/**
* Set limit by property name and state
* @param propertyName property name
* @param state the state of the property
* @param value the value of the property
* @return true if the property is managed by the security property manager;
* false if otherwise.
*/
public boolean setValue(String propertyName, State state, Object value) {
int index = getIndex(propertyName);
if (index > -1) {
setValue(index, state, (String)value);
return true;
}
return false;
}
/**
* Set the value for a specific property.
*
* @param property the property
* @param state the state of the property
* @param value the value of the property
*/
public void setValue(Property property, State state, String value) {
//only update if it shall override
if (state.compareTo(states[property.ordinal()]) >= 0) {
values[property.ordinal()] = value;
states[property.ordinal()] = state;
}
}
/**
* Set the value of a property by its index
* @param index the index of the property
* @param state the state of the property
* @param value the value of the property
*/
public void setValue(int index, State state, String value) {
//only update if it shall override
if (state.compareTo(states[index]) >= 0) {
values[index] = value;
states[index] = state;
}
}
/**
* Return the value of the specified property
*
* @param propertyName the property name
* @return the value of the property as a string
*/
public String getValue(String propertyName) {
int index = getIndex(propertyName);
if (index > -1) {
return getValueByIndex(index);
}
return null;
}
/**
* Return the value of the specified property
*
* @param property the property
* @return the value of the property
*/
public String getValue(Property property) {
return values[property.ordinal()];
}
/**
* Return the value of a property by its ordinal
* @param index the index of a property
* @return value of a property
*/
public String getValueByIndex(int index) {
return values[index];
}
/** /**
* Get the index by property name * Get the index by property name
* @param propertyName property name * @param propertyName property name
@ -198,28 +99,4 @@ public final class XMLSecurityPropertyManager {
XalanConstants.SP_ACCESS_EXTERNAL_STYLESHEET); XalanConstants.SP_ACCESS_EXTERNAL_STYLESHEET);
} }
/**
* Read from system properties, or those in jaxp.properties
*
* @param property the property
* @param systemProperty the name of the system property
*/
private void getSystemProperty(Property property, String systemProperty) {
try {
String value = SecuritySupport.getSystemProperty(systemProperty);
if (value != null) {
values[property.ordinal()] = value;
states[property.ordinal()] = State.SYSTEMPROPERTY;
return;
}
value = SecuritySupport.readJAXPProperty(systemProperty);
if (value != null) {
values[property.ordinal()] = value;
states[property.ordinal()] = State.JAXPDOTPROPERTIES;
}
} catch (NumberFormatException e) {
//invalid setting ignored
}
}
} }

View file

@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.cmdline; package com.sun.org.apache.xalan.internal.xsltc.cmdline;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import java.io.File; import java.io.File;
import java.net.URL; import java.net.URL;
import java.util.Vector; import java.util.Vector;
@ -77,7 +78,7 @@ public final class Compile {
final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv"); final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv");
if (args.length < 1) printUsage(); if (args.length < 1) printUsage();
final XSLTC xsltc = new XSLTC(true); final XSLTC xsltc = new XSLTC(true, new FeatureManager());
xsltc.init(); xsltc.init();
int c; int c;

View file

@ -42,6 +42,7 @@ import com.sun.org.apache.bcel.internal.generic.InvokeInstruction;
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen; import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
import com.sun.org.apache.bcel.internal.generic.NEW; import com.sun.org.apache.bcel.internal.generic.NEW;
import com.sun.org.apache.bcel.internal.generic.PUSH; import com.sun.org.apache.bcel.internal.generic.PUSH;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@ -717,6 +718,8 @@ class FunctionCall extends Expression {
final ConstantPoolGen cpg = classGen.getConstantPool(); final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList(); final InstructionList il = methodGen.getInstructionList();
final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing(); final boolean isSecureProcessing = classGen.getParser().getXSLTC().isSecureProcessing();
final boolean isExtensionFunctionEnabled = classGen.getParser().getXSLTC()
.getFeature(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION);
int index; int index;
// Translate calls to methods in the BasisLibrary // Translate calls to methods in the BasisLibrary
@ -760,7 +763,7 @@ class FunctionCall extends Expression {
il.append(new INVOKESTATIC(index)); il.append(new INVOKESTATIC(index));
} }
else if (_isExtConstructor) { else if (_isExtConstructor) {
if (isSecureProcessing) if (isSecureProcessing && !isExtensionFunctionEnabled)
translateUnallowedExtension(cpg, il); translateUnallowedExtension(cpg, il);
final String clazz = final String clazz =
@ -822,7 +825,7 @@ class FunctionCall extends Expression {
} }
// Invoke function calls that are handled in separate classes // Invoke function calls that are handled in separate classes
else { else {
if (isSecureProcessing) if (isSecureProcessing && !isExtensionFunctionEnabled)
translateUnallowedExtension(cpg, il); translateUnallowedExtension(cpg, il);
final String clazz = _chosenMethod.getDeclaringClass().getName(); final String clazz = _chosenMethod.getDeclaringClass().getName();

View file

@ -43,6 +43,8 @@ import javax.xml.XMLConstants;
import com.sun.org.apache.bcel.internal.classfile.JavaClass; import com.sun.org.apache.bcel.internal.classfile.JavaClass;
import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import com.sun.org.apache.xalan.internal.utils.FeatureManager.Feature;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport; import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@ -148,11 +150,14 @@ public final class XSLTC {
private XMLSecurityManager _xmlSecurityManager; private XMLSecurityManager _xmlSecurityManager;
private final FeatureManager _featureManager;
/** /**
* XSLTC compiler constructor * XSLTC compiler constructor
*/ */
public XSLTC(boolean useServicesMechanism) { public XSLTC(boolean useServicesMechanism, FeatureManager featureManager) {
_parser = new Parser(this, useServicesMechanism); _parser = new Parser(this, useServicesMechanism);
_featureManager = featureManager;
} }
/** /**
@ -182,6 +187,15 @@ public final class XSLTC {
_useServicesMechanism = flag; _useServicesMechanism = flag;
} }
/**
* Return the value of the specified feature
* @param name name of the feature
* @return true if the feature is enabled, false otherwise
*/
public boolean getFeature(Feature name) {
return _featureManager.isFeatureEnabled(name);
}
/** /**
* Return allowed protocols for accessing external stylesheet. * Return allowed protocols for accessing external stylesheet.
*/ */

View file

@ -74,12 +74,12 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
DocumentBuilderFactory.newInstance(); DocumentBuilderFactory.newInstance();
private boolean _internal = true; private boolean _internal = true;
public SAX2DOM(boolean useServicesMachnism) throws ParserConfigurationException { public SAX2DOM(boolean useServicesMechanism) throws ParserConfigurationException {
_document = createDocument(useServicesMachnism); _document = createDocument(useServicesMechanism);
_root = _document; _root = _document;
} }
public SAX2DOM(Node root, Node nextSibling, boolean useServicesMachnism) throws ParserConfigurationException { public SAX2DOM(Node root, Node nextSibling, boolean useServicesMechanism) throws ParserConfigurationException {
_root = root; _root = root;
if (root instanceof Document) { if (root instanceof Document) {
_document = (Document)root; _document = (Document)root;
@ -88,15 +88,15 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
_document = root.getOwnerDocument(); _document = root.getOwnerDocument();
} }
else { else {
_document = createDocument(useServicesMachnism); _document = createDocument(useServicesMechanism);
_root = _document; _root = _document;
} }
_nextSibling = nextSibling; _nextSibling = nextSibling;
} }
public SAX2DOM(Node root, boolean useServicesMachnism) throws ParserConfigurationException { public SAX2DOM(Node root, boolean useServicesMechanism) throws ParserConfigurationException {
this(root, null, useServicesMachnism); this(root, null, useServicesMechanism);
} }
public Node getDOM() { public Node getDOM() {
@ -308,19 +308,20 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
public void startDTD(String name, String publicId, String systemId) public void startDTD(String name, String publicId, String systemId)
throws SAXException {} throws SAXException {}
private Document createDocument(boolean useServicesMachnism) throws ParserConfigurationException { private Document createDocument(boolean useServicesMechanism) throws ParserConfigurationException {
if (_factory == null) { if (_factory == null) {
if (useServicesMachnism) if (useServicesMechanism) {
_factory = DocumentBuilderFactory.newInstance(); _factory = DocumentBuilderFactory.newInstance();
if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) { if (!(_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl)) {
_internal = false; _internal = false;
} }
else } else {
_factory = DocumentBuilderFactory.newInstance( _factory = DocumentBuilderFactory.newInstance(
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
SAX2DOM.class.getClassLoader() SAX2DOM.class.getClassLoader()
); );
} }
}
Document doc; Document doc;
if (_internal) { if (_internal) {
//default implementation is thread safe //default implementation is thread safe

View file

@ -95,7 +95,7 @@ public class TemplatesHandlerImpl
_tfactory = tfactory; _tfactory = tfactory;
// Instantiate XSLTC and get reference to parser object // Instantiate XSLTC and get reference to parser object
XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism()); XSLTC xsltc = new XSLTC(tfactory.useServicesMechnism(), tfactory.getFeatureManager());
if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) if (tfactory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING))
xsltc.setSecureProcessing(true); xsltc.setSecureProcessing(true);

View file

@ -25,12 +25,14 @@ package com.sun.org.apache.xalan.internal.xsltc.trax;
import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory; import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport; import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager; import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager; import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property; import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.State; import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase.State;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants; import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader; import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC; import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
@ -227,6 +229,8 @@ public class TransformerFactoryImpl
private XMLSecurityPropertyManager _xmlSecurityPropertyMgr; private XMLSecurityPropertyManager _xmlSecurityPropertyMgr;
private XMLSecurityManager _xmlSecurityManager; private XMLSecurityManager _xmlSecurityManager;
private final FeatureManager _featureManager;
/** /**
* javax.xml.transform.sax.TransformerFactory implementation. * javax.xml.transform.sax.TransformerFactory implementation.
*/ */
@ -240,10 +244,13 @@ public class TransformerFactoryImpl
private TransformerFactoryImpl(boolean useServicesMechanism) { private TransformerFactoryImpl(boolean useServicesMechanism) {
this._useServicesMechanism = useServicesMechanism; this._useServicesMechanism = useServicesMechanism;
_featureManager = new FeatureManager();
if (System.getSecurityManager() != null) { if (System.getSecurityManager() != null) {
_isSecureMode = true; _isSecureMode = true;
_isNotSecureProcessing = false; _isNotSecureProcessing = false;
_featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
} }
_xmlSecurityPropertyMgr = new XMLSecurityPropertyManager(); _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
@ -504,6 +511,10 @@ public class TransformerFactoryImpl
Property.ACCESS_EXTERNAL_STYLESHEET); Property.ACCESS_EXTERNAL_STYLESHEET);
} }
if (value && _featureManager != null) {
_featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
}
return; return;
} }
else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { else if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
@ -512,6 +523,11 @@ public class TransformerFactoryImpl
_useServicesMechanism = value; _useServicesMechanism = value;
} }
else { else {
if (_featureManager != null &&
_featureManager.setValue(name, State.APIPROPERTY, value)) {
return;
}
// unknown feature // unknown feature
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name); ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
throw new TransformerConfigurationException(err.toString()); throw new TransformerConfigurationException(err.toString());
@ -561,6 +577,13 @@ public class TransformerFactoryImpl
return !_isNotSecureProcessing; return !_isNotSecureProcessing;
} }
/** Check to see if the property is managed by the security manager **/
String propertyValue = (_featureManager != null) ?
_featureManager.getValueAsString(name) : null;
if (propertyValue != null) {
return Boolean.parseBoolean(propertyValue);
}
// Feature not supported // Feature not supported
return false; return false;
} }
@ -571,6 +594,13 @@ public class TransformerFactoryImpl
return _useServicesMechanism; return _useServicesMechanism;
} }
/**
* @return the feature manager
*/
public FeatureManager getFeatureManager() {
return _featureManager;
}
/** /**
* javax.xml.transform.sax.TransformerFactory implementation. * javax.xml.transform.sax.TransformerFactory implementation.
* Get the object that is used by default during the transformation to * Get the object that is used by default during the transformation to
@ -857,7 +887,7 @@ public class TransformerFactoryImpl
} }
// Create and initialize a stylesheet compiler // Create and initialize a stylesheet compiler
final XSLTC xsltc = new XSLTC(_useServicesMechanism); final XSLTC xsltc = new XSLTC(_useServicesMechanism, _featureManager);
if (_debug) xsltc.setDebug(true); if (_debug) xsltc.setDebug(true);
if (_enableInlining) if (_enableInlining)
xsltc.setTemplateInlining(true); xsltc.setTemplateInlining(true);

View file

@ -569,32 +569,13 @@ public class XMLDocumentFragmentScannerImpl
// xerces features // xerces features
fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true); fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null); fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
fElementAttributeLimit = (fSecurityManager != null)?
fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0;
fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false); fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);
Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null); Object resolver = componentManager.getProperty(ENTITY_RESOLVER, null);
fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ? fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
(ExternalSubsetResolver) resolver : null; (ExternalSubsetResolver) resolver : null;
// initialize vars
fMarkupDepth = 0;
fCurrentElement = null;
fElementStack.clear();
fHasExternalDTD = false;
fStandaloneSet = false;
fStandalone = false;
fInScanContent = false;
//skipping algorithm
fShouldSkip = false;
fAdd = false;
fSkip = false;
//attribute //attribute
fReadingAttributes = false; fReadingAttributes = false;
//xxx: external entities are supported in Xerces //xxx: external entities are supported in Xerces
@ -606,9 +587,6 @@ public class XMLDocumentFragmentScannerImpl
// setup Driver // setup Driver
setScannerState(SCANNER_STATE_CONTENT); setScannerState(SCANNER_STATE_CONTENT);
setDriver(fContentDriver); setDriver(fContentDriver);
fEntityStore = fEntityManager.getEntityStore();
dtdGrammarUtil = null;
// JAXP 1.5 features and properties // JAXP 1.5 features and properties
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
@ -617,6 +595,7 @@ public class XMLDocumentFragmentScannerImpl
fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false); fStrictURI = componentManager.getFeature(STANDARD_URI_CONFORMANT, false);
resetCommon();
//fEntityManager.test(); //fEntityManager.test();
} // reset(XMLComponentManager) } // reset(XMLComponentManager)
@ -630,17 +609,7 @@ public class XMLDocumentFragmentScannerImpl
fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue(); fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
fNotifyBuiltInRefs = false ; fNotifyBuiltInRefs = false ;
// initialize vars
fMarkupDepth = 0;
fCurrentElement = null;
fShouldSkip = false;
fAdd = false;
fSkip = false;
fElementStack.clear();
//fElementStack2.clear(); //fElementStack2.clear();
fHasExternalDTD = false;
fStandaloneSet = false;
fStandalone = false;
//fReplaceEntityReferences = true; //fReplaceEntityReferences = true;
//fSupportExternalEntities = true; //fSupportExternalEntities = true;
Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_REPLACING_ENTITY_REFERENCES); Boolean bo = (Boolean)propertyManager.getProperty(XMLInputFactoryImpl.IS_REPLACING_ENTITY_REFERENCES);
@ -661,20 +630,43 @@ public class XMLDocumentFragmentScannerImpl
//we dont need to do this -- nb. //we dont need to do this -- nb.
//setScannerState(SCANNER_STATE_CONTENT); //setScannerState(SCANNER_STATE_CONTENT);
//setDriver(fContentDriver); //setDriver(fContentDriver);
fEntityStore = fEntityManager.getEntityStore();
//fEntityManager.test(); //fEntityManager.test();
dtdGrammarUtil = null;
// JAXP 1.5 features and properties // JAXP 1.5 features and properties
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER); propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD); fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER); fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER);
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer(); resetCommon();
} // reset(XMLComponentManager) } // reset(XMLComponentManager)
void resetCommon() {
// initialize vars
fMarkupDepth = 0;
fCurrentElement = null;
fElementStack.clear();
fHasExternalDTD = false;
fStandaloneSet = false;
fStandalone = false;
fInScanContent = false;
//skipping algorithm
fShouldSkip = false;
fAdd = false;
fSkip = false;
fEntityStore = fEntityManager.getEntityStore();
dtdGrammarUtil = null;
if (fSecurityManager != null) {
fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
fElementAttributeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT);
} else {
fLimitAnalyzer = null;
fElementAttributeLimit = 0;
}
}
/** /**
* Returns a list of feature identifiers that are recognized by * Returns a list of feature identifiers that are recognized by
* this component. This method may return null if no features * this component. This method may return null if no features
@ -1328,7 +1320,7 @@ public class XMLDocumentFragmentScannerImpl
fAttributes.getLength() > fElementAttributeLimit){ fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit", "ElementAttributeLimit",
new Object[]{rawname, new Integer(fAttributes.getLength()) }, new Object[]{rawname, fElementAttributeLimit },
XMLErrorReporter.SEVERITY_FATAL_ERROR ); XMLErrorReporter.SEVERITY_FATAL_ERROR );
} }

View file

@ -256,7 +256,7 @@ public class XMLNSDocumentScannerImpl
fAttributes.getLength() > fElementAttributeLimit){ fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit", "ElementAttributeLimit",
new Object[]{rawname, new Integer(fAttributes.getLength()) }, new Object[]{rawname, fElementAttributeLimit },
XMLErrorReporter.SEVERITY_FATAL_ERROR ); XMLErrorReporter.SEVERITY_FATAL_ERROR );
} }

View file

@ -211,7 +211,7 @@ public final class SecuritySupport {
if (i > 0) { if (i > 0) {
return uri.substring(i+1, uri.length()); return uri.substring(i+1, uri.length());
} }
return ""; return uri;
} }
/** /**

View file

@ -33,6 +33,7 @@ import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.objects.XNodeSet; import com.sun.org.apache.xpath.internal.objects.XNodeSet;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xalan.internal.res.XSLMessages;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import com.sun.org.apache.xpath.internal.functions.FuncExtFunction; import com.sun.org.apache.xpath.internal.functions.FuncExtFunction;
import java.util.Vector; import java.util.Vector;
@ -54,9 +55,12 @@ public class JAXPExtensionsProvider implements ExtensionsProvider {
} }
public JAXPExtensionsProvider(XPathFunctionResolver resolver, public JAXPExtensionsProvider(XPathFunctionResolver resolver,
boolean featureSecureProcessing ) { boolean featureSecureProcessing, FeatureManager featureManager ) {
this.resolver = resolver; this.resolver = resolver;
this.extensionInvocationDisabled = featureSecureProcessing; if (featureSecureProcessing &&
!featureManager.isFeatureEnabled(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION)) {
this.extensionInvocationDisabled = true;
}
} }
/** /**

View file

@ -30,6 +30,7 @@ import com.sun.org.apache.xml.internal.utils.PrefixResolver;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xalan.internal.res.XSLMessages;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
@ -67,33 +68,36 @@ public class XPathExpressionImpl implements javax.xml.xpath.XPathExpression{
private boolean featureSecureProcessing = false; private boolean featureSecureProcessing = false;
private boolean useServicesMechanism = true; private boolean useServicesMechanism = true;
private final FeatureManager featureManager;
/** Protected constructor to prevent direct instantiation; use compile() /** Protected constructor to prevent direct instantiation; use compile()
* from the context. * from the context.
*/ */
protected XPathExpressionImpl() { }; protected XPathExpressionImpl() {
this(null, null, null, null,
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath, false, true, new FeatureManager());
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver ) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = false;
}; };
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath, protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver, JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver, XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver, XPathVariableResolver variableResolver ) {
boolean featureSecureProcessing, boolean useServicesMechanism ) { this(xpath, prefixResolver, functionResolver, variableResolver,
false, true, new FeatureManager());
};
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver, boolean featureSecureProcessing,
boolean useServicesMechanism, FeatureManager featureManager ) {
this.xpath = xpath; this.xpath = xpath;
this.prefixResolver = prefixResolver; this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver; this.functionResolver = functionResolver;
this.variableResolver = variableResolver; this.variableResolver = variableResolver;
this.featureSecureProcessing = featureSecureProcessing; this.featureSecureProcessing = featureSecureProcessing;
this.useServicesMechanism = useServicesMechanism; this.useServicesMechanism = useServicesMechanism;
this.featureManager = featureManager;
}; };
public void setXPath (com.sun.org.apache.xpath.internal.XPath xpath ) { public void setXPath (com.sun.org.apache.xpath.internal.XPath xpath ) {
@ -111,7 +115,7 @@ public class XPathExpressionImpl implements javax.xml.xpath.XPathExpression{
com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null; com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
if ( functionResolver != null ) { if ( functionResolver != null ) {
JAXPExtensionsProvider jep = new JAXPExtensionsProvider( JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
functionResolver, featureSecureProcessing ); functionResolver, featureSecureProcessing, featureManager );
xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep ); xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
} else { } else {
xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(); xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();

View file

@ -24,6 +24,8 @@ package com.sun.org.apache.xpath.internal.jaxp;
import com.sun.org.apache.xalan.internal.XalanConstants; import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xalan.internal.res.XSLMessages;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import com.sun.org.apache.xalan.internal.utils.FeaturePropertyBase;
import javax.xml.XMLConstants; import javax.xml.XMLConstants;
import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathFactory;
@ -68,6 +70,8 @@ public class XPathFactoryImpl extends XPathFactory {
private boolean _useServicesMechanism = true; private boolean _useServicesMechanism = true;
private final FeatureManager _featureManager;
public XPathFactoryImpl() { public XPathFactoryImpl() {
this(true); this(true);
} }
@ -77,9 +81,12 @@ public class XPathFactoryImpl extends XPathFactory {
} }
public XPathFactoryImpl(boolean useServicesMechanism) { public XPathFactoryImpl(boolean useServicesMechanism) {
_featureManager = new FeatureManager();
if (System.getSecurityManager() != null) { if (System.getSecurityManager() != null) {
_isSecureMode = true; _isSecureMode = true;
_isNotSecureProcessing = false; _isNotSecureProcessing = false;
_featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
} }
this._useServicesMechanism = useServicesMechanism; this._useServicesMechanism = useServicesMechanism;
} }
@ -131,7 +138,8 @@ public class XPathFactoryImpl extends XPathFactory {
public javax.xml.xpath.XPath newXPath() { public javax.xml.xpath.XPath newXPath() {
return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl( return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl(
xPathVariableResolver, xPathFunctionResolver, xPathVariableResolver, xPathFunctionResolver,
!_isNotSecureProcessing, _useServicesMechanism ); !_isNotSecureProcessing, _useServicesMechanism,
_featureManager );
} }
/** /**
@ -181,6 +189,10 @@ public class XPathFactoryImpl extends XPathFactory {
} }
_isNotSecureProcessing = !value; _isNotSecureProcessing = !value;
if (value && _featureManager != null) {
_featureManager.setValue(FeatureManager.Feature.ORACLE_ENABLE_EXTENSION_FUNCTION,
FeaturePropertyBase.State.FSP, XalanConstants.FEATURE_FALSE);
}
// all done processing feature // all done processing feature
return; return;
@ -192,6 +204,11 @@ public class XPathFactoryImpl extends XPathFactory {
return; return;
} }
if (_featureManager != null &&
_featureManager.setValue(name, FeaturePropertyBase.State.APIPROPERTY, value)) {
return;
}
// unknown feature // unknown feature
String fmsg = XSLMessages.createXPATHMessage( String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_FEATURE_UNKNOWN, XPATHErrorResources.ER_FEATURE_UNKNOWN,
@ -240,6 +257,14 @@ public class XPathFactoryImpl extends XPathFactory {
if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) { if (name.equals(XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
return _useServicesMechanism; return _useServicesMechanism;
} }
/** Check to see if the property is managed by the security manager **/
String propertyValue = (_featureManager != null) ?
_featureManager.getValueAsString(name) : null;
if (propertyValue != null) {
return _featureManager.isFeatureEnabled(name);
}
// unknown feature // unknown feature
String fmsg = XSLMessages.createXPATHMessage( String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE, XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE,

View file

@ -35,6 +35,7 @@ import com.sun.org.apache.xpath.internal.objects.XObject;
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xalan.internal.res.XSLMessages;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl; import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.FeatureManager;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@ -70,18 +71,20 @@ public class XPathImpl implements javax.xml.xpath.XPath {
// extensions function need to throw XPathFunctionException // extensions function need to throw XPathFunctionException
private boolean featureSecureProcessing = false; private boolean featureSecureProcessing = false;
private boolean useServiceMechanism = true; private boolean useServiceMechanism = true;
private final FeatureManager featureManager;
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr ) { XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr ) {
this.origVariableResolver = this.variableResolver = vr; this(vr, fr, false, true, new FeatureManager());
this.origFunctionResolver = this.functionResolver = fr;
} }
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr, XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
boolean featureSecureProcessing, boolean useServiceMechanism ) { boolean featureSecureProcessing, boolean useServiceMechanism,
FeatureManager featureManager) {
this.origVariableResolver = this.variableResolver = vr; this.origVariableResolver = this.variableResolver = vr;
this.origFunctionResolver = this.functionResolver = fr; this.origFunctionResolver = this.functionResolver = fr;
this.featureSecureProcessing = featureSecureProcessing; this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism; this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
} }
/** /**
@ -190,7 +193,7 @@ public class XPathImpl implements javax.xml.xpath.XPath {
com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null; com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
if ( functionResolver != null ) { if ( functionResolver != null ) {
JAXPExtensionsProvider jep = new JAXPExtensionsProvider( JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
functionResolver, featureSecureProcessing ); functionResolver, featureSecureProcessing, featureManager );
xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep ); xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
} else { } else {
xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext(); xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
@ -391,7 +394,7 @@ public class XPathImpl implements javax.xml.xpath.XPath {
// Can have errorListener // Can have errorListener
XPathExpressionImpl ximpl = new XPathExpressionImpl (xpath, XPathExpressionImpl ximpl = new XPathExpressionImpl (xpath,
prefixResolver, functionResolver, variableResolver, prefixResolver, functionResolver, variableResolver,
featureSecureProcessing, useServiceMechanism ); featureSecureProcessing, useServiceMechanism, featureManager );
return ximpl; return ximpl;
} catch ( javax.xml.transform.TransformerException te ) { } catch ( javax.xml.transform.TransformerException te ) {
throw new XPathExpressionException ( te ) ; throw new XPathExpressionException ( te ) ;

View file

@ -235,3 +235,5 @@ cc682329886be2fc26220fc30597ee4e5bba43ed jdk8-b110
32edc7a2c86696dfcbdb6ffae641ff153f8e34bd jdk8-b111 32edc7a2c86696dfcbdb6ffae641ff153f8e34bd jdk8-b111
dbdd5c76250928582cb5342bcf7b299a6007d538 jdk8-b112 dbdd5c76250928582cb5342bcf7b299a6007d538 jdk8-b112
9261f342aa73a79bbd1a817ae72fa72b15ef30bc jdk8-b113 9261f342aa73a79bbd1a817ae72fa72b15ef30bc jdk8-b113
9ad289610fc6effe9076280b7920d0f16470709f jdk8-b114
e126d8eca69b83a1cc159c2375b7c33140346d2b jdk8-b115

View file

@ -235,3 +235,5 @@ eea685b9ccaa1980e0a7e07d6a3a84bcc7e9ab82 jdk8-b107
719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111 719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111
f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112 f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112
5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113 5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113
f26a0c8071bde1e3b923713c75156e4a58955623 jdk8-b114
f82b730c798b6bf38946baaba8a7d80fd5efaa70 jdk8-b115

View file

@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler {
// remove ROC, which is not supported in j.u.tz // remove ROC, which is not supported in j.u.tz
builtZones.remove("ROC"); builtZones.remove("ROC");
links.remove("ROC"); links.remove("ROC");
// remove EST, HST and MST. They are supported via
// the short-id mapping
builtZones.remove("EST");
builtZones.remove("HST");
builtZones.remove("MST");
} }
/** /**

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