This commit is contained in:
J. Duke 2017-08-24 16:33:50 +02:00
commit 991786b1dc
158 changed files with 4314 additions and 1600 deletions
.hgtags-top-repo
corba
hotspot
jaxp
jaxws
.hgtags
src
java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml
jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/parser
jdk
.hgtags
make
src

@ -437,3 +437,6 @@ d67a3f1f057f7e31e12f33ebe3667cb73d252268 jdk-10+13
a4371edb589c60db01142e45c317adb9ccbcb083 jdk-9+177
a6c830ee8a6798b186730475e700027cdf4598aa jdk-10+15
2fe66ca1e2b3c361f949de9cb2894661dc0a3fa2 jdk-10+16
ec4159ebe7050fcc5dcee8a2d150cf948ecc97db jdk-9+178
252475ccfd84cc249f8d6faf4b7806b5e2c384ce jdk-9+179
a133a7d1007b1456bc62824382fd8ac93b45d329 jdk-10+17

@ -437,3 +437,6 @@ dc78a3dd6b3a4f11cdae8a3e3d160e6a78bc7838 jdk-9+175
c72e9d3823f04cb3ef3166646dfea9e4c2769133 jdk-9+177
15f59cfc6fbe9387423fb173e962265c7b5d357e jdk-10+15
b82b62ed5debda2d98dda597506ef29cf947fbae jdk-10+16
9c1e9712648921ae389d623042d22561fad82d75 jdk-9+178
24390da83c5ee9e23ceafbcaff4460a01e37bb3a jdk-9+179
50ff1fd66362f212a8db6de76089d9d0ffa4df0f jdk-10+17

@ -597,3 +597,6 @@ e920b4d008d914f3414bd4630b58837cf0b7f08d jdk-10+14
1ca8f038fceb88c640badf9bd18905205bc63b43 jdk-9+177
c1f3649a3a42f124b418a5a916dbad13d059b757 jdk-10+15
2fe2a593e8ebf3a9e4dcd9ba3333a7b43126589d jdk-10+16
9d032191f82fca5ba0aac98682f69c4ff0f1283d jdk-9+178
d2661aa42bff322badbe6c1337fc638d2e0f5730 jdk-9+179
73e2cb8700bfa51304bd4b02f224620859a3f600 jdk-10+17

@ -14394,7 +14394,7 @@ instruct compL_reg_reg(rFlagsReg cr, iRegL op1, iRegL op2)
ins_pipe(icmp_reg_reg);
%}
instruct compL_reg_immI0(rFlagsReg cr, iRegL op1, immI0 zero)
instruct compL_reg_immL0(rFlagsReg cr, iRegL op1, immL0 zero)
%{
match(Set cr (CmpL op1 zero));
@ -14436,6 +14436,62 @@ instruct compL_reg_immL(rFlagsReg cr, iRegL op1, immL op2)
ins_pipe(icmp_reg_imm);
%}
instruct compUL_reg_reg(rFlagsRegU cr, iRegL op1, iRegL op2)
%{
match(Set cr (CmpUL op1 op2));
effect(DEF cr, USE op1, USE op2);
ins_cost(INSN_COST);
format %{ "cmp $op1, $op2" %}
ins_encode(aarch64_enc_cmp(op1, op2));
ins_pipe(icmp_reg_reg);
%}
instruct compUL_reg_immL0(rFlagsRegU cr, iRegL op1, immL0 zero)
%{
match(Set cr (CmpUL op1 zero));
effect(DEF cr, USE op1);
ins_cost(INSN_COST);
format %{ "tst $op1" %}
ins_encode(aarch64_enc_cmp_imm_addsub(op1, zero));
ins_pipe(icmp_reg_imm);
%}
instruct compUL_reg_immLAddSub(rFlagsRegU cr, iRegL op1, immLAddSub op2)
%{
match(Set cr (CmpUL op1 op2));
effect(DEF cr, USE op1);
ins_cost(INSN_COST);
format %{ "cmp $op1, $op2" %}
ins_encode(aarch64_enc_cmp_imm_addsub(op1, op2));
ins_pipe(icmp_reg_imm);
%}
instruct compUL_reg_immL(rFlagsRegU cr, iRegL op1, immL op2)
%{
match(Set cr (CmpUL op1 op2));
effect(DEF cr, USE op1);
ins_cost(INSN_COST * 2);
format %{ "cmp $op1, $op2" %}
ins_encode(aarch64_enc_cmp_imm(op1, op2));
ins_pipe(icmp_reg_imm);
%}
instruct compP_reg_reg(rFlagsRegU cr, iRegP op1, iRegP op2)
%{
match(Set cr (CmpP op1 op2));
@ -14920,7 +14976,7 @@ instruct cmpUI_imm0_branch(cmpOpUEqNeLtGe cmp, iRegIorL2I op1, immI0 op2, label
%}
instruct cmpUL_imm0_branch(cmpOpUEqNeLtGe cmp, iRegL op1, immL0 op2, label labl, rFlagsRegU cr) %{
match(If cmp (CmpU op1 op2));
match(If cmp (CmpUL op1 op2));
effect(USE labl);
ins_cost(BRANCH_COST);

@ -49,12 +49,11 @@ define_pd_global(intx, ConditionalMoveLimit, 3);
define_pd_global(intx, FLOATPRESSURE, 64);
define_pd_global(intx, FreqInlineSize, 325);
define_pd_global(intx, MinJumpTableSize, 10);
define_pd_global(intx, INTPRESSURE, 25);
define_pd_global(intx, INTPRESSURE, 24);
define_pd_global(intx, InteriorEntryAlignment, 16);
define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K));
define_pd_global(intx, LoopUnrollLimit, 60);
define_pd_global(intx, LoopPercentProfileLimit, 10);
define_pd_global(intx, PostLoopMultiversioning, false);
// InitialCodeCacheSize derived from specjbb2000 run.
define_pd_global(intx, InitialCodeCacheSize, 2496*K); // Integral multiple of CodeCacheExpansionSize
define_pd_global(intx, CodeCacheExpansionSize, 64*K);

@ -2695,6 +2695,30 @@ operand flagsRegL_LEGT() %{
format %{ "apsr_L_LEGT" %}
interface(REG_INTER);
%}
operand flagsRegUL_LTGE() %{
constraint(ALLOC_IN_RC(int_flags));
match(RegFlags);
format %{ "apsr_UL_LTGE" %}
interface(REG_INTER);
%}
operand flagsRegUL_EQNE() %{
constraint(ALLOC_IN_RC(int_flags));
match(RegFlags);
format %{ "apsr_UL_EQNE" %}
interface(REG_INTER);
%}
operand flagsRegUL_LEGT() %{
constraint(ALLOC_IN_RC(int_flags));
match(RegFlags);
format %{ "apsr_UL_LEGT" %}
interface(REG_INTER);
%}
#endif
// Condition Code Register, floating comparisons, unordered same as "less".
@ -3249,6 +3273,39 @@ operand cmpOpL_commute() %{
%}
%}
operand cmpOpUL() %{
match(Bool);
format %{ "UL" %}
interface(COND_INTER) %{
equal(0x0);
not_equal(0x1);
less(0x3);
greater_equal(0x2);
less_equal(0x9);
greater(0x8);
overflow(0x0); // unsupported/unimplemented
no_overflow(0x0); // unsupported/unimplemented
%}
%}
operand cmpOpUL_commute() %{
match(Bool);
format %{ "UL" %}
interface(COND_INTER) %{
equal(0x0);
not_equal(0x1);
less(0x8);
greater_equal(0x9);
less_equal(0x2);
greater(0x3);
overflow(0x0); // unsupported/unimplemented
no_overflow(0x0); // unsupported/unimplemented
%}
%}
//----------OPERAND CLASSES----------------------------------------------------
// Operand Classes are groups of operands that are used to simplify
// instruction definitions by not requiring the AD writer to specify separate
@ -10467,6 +10524,17 @@ instruct compL_reg_reg(flagsReg xcc, iRegL op1, iRegL op2)
%}
ins_pipe(ialu_cconly_reg_reg);
%}
instruct compUL_iReg(flagsRegU xcc, iRegL op1, iRegL op2) %{
match(Set xcc (CmpUL op1 op2));
size(4);
format %{ "CMP $op1,$op2\t! unsigned long" %}
ins_encode %{
__ cmp($op1$$Register, $op2$$Register);
%}
ins_pipe(ialu_cconly_reg_reg);
%}
#else
instruct compL_reg_reg_LTGE(flagsRegL_LTGE xcc, iRegL op1, iRegL op2, iRegL tmp) %{
match(Set xcc (CmpL op1 op2));
@ -10481,6 +10549,20 @@ instruct compL_reg_reg_LTGE(flagsRegL_LTGE xcc, iRegL op1, iRegL op2, iRegL tmp)
%}
ins_pipe(ialu_cconly_reg_reg);
%}
instruct compUL_reg_reg_LTGE(flagsRegUL_LTGE xcc, iRegL op1, iRegL op2, iRegL tmp) %{
match(Set xcc (CmpUL op1 op2));
effect(DEF xcc, USE op1, USE op2, TEMP tmp);
size(8);
format %{ "SUBS $tmp,$op1.low,$op2.low\t\t! unsigned long\n\t"
"SBCS $tmp,$op1.hi,$op2.hi" %}
ins_encode %{
__ subs($tmp$$Register, $op1$$Register, $op2$$Register);
__ sbcs($tmp$$Register->successor(), $op1$$Register->successor(), $op2$$Register->successor());
%}
ins_pipe(ialu_cconly_reg_reg);
%}
#endif
#ifdef AARCH64
@ -10496,6 +10578,19 @@ instruct compL_reg_con(flagsReg xcc, iRegL op1, aimmL con) %{
ins_pipe(ialu_cconly_reg_imm);
%}
instruct compUL_reg_con(flagsRegU xcc, iRegL op1, aimmL con) %{
match(Set xcc (CmpUL op1 con));
effect(DEF xcc, USE op1, USE con);
size(8);
format %{ "CMP $op1,$con\t\t! unsigned long" %}
ins_encode %{
__ cmp($op1$$Register, $con$$constant);
%}
ins_pipe(ialu_cconly_reg_imm);
%}
#else
instruct compL_reg_reg_EQNE(flagsRegL_EQNE xcc, iRegL op1, iRegL op2) %{
match(Set xcc (CmpL op1 op2));
@ -10575,6 +10670,85 @@ instruct compL_reg_con_LEGT(flagsRegL_LEGT xcc, iRegL op1, immLlowRot con, iRegL
ins_pipe(ialu_cconly_reg_reg);
%}
instruct compUL_reg_reg_EQNE(flagsRegUL_EQNE xcc, iRegL op1, iRegL op2) %{
match(Set xcc (CmpUL op1 op2));
effect(DEF xcc, USE op1, USE op2);
size(8);
format %{ "TEQ $op1.hi,$op2.hi\t\t! unsigned long\n\t"
"TEQ.eq $op1.lo,$op2.lo" %}
ins_encode %{
__ teq($op1$$Register->successor(), $op2$$Register->successor());
__ teq($op1$$Register, $op2$$Register, eq);
%}
ins_pipe(ialu_cconly_reg_reg);
%}
instruct compUL_reg_reg_LEGT(flagsRegUL_LEGT xcc, iRegL op1, iRegL op2, iRegL tmp) %{
match(Set xcc (CmpUL op1 op2));
effect(DEF xcc, USE op1, USE op2, TEMP tmp);
size(8);
format %{ "SUBS $tmp,$op2.low,$op1.low\t\t! unsigned long\n\t"
"SBCS $tmp,$op2.hi,$op1.hi" %}
ins_encode %{
__ subs($tmp$$Register, $op2$$Register, $op1$$Register);
__ sbcs($tmp$$Register->successor(), $op2$$Register->successor(), $op1$$Register->successor());
%}
ins_pipe(ialu_cconly_reg_reg);
%}
// TODO: try immLRot2 instead, (0, $con$$constant) becomes
// (hi($con$$constant), lo($con$$constant)) becomes
instruct compUL_reg_con_LTGE(flagsRegUL_LTGE xcc, iRegL op1, immLlowRot con, iRegL tmp) %{
match(Set xcc (CmpUL op1 con));
effect(DEF xcc, USE op1, USE con, TEMP tmp);
size(8);
format %{ "SUBS $tmp,$op1.low,$con\t\t! unsigned long\n\t"
"SBCS $tmp,$op1.hi,0" %}
ins_encode %{
__ subs($tmp$$Register, $op1$$Register, $con$$constant);
__ sbcs($tmp$$Register->successor(), $op1$$Register->successor(), 0);
%}
ins_pipe(ialu_cconly_reg_reg);
%}
// TODO: try immLRot2 instead, (0, $con$$constant) becomes
// (hi($con$$constant), lo($con$$constant)) becomes
instruct compUL_reg_con_EQNE(flagsRegUL_EQNE xcc, iRegL op1, immLlowRot con) %{
match(Set xcc (CmpUL op1 con));
effect(DEF xcc, USE op1, USE con);
size(8);
format %{ "TEQ $op1.hi,0\t\t! unsigned long\n\t"
"TEQ.eq $op1.lo,$con" %}
ins_encode %{
__ teq($op1$$Register->successor(), 0);
__ teq($op1$$Register, $con$$constant, eq);
%}
ins_pipe(ialu_cconly_reg_reg);
%}
// TODO: try immLRot2 instead, (0, $con$$constant) becomes
// (hi($con$$constant), lo($con$$constant)) becomes
instruct compUL_reg_con_LEGT(flagsRegUL_LEGT xcc, iRegL op1, immLlowRot con, iRegL tmp) %{
match(Set xcc (CmpUL op1 con));
effect(DEF xcc, USE op1, USE con, TEMP tmp);
size(8);
format %{ "RSBS $tmp,$op1.low,$con\t\t! unsigned long\n\t"
"RSCS $tmp,$op1.hi,0" %}
ins_encode %{
__ rsbs($tmp$$Register, $op1$$Register, $con$$constant);
__ rscs($tmp$$Register->successor(), $op1$$Register->successor(), 0);
%}
ins_pipe(ialu_cconly_reg_reg);
%}
#endif
/* instruct testL_reg_reg(flagsRegL xcc, iRegL op1, iRegL op2, immL0 zero) %{ */
@ -11126,6 +11300,48 @@ instruct branchConL_LEGT(cmpOpL_commute cmp, flagsRegL_LEGT xcc, label labl) %{
%}
ins_pipe(br_cc);
%}
instruct branchConUL_LTGE(cmpOpUL cmp, flagsRegUL_LTGE xcc, label labl) %{
match(If cmp xcc);
effect(USE labl);
predicate(_kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt || _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ge);
size(4);
ins_cost(BRANCH_COST);
format %{ "B$cmp $xcc,$labl" %}
ins_encode %{
__ b(*($labl$$label), (AsmCondition)($cmp$$cmpcode));
%}
ins_pipe(br_cc);
%}
instruct branchConUL_EQNE(cmpOpUL cmp, flagsRegUL_EQNE xcc, label labl) %{
match(If cmp xcc);
effect(USE labl);
predicate(_kids[0]->_leaf->as_Bool()->_test._test == BoolTest::eq || _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne);
size(4);
ins_cost(BRANCH_COST);
format %{ "B$cmp $xcc,$labl" %}
ins_encode %{
__ b(*($labl$$label), (AsmCondition)($cmp$$cmpcode));
%}
ins_pipe(br_cc);
%}
instruct branchConUL_LEGT(cmpOpUL_commute cmp, flagsRegUL_LEGT xcc, label labl) %{
match(If cmp xcc);
effect(USE labl);
predicate(_kids[0]->_leaf->as_Bool()->_test._test == BoolTest::gt || _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::le);
size(4);
ins_cost(BRANCH_COST);
format %{ "B$cmp $xcc,$labl" %}
ins_encode %{
__ b(*($labl$$label), (AsmCondition)($cmp$$cmpcode));
%}
ins_pipe(br_cc);
%}
#endif
instruct branchLoopEnd(cmpOp cmp, flagsReg icc, label labl) %{

@ -70,7 +70,6 @@ define_pd_global(bool, UseTLAB, true);
define_pd_global(bool, ResizeTLAB, true);
define_pd_global(intx, LoopUnrollLimit, 60); // Design center runs on 1.3.1
define_pd_global(intx, LoopPercentProfileLimit, 10);
define_pd_global(intx, PostLoopMultiversioning, false);
define_pd_global(intx, MinJumpTableSize, 16);
// Peephole and CISC spilling both break the graph, and so makes the

@ -55,7 +55,6 @@ define_pd_global(bool, UseTLAB, true);
define_pd_global(bool, ResizeTLAB, true);
define_pd_global(intx, LoopUnrollLimit, 60);
define_pd_global(intx, LoopPercentProfileLimit, 10);
define_pd_global(intx, PostLoopMultiversioning, false);
// Peephole and CISC spilling both break the graph, and so make the
// scheduler sick.

@ -11048,6 +11048,29 @@ instruct cmpL_reg_imm16(flagsReg crx, iRegLsrc src1, immL16 src2) %{
ins_pipe(pipe_class_compare);
%}
// Added CmpUL for LoopPredicate.
instruct cmpUL_reg_reg(flagsReg crx, iRegLsrc src1, iRegLsrc src2) %{
match(Set crx (CmpUL src1 src2));
format %{ "CMPLD $crx, $src1, $src2" %}
size(4);
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
__ cmpld($crx$$CondRegister, $src1$$Register, $src2$$Register);
%}
ins_pipe(pipe_class_compare);
%}
instruct cmpUL_reg_imm16(flagsReg crx, iRegLsrc src1, uimmL16 src2) %{
match(Set crx (CmpUL src1 src2));
format %{ "CMPLDI $crx, $src1, $src2" %}
size(4);
ins_encode %{
// TODO: PPC port $archOpcode(ppc64Opcode_cmpli);
__ cmpldi($crx$$CondRegister, $src1$$Register, $src2$$constant);
%}
ins_pipe(pipe_class_compare);
%}
instruct testL_reg_reg(flagsRegCR0 cr0, iRegLsrc src1, iRegLsrc src2, immL_0 zero) %{
match(Set cr0 (CmpL (AndL src1 src2) zero));
// r0 is killed

@ -56,7 +56,6 @@ define_pd_global(bool, UseTLAB, true);
define_pd_global(bool, ResizeTLAB, true);
define_pd_global(intx, LoopUnrollLimit, 60);
define_pd_global(intx, LoopPercentProfileLimit, 10);
define_pd_global(intx, PostLoopMultiversioning, false);
define_pd_global(intx, MinJumpTableSize, 18);
// Peephole and CISC spilling both break the graph, and so makes the

@ -8475,6 +8475,24 @@ instruct compL_reg_memI(iRegL dst, memory src, flagsReg cr)%{
%}
// LONG unsigned
// Added CmpUL for LoopPredicate.
instruct compUL_reg_reg(flagsReg cr, iRegL op1, iRegL op2) %{
match(Set cr (CmpUL op1 op2));
size(4);
format %{ "CLGR $op1,$op2\t # long" %}
opcode(CLGR_ZOPC);
ins_encode(z_rreform(op1, op2));
ins_pipe(pipe_class_dummy);
%}
instruct compUL_reg_imm32(flagsReg cr, iRegL op1, uimmL32 con) %{
match(Set cr (CmpUL op1 con));
size(6);
format %{ "CLGFI $op1,$con" %}
opcode(CLGFI_ZOPC);
ins_encode(z_rilform_unsigned(op1, con));
ins_pipe(pipe_class_dummy);
%}
// PTR unsigned

@ -53,7 +53,6 @@ define_pd_global(bool, UseTLAB, true);
define_pd_global(bool, ResizeTLAB, true);
define_pd_global(intx, LoopUnrollLimit, 60); // Design center runs on 1.3.1
define_pd_global(intx, LoopPercentProfileLimit, 10);
define_pd_global(intx, PostLoopMultiversioning, false);
define_pd_global(intx, MinJumpTableSize, 5);
// Peephole and CISC spilling both break the graph, and so makes the

@ -3403,6 +3403,16 @@ operand immU12() %{
interface(CONST_INTER);
%}
// Unsigned Long Immediate: 12-bit (non-negative that fits in simm13)
operand immUL12() %{
predicate((0 <= n->get_long()) && (n->get_long() == (int)n->get_long()) && Assembler::is_simm13((int)n->get_long()));
match(ConL);
op_cost(0);
format %{ %}
interface(CONST_INTER);
%}
// Integer Immediate non-negative
operand immU31()
%{
@ -3936,6 +3946,15 @@ operand flagsRegL() %{
interface(REG_INTER);
%}
// Condition Code Register, unsigned long comparisons.
operand flagsRegUL() %{
constraint(ALLOC_IN_RC(int_flags));
match(RegFlags);
format %{ "xcc_UL" %}
interface(REG_INTER);
%}
// Condition Code Register, floating comparisons, unordered same as "less".
operand flagsRegF() %{
constraint(ALLOC_IN_RC(float_flags));
@ -8797,6 +8816,17 @@ instruct compU_iReg(flagsRegU icc, iRegI op1, iRegI op2) %{
ins_pipe(ialu_cconly_reg_reg);
%}
instruct compUL_iReg(flagsRegUL xcc, iRegL op1, iRegL op2) %{
match(Set xcc (CmpUL op1 op2));
effect(DEF xcc, USE op1, USE op2);
size(4);
format %{ "CMP $op1,$op2\t! unsigned long" %}
opcode(Assembler::subcc_op3, Assembler::arith_op);
ins_encode(form3_rs1_rs2_rd(op1, op2, R_G0));
ins_pipe(ialu_cconly_reg_reg);
%}
instruct compI_iReg_imm13(flagsReg icc, iRegI op1, immI13 op2) %{
match(Set icc (CmpI op1 op2));
effect( DEF icc, USE op1 );
@ -8883,6 +8913,17 @@ instruct compU_iReg_imm13(flagsRegU icc, iRegI op1, immU12 op2 ) %{
ins_pipe(ialu_cconly_reg_imm);
%}
instruct compUL_iReg_imm13(flagsRegUL xcc, iRegL op1, immUL12 op2) %{
match(Set xcc (CmpUL op1 op2));
effect(DEF xcc, USE op1, USE op2);
size(4);
format %{ "CMP $op1,$op2\t! unsigned long" %}
opcode(Assembler::subcc_op3, Assembler::arith_op);
ins_encode(form3_rs1_simm13_rd(op1, op2, R_G0));
ins_pipe(ialu_cconly_reg_imm);
%}
// Compare Pointers
instruct compP_iRegP(flagsRegP pcc, iRegP op1, iRegP op2 ) %{
match(Set pcc (CmpP op1 op2));
@ -9256,6 +9297,44 @@ instruct cmpU_imm_branch(cmpOpU cmp, iRegI op1, immI5 op2, label labl, flagsRegU
ins_pipe(cmp_br_reg_imm);
%}
instruct cmpUL_reg_branch(cmpOpU cmp, iRegL op1, iRegL op2, label labl, flagsRegUL xcc) %{
match(If cmp (CmpUL op1 op2));
effect(USE labl, KILL xcc);
size(12);
ins_cost(BRANCH_COST);
format %{ "CMP $op1,$op2\t! unsigned long\n\t"
"BP$cmp $labl" %}
ins_encode %{
Label* L = $labl$$label;
Assembler::Predict predict_taken =
cbuf.is_backward_branch(*L) ? Assembler::pt : Assembler::pn;
__ cmp($op1$$Register, $op2$$Register);
__ bp((Assembler::Condition)($cmp$$cmpcode), false, Assembler::xcc, predict_taken, *L);
__ delayed()->nop();
%}
ins_pipe(cmp_br_reg_reg);
%}
instruct cmpUL_imm_branch(cmpOpU cmp, iRegL op1, immL5 op2, label labl, flagsRegUL xcc) %{
match(If cmp (CmpUL op1 op2));
effect(USE labl, KILL xcc);
size(12);
ins_cost(BRANCH_COST);
format %{ "CMP $op1,$op2\t! unsigned long\n\t"
"BP$cmp $labl" %}
ins_encode %{
Label* L = $labl$$label;
Assembler::Predict predict_taken =
cbuf.is_backward_branch(*L) ? Assembler::pt : Assembler::pn;
__ cmp($op1$$Register, $op2$$constant);
__ bp((Assembler::Condition)($cmp$$cmpcode), false, Assembler::xcc, predict_taken, *L);
__ delayed()->nop();
%}
ins_pipe(cmp_br_reg_imm);
%}
instruct cmpL_reg_branch(cmpOp cmp, iRegL op1, iRegL op2, label labl, flagsRegL xcc) %{
match(If cmp (CmpL op1 op2));
effect(USE labl, KILL xcc);
@ -9484,6 +9563,42 @@ instruct cmpU_imm_branch_short(cmpOpU cmp, iRegI op1, immI5 op2, label labl, fla
ins_pipe(cbcond_reg_imm);
%}
instruct cmpUL_reg_branch_short(cmpOpU cmp, iRegL op1, iRegL op2, label labl, flagsRegUL xcc) %{
match(If cmp (CmpUL op1 op2));
predicate(UseCBCond);
effect(USE labl, KILL xcc);
size(4);
ins_cost(BRANCH_COST);
format %{ "CXB$cmp $op1,$op2,$labl\t! unsigned long" %}
ins_encode %{
Label* L = $labl$$label;
assert(__ use_cbcond(*L), "back to back cbcond");
__ cbcond((Assembler::Condition)($cmp$$cmpcode), Assembler::xcc, $op1$$Register, $op2$$Register, *L);
%}
ins_short_branch(1);
ins_avoid_back_to_back(AVOID_BEFORE_AND_AFTER);
ins_pipe(cbcond_reg_reg);
%}
instruct cmpUL_imm_branch_short(cmpOpU cmp, iRegL op1, immL5 op2, label labl, flagsRegUL xcc) %{
match(If cmp (CmpUL op1 op2));
predicate(UseCBCond);
effect(USE labl, KILL xcc);
size(4);
ins_cost(BRANCH_COST);
format %{ "CXB$cmp $op1,$op2,$labl\t! unsigned long" %}
ins_encode %{
Label* L = $labl$$label;
assert(__ use_cbcond(*L), "back to back cbcond");
__ cbcond((Assembler::Condition)($cmp$$cmpcode), Assembler::xcc, $op1$$Register, $op2$$constant, *L);
%}
ins_short_branch(1);
ins_avoid_back_to_back(AVOID_BEFORE_AND_AFTER);
ins_pipe(cbcond_reg_imm);
%}
instruct cmpL_reg_branch_short(cmpOp cmp, iRegL op1, iRegL op2, label labl, flagsRegL xcc) %{
match(If cmp (CmpL op1 op2));
predicate(UseCBCond);
@ -9722,6 +9837,25 @@ instruct branchCon_long(cmpOp cmp, flagsRegL xcc, label labl) %{
ins_pipe(br_cc);
%}
instruct branchConU_long(cmpOpU cmp, flagsRegUL xcc, label labl) %{
match(If cmp xcc);
effect(USE labl);
size(8);
ins_cost(BRANCH_COST);
format %{ "BP$cmp $xcc,$labl" %}
ins_encode %{
Label* L = $labl$$label;
Assembler::Predict predict_taken =
cbuf.is_backward_branch(*L) ? Assembler::pt : Assembler::pn;
__ bp((Assembler::Condition)($cmp$$cmpcode), false, Assembler::xcc, predict_taken, *L);
__ delayed()->nop();
%}
ins_avoid_back_to_back(AVOID_BEFORE);
ins_pipe(br_cc);
%}
// Manifest a CmpL3 result in an integer register. Very painful.
// This is the test to avoid.
instruct cmpL3_reg_reg(iRegI dst, iRegL src1, iRegL src2, flagsReg ccr ) %{

@ -47,7 +47,6 @@ define_pd_global(intx, ConditionalMoveLimit, 3);
define_pd_global(intx, FreqInlineSize, 325);
define_pd_global(intx, MinJumpTableSize, 10);
define_pd_global(intx, LoopPercentProfileLimit, 30);
define_pd_global(intx, PostLoopMultiversioning, true);
#ifdef AMD64
define_pd_global(intx, INTPRESSURE, 13);
define_pd_global(intx, FLOATPRESSURE, 14);

@ -116,7 +116,7 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
product(bool, UseStoreImmI16, true, \
"Use store immediate 16-bits value instruction on x86") \
\
product(intx, UseAVX, 99, \
product(intx, UseAVX, 2, \
"Highest supported AVX instructions set on x86/x64") \
range(0, 99) \
\

@ -4030,6 +4030,26 @@ operand flagsReg_long_LEGT() %{
interface(REG_INTER);
%}
// Condition Code Register used by unsigned long compare
operand flagsReg_ulong_LTGE() %{
constraint(ALLOC_IN_RC(int_flags));
match(RegFlags);
format %{ "FLAGS_U_LTGE" %}
interface(REG_INTER);
%}
operand flagsReg_ulong_EQNE() %{
constraint(ALLOC_IN_RC(int_flags));
match(RegFlags);
format %{ "FLAGS_U_EQNE" %}
interface(REG_INTER);
%}
operand flagsReg_ulong_LEGT() %{
constraint(ALLOC_IN_RC(int_flags));
match(RegFlags);
format %{ "FLAGS_U_LEGT" %}
interface(REG_INTER);
%}
// Float register operands
operand regDPR() %{
predicate( UseSSE < 2 );
@ -4588,7 +4608,7 @@ operand cmpOp_fcmov() %{
%}
%}
// Comparision Code used in long compares
// Comparison Code used in long compares
operand cmpOp_commute() %{
match(Bool);
@ -4605,6 +4625,23 @@ operand cmpOp_commute() %{
%}
%}
// Comparison Code used in unsigned long compares
operand cmpOpU_commute() %{
match(Bool);
format %{ "" %}
interface(COND_INTER) %{
equal(0x4, "e");
not_equal(0x5, "ne");
less(0x7, "nbe");
greater_equal(0x6, "be");
less_equal(0x3, "nb");
greater(0x2, "b");
overflow(0x0, "o");
no_overflow(0x1, "no");
%}
%}
//----------OPERAND CLASSES----------------------------------------------------
// Operand Classes are groups of operands that are used as to simplify
// instruction definitions by not requiring the AD writer to specify separate
@ -12639,6 +12676,44 @@ instruct cmpL_LTGE(cmpOp cmp, flagsReg_long_LTGE flags, label labl) %{
%}
%}
//======
// Manifest a CmpUL result in the normal flags. Only good for LT or GE
// compares. Can be used for LE or GT compares by reversing arguments.
// NOT GOOD FOR EQ/NE tests.
instruct cmpUL_zero_flags_LTGE(flagsReg_ulong_LTGE flags, eRegL src, immL0 zero) %{
match(Set flags (CmpUL src zero));
ins_cost(100);
format %{ "TEST $src.hi,$src.hi" %}
opcode(0x85);
ins_encode(OpcP, RegReg_Hi2(src, src));
ins_pipe(ialu_cr_reg_reg);
%}
// Manifest a CmpUL result in the normal flags. Only good for LT or GE
// compares. Can be used for LE or GT compares by reversing arguments.
// NOT GOOD FOR EQ/NE tests.
instruct cmpUL_reg_flags_LTGE(flagsReg_ulong_LTGE flags, eRegL src1, eRegL src2, rRegI tmp) %{
match(Set flags (CmpUL src1 src2));
effect(TEMP tmp);
ins_cost(300);
format %{ "CMP $src1.lo,$src2.lo\t! Unsigned long compare; set flags for low bits\n\t"
"MOV $tmp,$src1.hi\n\t"
"SBB $tmp,$src2.hi\t! Compute flags for unsigned long compare" %}
ins_encode(long_cmp_flags2(src1, src2, tmp));
ins_pipe(ialu_cr_reg_reg);
%}
// Unsigned long compares reg < zero/req OR reg >= zero/req.
// Just a wrapper for a normal branch, plus the predicate test.
instruct cmpUL_LTGE(cmpOpU cmp, flagsReg_ulong_LTGE flags, label labl) %{
match(If cmp flags);
effect(USE labl);
predicate(_kids[0]->_leaf->as_Bool()->_test._test == BoolTest::lt || _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ge);
expand %{
jmpCon(cmp, flags, labl); // JLT or JGE...
%}
%}
// Compare 2 longs and CMOVE longs.
instruct cmovLL_reg_LTGE(cmpOp cmp, flagsReg_long_LTGE flags, eRegL dst, eRegL src) %{
match(Set dst (CMoveL (Binary cmp flags) (Binary dst src)));
@ -12767,6 +12842,41 @@ instruct cmpL_EQNE(cmpOp cmp, flagsReg_long_EQNE flags, label labl) %{
%}
%}
//======
// Manifest a CmpUL result in the normal flags. Only good for EQ/NE compares.
instruct cmpUL_zero_flags_EQNE(flagsReg_ulong_EQNE flags, eRegL src, immL0 zero, rRegI tmp) %{
match(Set flags (CmpUL src zero));
effect(TEMP tmp);
ins_cost(200);
format %{ "MOV $tmp,$src.lo\n\t"
"OR $tmp,$src.hi\t! Unsigned long is EQ/NE 0?" %}
ins_encode(long_cmp_flags0(src, tmp));
ins_pipe(ialu_reg_reg_long);
%}
// Manifest a CmpUL result in the normal flags. Only good for EQ/NE compares.
instruct cmpUL_reg_flags_EQNE(flagsReg_ulong_EQNE flags, eRegL src1, eRegL src2) %{
match(Set flags (CmpUL src1 src2));
ins_cost(200+300);
format %{ "CMP $src1.lo,$src2.lo\t! Unsigned long compare; set flags for low bits\n\t"
"JNE,s skip\n\t"
"CMP $src1.hi,$src2.hi\n\t"
"skip:\t" %}
ins_encode(long_cmp_flags1(src1, src2));
ins_pipe(ialu_cr_reg_reg);
%}
// Unsigned long compare reg == zero/reg OR reg != zero/reg
// Just a wrapper for a normal branch, plus the predicate test.
instruct cmpUL_EQNE(cmpOpU cmp, flagsReg_ulong_EQNE flags, label labl) %{
match(If cmp flags);
effect(USE labl);
predicate(_kids[0]->_leaf->as_Bool()->_test._test == BoolTest::eq || _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne);
expand %{
jmpCon(cmp, flags, labl); // JEQ or JNE...
%}
%}
// Compare 2 longs and CMOVE longs.
instruct cmovLL_reg_EQNE(cmpOp cmp, flagsReg_long_EQNE flags, eRegL dst, eRegL src) %{
match(Set dst (CMoveL (Binary cmp flags) (Binary dst src)));
@ -12900,6 +13010,46 @@ instruct cmpL_LEGT(cmpOp_commute cmp, flagsReg_long_LEGT flags, label labl) %{
%}
%}
//======
// Manifest a CmpUL result in the normal flags. Only good for LE or GT compares.
// Same as cmpUL_reg_flags_LEGT except must negate src
instruct cmpUL_zero_flags_LEGT(flagsReg_ulong_LEGT flags, eRegL src, immL0 zero, rRegI tmp) %{
match(Set flags (CmpUL src zero));
effect(TEMP tmp);
ins_cost(300);
format %{ "XOR $tmp,$tmp\t# Unsigned long compare for -$src < 0, use commuted test\n\t"
"CMP $tmp,$src.lo\n\t"
"SBB $tmp,$src.hi\n\t" %}
ins_encode(long_cmp_flags3(src, tmp));
ins_pipe(ialu_reg_reg_long);
%}
// Manifest a CmpUL result in the normal flags. Only good for LE or GT compares.
// Same as cmpUL_reg_flags_LTGE except operands swapped. Swapping operands
// requires a commuted test to get the same result.
instruct cmpUL_reg_flags_LEGT(flagsReg_ulong_LEGT flags, eRegL src1, eRegL src2, rRegI tmp) %{
match(Set flags (CmpUL src1 src2));
effect(TEMP tmp);
ins_cost(300);
format %{ "CMP $src2.lo,$src1.lo\t! Unsigned long compare, swapped operands, use with commuted test\n\t"
"MOV $tmp,$src2.hi\n\t"
"SBB $tmp,$src1.hi\t! Compute flags for unsigned long compare" %}
ins_encode(long_cmp_flags2( src2, src1, tmp));
ins_pipe(ialu_cr_reg_reg);
%}
// Unsigned long compares reg < zero/req OR reg >= zero/req.
// Just a wrapper for a normal branch, plus the predicate test
instruct cmpUL_LEGT(cmpOpU_commute cmp, flagsReg_ulong_LEGT flags, label labl) %{
match(If cmp flags);
effect(USE labl);
predicate(_kids[0]->_leaf->as_Bool()->_test._test == BoolTest::gt || _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::le);
ins_cost(300);
expand %{
jmpCon(cmp, flags, labl); // JGT or JLE...
%}
%}
// Compare 2 longs and CMOVE longs.
instruct cmovLL_reg_LEGT(cmpOp_commute cmp, flagsReg_long_LEGT flags, eRegL dst, eRegL src) %{
match(Set dst (CMoveL (Binary cmp flags) (Binary dst src)));

@ -11518,6 +11518,48 @@ instruct cmpL3_reg_reg(rRegI dst, rRegL src1, rRegL src2, rFlagsReg flags)
ins_pipe(pipe_slow);
%}
// Unsigned long compare Instructions; really, same as signed long except they
// produce an rFlagsRegU instead of rFlagsReg.
instruct compUL_rReg(rFlagsRegU cr, rRegL op1, rRegL op2)
%{
match(Set cr (CmpUL op1 op2));
format %{ "cmpq $op1, $op2\t# unsigned" %}
opcode(0x3B); /* Opcode 3B /r */
ins_encode(REX_reg_reg_wide(op1, op2), OpcP, reg_reg(op1, op2));
ins_pipe(ialu_cr_reg_reg);
%}
instruct compUL_rReg_imm(rFlagsRegU cr, rRegL op1, immL32 op2)
%{
match(Set cr (CmpUL op1 op2));
format %{ "cmpq $op1, $op2\t# unsigned" %}
opcode(0x81, 0x07); /* Opcode 81 /7 */
ins_encode(OpcSErm_wide(op1, op2), Con8or32(op2));
ins_pipe(ialu_cr_reg_imm);
%}
instruct compUL_rReg_mem(rFlagsRegU cr, rRegL op1, memory op2)
%{
match(Set cr (CmpUL op1 (LoadL op2)));
format %{ "cmpq $op1, $op2\t# unsigned" %}
opcode(0x3B); /* Opcode 3B /r */
ins_encode(REX_reg_mem_wide(op1, op2), OpcP, reg_mem(op1, op2));
ins_pipe(ialu_cr_reg_mem);
%}
instruct testUL_reg(rFlagsRegU cr, rRegL src, immL0 zero)
%{
match(Set cr (CmpUL src zero));
format %{ "testq $src, $src\t# unsigned" %}
opcode(0x85);
ins_encode(REX_reg_reg_wide(src, src), OpcP, reg_reg(src, src));
ins_pipe(ialu_cr_reg_imm);
%}
//----------Max and Min--------------------------------------------------------
// Min Instructions

@ -23,6 +23,7 @@
package org.graalvm.compiler.hotspot;
import java.util.Formatter;
import java.util.Objects;
/**
* Mechanism for checking that the current Java runtime environment supports the minimum JVMCI API
@ -37,10 +38,11 @@ import java.util.Formatter;
class JVMCIVersionCheck {
private static final int JVMCI8_MIN_MAJOR_VERSION = 0;
private static final int JVMCI8_MIN_MINOR_VERSION = 23;
private static final int JVMCI8_MIN_MINOR_VERSION = 26;
// Will be updated once an ea build with the required JVMCI API is available.
private static final int JVMCI9_MIN_EA_BUILD = 143;
// MAX_VALUE indicates that no current EA version is compatible with Graal.
// Note: Keep README.md in sync with the EA version support checked here.
private static final int JVMCI9_MIN_EA_BUILD = 176;
private static void failVersionCheck(boolean exit, String reason, Object... args) {
Formatter errorMessage = new Formatter().format(reason, args);
@ -77,13 +79,27 @@ class JVMCIVersionCheck {
start += "-jvmci-".length();
int end = vmVersion.indexOf('.', start);
if (end > 0) {
int major = Integer.parseInt(vmVersion.substring(start, end));
int major;
try {
major = Integer.parseInt(vmVersion.substring(start, end));
} catch (NumberFormatException e) {
failVersionCheck(exitOnFailure, "The VM does not support the minimum JVMCI API version required by Graal.%n" +
"Cannot read JVMCI major version from java.vm.version property: %s.%n", vmVersion);
return;
}
start = end + 1;
end = start;
while (end < vmVersion.length() && Character.isDigit(vmVersion.charAt(end))) {
end++;
}
int minor = Integer.parseInt(vmVersion.substring(start, end));
int minor;
try {
minor = Integer.parseInt(vmVersion.substring(start, end));
} catch (NumberFormatException e) {
failVersionCheck(exitOnFailure, "The VM does not support the minimum JVMCI API version required by Graal.%n" +
"Cannot read JVMCI minor version from java.vm.version property: %s.%n", vmVersion);
return;
}
if (major >= JVMCI8_MIN_MAJOR_VERSION && minor >= JVMCI8_MIN_MINOR_VERSION) {
return;
}
@ -96,7 +112,7 @@ class JVMCIVersionCheck {
"Cannot read JVMCI version from java.vm.version property: %s.%n", vmVersion);
} else {
if (vmVersion.contains("SNAPSHOT")) {
// The snapshot of http://hg.openjdk.java.net/jdk9/hs tip is expected to work
// The snapshot of http://hg.openjdk.java.net/jdk9/dev tip is expected to work
return;
}
if (vmVersion.contains("internal")) {
@ -104,23 +120,36 @@ class JVMCIVersionCheck {
return;
}
// http://openjdk.java.net/jeps/223
// Only support EA builds until GA is available
if (vmVersion.startsWith("9-ea+")) {
int start = "9-ea+".length();
if (vmVersion.startsWith("9+")) {
int start = "9+".length();
int end = start;
end = start;
while (end < vmVersion.length() && Character.isDigit(vmVersion.charAt(end))) {
end++;
}
int build = Integer.parseInt(vmVersion.substring(start, end));
int build;
try {
build = Integer.parseInt(vmVersion.substring(start, end));
} catch (NumberFormatException e) {
failVersionCheck(exitOnFailure, "The VM does not support the minimum JVMCI API version required by Graal.%n" +
"Cannot read JDK9 EA build number from java.vm.version property: %s.%n", vmVersion);
return;
}
if (build >= JVMCI9_MIN_EA_BUILD) {
return;
}
failVersionCheck(exitOnFailure, "The VM is an insufficiently recent EA JDK9 build for Graal: %d < %d.%n", build, JVMCI9_MIN_EA_BUILD);
// Using Object.equals suppresses Eclipse's "Dead code" warning.
// Unfortunately @SuppressWarnings("unused") can only be applied at method level.
if (Objects.equals(JVMCI9_MIN_EA_BUILD, Integer.MAX_VALUE)) {
failVersionCheck(exitOnFailure, "This version of Graal is not compatible with any JDK 9 Early Access build.%n");
} else {
failVersionCheck(exitOnFailure, "The VM is an insufficiently recent EA JDK9 build for Graal: %d < %d.%n", build, JVMCI9_MIN_EA_BUILD);
}
return;
} else {
// Graal will be compatible with all JDK versions as of 9 GA
// until a JVMCI API change is made in a 9u or later release.
}
failVersionCheck(exitOnFailure, "The VM does not support the minimum JVMCI API version required by Graal.%n" +
"Cannot read JDK9 EA build number from java.vm.version property: %s.%n", vmVersion);
}
}

@ -1166,6 +1166,7 @@ void ArchDesc::buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp) {
|| strcmp(idealName,"CmpP") == 0
|| strcmp(idealName,"CmpN") == 0
|| strcmp(idealName,"CmpL") == 0
|| strcmp(idealName,"CmpUL") == 0
|| strcmp(idealName,"CmpD") == 0
|| strcmp(idealName,"CmpF") == 0
|| strcmp(idealName,"FastLock") == 0

@ -181,7 +181,7 @@
"Map number of unrolls for main loop via " \
"Superword Level Parallelism analysis") \
\
diagnostic_pd(bool, PostLoopMultiversioning, \
experimental(bool, PostLoopMultiversioning, false, \
"Multi versioned post loops to eliminate range checks") \
\
notproduct(bool, TraceSuperWordLoopUnrollAnalysis, false, \

@ -81,6 +81,7 @@ macro(CmpL3)
macro(CmpLTMask)
macro(CmpP)
macro(CmpU)
macro(CmpUL)
macro(CompareAndSwapB)
macro(CompareAndSwapS)
macro(CompareAndSwapI)

@ -29,6 +29,7 @@
#include "opto/connode.hpp"
#include "opto/convertnode.hpp"
#include "opto/loopnode.hpp"
#include "opto/matcher.hpp"
#include "opto/mulnode.hpp"
#include "opto/opaquenode.hpp"
#include "opto/rootnode.hpp"
@ -629,45 +630,138 @@ bool IdealLoopTree::is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invari
// max(scale*i + offset) = scale*init + offset
BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl,
int scale, Node* offset,
Node* init, Node* limit, Node* stride,
Node* range, bool upper) {
Node* init, Node* limit, jint stride,
Node* range, bool upper, bool &overflow) {
jint con_limit = limit->is_Con() ? limit->get_int() : 0;
jint con_init = init->is_Con() ? init->get_int() : 0;
jint con_offset = offset->is_Con() ? offset->get_int() : 0;
stringStream* predString = NULL;
if (TraceLoopPredicate) {
predString = new stringStream();
predString->print("rc_predicate ");
}
Node* max_idx_expr = init;
int stride_con = stride->get_int();
if ((stride_con > 0) == (scale > 0) == upper) {
// Limit is not exact.
// Calculate exact limit here.
// Note, counted loop's test is '<' or '>'.
limit = exact_limit(loop);
max_idx_expr = new SubINode(limit, stride);
overflow = false;
Node* max_idx_expr = NULL;
const TypeInt* idx_type = TypeInt::INT;
if ((stride > 0) == (scale > 0) == upper) {
if (TraceLoopPredicate) {
predString->print(limit->is_Con() ? "(%d " : "(limit ", con_limit);
predString->print("- %d) ", stride);
}
// Check if (limit - stride) may overflow
const TypeInt* limit_type = _igvn.type(limit)->isa_int();
jint limit_lo = limit_type->_lo;
jint limit_hi = limit_type->_hi;
if ((stride > 0 && (java_subtract(limit_lo, stride) < limit_lo)) ||
(stride < 0 && (java_subtract(limit_hi, stride) > limit_hi))) {
// No overflow possible
ConINode* con_stride = _igvn.intcon(stride);
set_ctrl(con_stride, C->root());
max_idx_expr = new SubINode(limit, con_stride);
idx_type = TypeInt::make(limit_lo - stride, limit_hi - stride, limit_type->_widen);
} else {
// May overflow
overflow = true;
limit = new ConvI2LNode(limit);
register_new_node(limit, ctrl);
ConLNode* con_stride = _igvn.longcon(stride);
set_ctrl(con_stride, C->root());
max_idx_expr = new SubLNode(limit, con_stride);
}
register_new_node(max_idx_expr, ctrl);
if (TraceLoopPredicate) predString->print("(limit - stride) ");
} else {
if (TraceLoopPredicate) predString->print("init ");
if (TraceLoopPredicate) {
predString->print(init->is_Con() ? "%d " : "init ", con_init);
}
idx_type = _igvn.type(init)->isa_int();
max_idx_expr = init;
}
if (scale != 1) {
ConNode* con_scale = _igvn.intcon(scale);
set_ctrl(con_scale, C->root());
max_idx_expr = new MulINode(max_idx_expr, con_scale);
if (TraceLoopPredicate) {
predString->print("* %d ", scale);
}
// Check if (scale * max_idx_expr) may overflow
const TypeInt* scale_type = TypeInt::make(scale);
MulINode* mul = new MulINode(max_idx_expr, con_scale);
idx_type = (TypeInt*)mul->mul_ring(idx_type, scale_type);
if (overflow || TypeInt::INT->higher_equal(idx_type)) {
// May overflow
mul->destruct();
if (!overflow) {
max_idx_expr = new ConvI2LNode(max_idx_expr);
register_new_node(max_idx_expr, ctrl);
}
overflow = true;
con_scale = _igvn.longcon(scale);
set_ctrl(con_scale, C->root());
max_idx_expr = new MulLNode(max_idx_expr, con_scale);
} else {
// No overflow possible
max_idx_expr = mul;
}
register_new_node(max_idx_expr, ctrl);
if (TraceLoopPredicate) predString->print("* %d ", scale);
}
if (offset && (!offset->is_Con() || offset->get_int() != 0)){
max_idx_expr = new AddINode(max_idx_expr, offset);
if (offset && (!offset->is_Con() || con_offset != 0)){
if (TraceLoopPredicate) {
predString->print(offset->is_Con() ? "+ %d " : "+ offset", con_offset);
}
// Check if (max_idx_expr + offset) may overflow
const TypeInt* offset_type = _igvn.type(offset)->isa_int();
jint lo = java_add(idx_type->_lo, offset_type->_lo);
jint hi = java_add(idx_type->_hi, offset_type->_hi);
if (overflow || (lo > hi) ||
((idx_type->_lo & offset_type->_lo) < 0 && lo >= 0) ||
((~(idx_type->_hi | offset_type->_hi)) < 0 && hi < 0)) {
// May overflow
if (!overflow) {
max_idx_expr = new ConvI2LNode(max_idx_expr);
register_new_node(max_idx_expr, ctrl);
}
overflow = true;
offset = new ConvI2LNode(offset);
register_new_node(offset, ctrl);
max_idx_expr = new AddLNode(max_idx_expr, offset);
} else {
// No overflow possible
max_idx_expr = new AddINode(max_idx_expr, offset);
}
register_new_node(max_idx_expr, ctrl);
if (TraceLoopPredicate)
if (offset->is_Con()) predString->print("+ %d ", offset->get_int());
else predString->print("+ offset ");
}
CmpUNode* cmp = new CmpUNode(max_idx_expr, range);
CmpNode* cmp = NULL;
if (overflow) {
// Integer expressions may overflow, do long comparison
range = new ConvI2LNode(range);
register_new_node(range, ctrl);
if (!Matcher::has_match_rule(Op_CmpUL)) {
// We don't support unsigned long comparisons. Set 'max_idx_expr'
// to max_julong if < 0 to make the signed comparison fail.
ConINode* sign_pos = _igvn.intcon(BitsPerLong - 1);
set_ctrl(sign_pos, C->root());
Node* sign_bit_mask = new RShiftLNode(max_idx_expr, sign_pos);
register_new_node(sign_bit_mask, ctrl);
// OR with sign bit to set all bits to 1 if negative (otherwise no change)
max_idx_expr = new OrLNode(max_idx_expr, sign_bit_mask);
register_new_node(max_idx_expr, ctrl);
// AND with 0x7ff... to unset the sign bit
ConLNode* remove_sign_mask = _igvn.longcon(max_jlong);
set_ctrl(remove_sign_mask, C->root());
max_idx_expr = new AndLNode(max_idx_expr, remove_sign_mask);
register_new_node(max_idx_expr, ctrl);
cmp = new CmpLNode(max_idx_expr, range);
} else {
cmp = new CmpULNode(max_idx_expr, range);
}
} else {
cmp = new CmpUNode(max_idx_expr, range);
}
register_new_node(cmp, ctrl);
BoolNode* bol = new BoolNode(cmp, BoolTest::lt);
register_new_node(bol, ctrl);
@ -814,28 +908,30 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
assert(ok, "must be index expression");
Node* init = cl->init_trip();
Node* limit = cl->limit();
Node* stride = cl->stride();
// Limit is not exact.
// Calculate exact limit here.
// Note, counted loop's test is '<' or '>'.
Node* limit = exact_limit(loop);
int stride = cl->stride()->get_int();
// Build if's for the upper and lower bound tests. The
// lower_bound test will dominate the upper bound test and all
// cloned or created nodes will use the lower bound test as
// their declared control.
ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate, iff->Opcode());
ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate, iff->Opcode());
assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
Node *ctrl = lower_bound_proj->in(0)->as_If()->in(0);
// Perform cloning to keep Invariance state correct since the
// late schedule will place invariant things in the loop.
Node *ctrl = predicate_proj->in(0)->as_If()->in(0);
rng = invar.clone(rng, ctrl);
if (offset && offset != zero) {
assert(invar.is_invariant(offset), "offset must be loop invariant");
offset = invar.clone(offset, ctrl);
}
// If predicate expressions may overflow in the integer range, longs are used.
bool overflow = false;
// Test the lower bound
BoolNode* lower_bound_bol = rc_predicate(loop, ctrl, scale, offset, init, limit, stride, rng, false);
BoolNode* lower_bound_bol = rc_predicate(loop, ctrl, scale, offset, init, limit, stride, rng, false, overflow);
// Negate test if necessary
bool negated = false;
if (proj->_con != predicate_proj->_con) {
@ -843,19 +939,22 @@ bool PhaseIdealLoop::loop_predication_impl(IdealLoopTree *loop) {
register_new_node(lower_bound_bol, ctrl);
negated = true;
}
ProjNode* lower_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate, overflow ? Op_If : iff->Opcode());
IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If();
_igvn.hash_delete(lower_bound_iff);
lower_bound_iff->set_req(1, lower_bound_bol);
if (TraceLoopPredicate) tty->print_cr("lower bound check if: %s %d ", negated ? " negated" : "", lower_bound_iff->_idx);
// Test the upper bound
BoolNode* upper_bound_bol = rc_predicate(loop, lower_bound_proj, scale, offset, init, limit, stride, rng, true);
BoolNode* upper_bound_bol = rc_predicate(loop, lower_bound_proj, scale, offset, init, limit, stride, rng, true, overflow);
negated = false;
if (proj->_con != predicate_proj->_con) {
upper_bound_bol = new BoolNode(upper_bound_bol->in(1), upper_bound_bol->_test.negate());
register_new_node(upper_bound_bol, ctrl);
negated = true;
}
ProjNode* upper_bound_proj = create_new_if_for_predicate(predicate_proj, NULL, Deoptimization::Reason_predicate, overflow ? Op_If : iff->Opcode());
assert(upper_bound_proj->in(0)->as_If()->in(0) == lower_bound_proj, "should dominate");
IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If();
_igvn.hash_delete(upper_bound_iff);
upper_bound_iff->set_req(1, upper_bound_bol);

@ -983,8 +983,8 @@ public:
// Construct a range check for a predicate if
BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl,
int scale, Node* offset,
Node* init, Node* limit, Node* stride,
Node* range, bool upper);
Node* init, Node* limit, jint stride,
Node* range, bool upper, bool &overflow);
// Implementation of the loop predication to promote checks outside the loop
bool loop_predication_impl(IdealLoopTree *loop);

@ -1982,6 +1982,7 @@ void Scheduling::AddNodeToAvailableList(Node *n) {
if( last->is_MachIf() && last->in(1) == n &&
( op == Op_CmpI ||
op == Op_CmpU ||
op == Op_CmpUL ||
op == Op_CmpP ||
op == Op_CmpF ||
op == Op_CmpD ||

@ -738,6 +738,60 @@ const Type *CmpLNode::sub( const Type *t1, const Type *t2 ) const {
return TypeInt::CC; // else use worst case results
}
// Simplify a CmpUL (compare 2 unsigned longs) node, based on local information.
// If both inputs are constants, compare them.
const Type* CmpULNode::sub(const Type* t1, const Type* t2) const {
assert(!t1->isa_ptr(), "obsolete usage of CmpUL");
// comparing two unsigned longs
const TypeLong* r0 = t1->is_long(); // Handy access
const TypeLong* r1 = t2->is_long();
// Current installed version
// Compare ranges for non-overlap
julong lo0 = r0->_lo;
julong hi0 = r0->_hi;
julong lo1 = r1->_lo;
julong hi1 = r1->_hi;
// If either one has both negative and positive values,
// it therefore contains both 0 and -1, and since [0..-1] is the
// full unsigned range, the type must act as an unsigned bottom.
bool bot0 = ((jlong)(lo0 ^ hi0) < 0);
bool bot1 = ((jlong)(lo1 ^ hi1) < 0);
if (bot0 || bot1) {
// All unsigned values are LE -1 and GE 0.
if (lo0 == 0 && hi0 == 0) {
return TypeInt::CC_LE; // 0 <= bot
} else if ((jlong)lo0 == -1 && (jlong)hi0 == -1) {
return TypeInt::CC_GE; // -1 >= bot
} else if (lo1 == 0 && hi1 == 0) {
return TypeInt::CC_GE; // bot >= 0
} else if ((jlong)lo1 == -1 && (jlong)hi1 == -1) {
return TypeInt::CC_LE; // bot <= -1
}
} else {
// We can use ranges of the form [lo..hi] if signs are the same.
assert(lo0 <= hi0 && lo1 <= hi1, "unsigned ranges are valid");
// results are reversed, '-' > '+' for unsigned compare
if (hi0 < lo1) {
return TypeInt::CC_LT; // smaller
} else if (lo0 > hi1) {
return TypeInt::CC_GT; // greater
} else if (hi0 == lo1 && lo0 == hi1) {
return TypeInt::CC_EQ; // Equal results
} else if (lo0 >= hi1) {
return TypeInt::CC_GE;
} else if (hi0 <= lo1) {
return TypeInt::CC_LE;
}
}
return TypeInt::CC; // else use worst case results
}
//=============================================================================
//------------------------------sub--------------------------------------------
// Simplify an CmpP (compare 2 pointers) node, based on local information.

@ -198,6 +198,15 @@ public:
virtual const Type *sub( const Type *, const Type * ) const;
};
//------------------------------CmpULNode---------------------------------------
// Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
class CmpULNode : public CmpNode {
public:
CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
virtual int Opcode() const;
virtual const Type* sub(const Type*, const Type*) const;
};
//------------------------------CmpL3Node--------------------------------------
// Compare 2 long values, returning integer value (-1, 0 or 1).
class CmpL3Node : public CmpLNode {

@ -2013,6 +2013,7 @@ typedef RehashableHashtable<Symbol*, mtSymbol> RehashableSymbolHashtable;
declare_c2_type(CmpPNode, CmpNode) \
declare_c2_type(CmpNNode, CmpNode) \
declare_c2_type(CmpLNode, CmpNode) \
declare_c2_type(CmpULNode, CmpNode) \
declare_c2_type(CmpL3Node, CmpLNode) \
declare_c2_type(CmpFNode, CmpNode) \
declare_c2_type(CmpF3Node, CmpFNode) \

@ -26,7 +26,7 @@
* @bug 8154763
* @summary Tests PostLoopMultiversioning with RangeCheckElimination disabled.
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination
* -XX:+UnlockExperimentalVMOptions -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination
* compiler.rangechecks.TestRangeCheckEliminationDisabled
*/

@ -437,3 +437,6 @@ ff293e39e83366c40a5687dacd1ccb2305ed2c1e jdk-10+12
332ad9f92632f56f337b8c40edef9a95a42b26bc jdk-9+177
02a876781a3a6193140591d92db7b95ca743eac2 jdk-10+15
d109d55cf642bf2b438624e81f94c18c168f9178 jdk-10+16
0983b2dbe17ba4fed3af34e0512ca77a9845fe8a jdk-9+178
87243a3131f79e8b3903eaca6b629abc48f08ace jdk-9+179
97d6f14334cfd766f57c296a5a707c8a709aeff0 jdk-10+17

@ -1,100 +0,0 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xml.internal.dtm;
import javax.xml.transform.SourceLocator;
/**
* Indicates a serious configuration error.
*/
public class DTMConfigurationException extends DTMException {
static final long serialVersionUID = -4607874078818418046L;
/**
* Create a new <code>DTMConfigurationException</code> with no
* detail message.
*/
public DTMConfigurationException() {
super("Configuration Error");
}
/**
* Create a new <code>DTMConfigurationException</code> with
* the <code>String </code> specified as an error message.
*
* @param msg The error message for the exception.
*/
public DTMConfigurationException(String msg) {
super(msg);
}
/**
* Create a new <code>DTMConfigurationException</code> with a
* given <code>Exception</code> base cause of the error.
*
* @param e The exception to be encapsulated in a
* DTMConfigurationException.
*/
public DTMConfigurationException(Throwable e) {
super(e);
}
/**
* Create a new <code>DTMConfigurationException</code> with the
* given <code>Exception</code> base cause and detail message.
*
* @param msg The detail message.
* @param e The exception to be wrapped in a DTMConfigurationException
*/
public DTMConfigurationException(String msg, Throwable e) {
super(msg, e);
}
/**
* Create a new DTMConfigurationException from a message and a Locator.
*
* <p>This constructor is especially useful when an application is
* creating its own exception from within a DocumentHandler
* callback.</p>
*
* @param message The error or warning message.
* @param locator The locator object for the error or warning.
*/
public DTMConfigurationException(String message,
SourceLocator locator) {
super(message, locator);
}
/**
* Wrap an existing exception in a DTMConfigurationException.
*
* @param message The error or warning message, or null to
* use the message from the embedded exception.
* @param locator The locator object for the error or warning.
* @param e Any exception.
*/
public DTMConfigurationException(String message,
SourceLocator locator,
Throwable e) {
super(message, locator, e);
}
}

@ -1,6 +1,5 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,124 +20,20 @@
package com.sun.org.apache.xml.internal.dtm;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.xml.transform.SourceLocator;
import com.sun.org.apache.xml.internal.res.XMLErrorResources;
import com.sun.org.apache.xml.internal.res.XMLMessages;
/**
* This class specifies an exceptional condition that occured
* This class specifies an exceptional condition that occurred
* in the DTM module.
*/
public class DTMException extends RuntimeException {
static final long serialVersionUID = -775576419181334734L;
/** Field locator specifies where the error occured.
* @serial */
SourceLocator locator;
/**
* Method getLocator retrieves an instance of a SourceLocator
* object that specifies where an error occured.
*
* @return A SourceLocator object, or null if none was specified.
*/
public SourceLocator getLocator() {
return locator;
}
/**
* Method setLocator sets an instance of a SourceLocator
* object that specifies where an error occured.
*
* @param location A SourceLocator object, or null to clear the location.
*/
public void setLocator(SourceLocator location) {
locator = location;
}
/** Field containedException specifies a wrapped exception. May be null.
* @serial */
Throwable containedException;
/**
* This method retrieves an exception that this exception wraps.
*
* @return An Throwable object, or null.
* @see #getCause
*/
public Throwable getException() {
return containedException;
}
/**
* Returns the cause of this throwable or <code>null</code> if the
* cause is nonexistent or unknown. (The cause is the throwable that
* caused this throwable to get thrown.)
*/
public Throwable getCause() {
return ((containedException == this)
? null
: containedException);
}
/**
* Initializes the <i>cause</i> of this throwable to the specified value.
* (The cause is the throwable that caused this throwable to get thrown.)
*
* <p>This method can be called at most once. It is generally called from
* within the constructor, or immediately after creating the
* throwable. If this throwable was created
* with {@link #DTMException(Throwable)} or
* {@link #DTMException(String,Throwable)}, this method cannot be called
* even once.
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A <tt>null</tt> value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @return a reference to this <code>Throwable</code> instance.
* @throws IllegalArgumentException if <code>cause</code> is this
* throwable. (A throwable cannot
* be its own cause.)
* @throws IllegalStateException if this throwable was
* created with {@link #DTMException(Throwable)} or
* {@link #DTMException(String,Throwable)}, or this method has already
* been called on this throwable.
*/
public synchronized Throwable initCause(Throwable cause) {
if ((this.containedException == null) && (cause != null)) {
throw new IllegalStateException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CANNOT_OVERWRITE_CAUSE, null)); //"Can't overwrite cause");
}
if (cause == this) {
throw new IllegalArgumentException(
XMLMessages.createXMLMessage(XMLErrorResources.ER_SELF_CAUSATION_NOT_PERMITTED, null)); //"Self-causation not permitted");
}
this.containedException = cause;
return this;
}
/**
* Create a new DTMException.
*
* @param message The error or warning message.
*/
public DTMException(String message) {
super(message);
this.containedException = null;
this.locator = null;
}
/**
@ -147,11 +42,7 @@ public class DTMException extends RuntimeException {
* @param e The exception to be wrapped.
*/
public DTMException(Throwable e) {
super(e.getMessage());
this.containedException = e;
this.locator = null;
super(e);
}
/**
@ -165,162 +56,6 @@ public class DTMException extends RuntimeException {
* @param e Any exception
*/
public DTMException(String message, Throwable e) {
super(((message == null) || (message.length() == 0))
? e.getMessage()
: message);
this.containedException = e;
this.locator = null;
super(message, e);
}
/**
* Create a new DTMException from a message and a Locator.
*
* <p>This constructor is especially useful when an application is
* creating its own exception from within a DocumentHandler
* callback.</p>
*
* @param message The error or warning message.
* @param locator The locator object for the error or warning.
*/
public DTMException(String message, SourceLocator locator) {
super(message);
this.containedException = null;
this.locator = locator;
}
/**
* Wrap an existing exception in a DTMException.
*
* @param message The error or warning message, or null to
* use the message from the embedded exception.
* @param locator The locator object for the error or warning.
* @param e Any exception
*/
public DTMException(String message, SourceLocator locator,
Throwable e) {
super(message);
this.containedException = e;
this.locator = locator;
}
/**
* Get the error message with location information
* appended.
*/
public String getMessageAndLocation() {
StringBuffer sbuffer = new StringBuffer();
String message = super.getMessage();
if (null != message) {
sbuffer.append(message);
}
if (null != locator) {
String systemID = locator.getSystemId();
int line = locator.getLineNumber();
int column = locator.getColumnNumber();
if (null != systemID) {
sbuffer.append("; SystemID: ");
sbuffer.append(systemID);
}
if (0 != line) {
sbuffer.append("; Line#: ");
sbuffer.append(line);
}
if (0 != column) {
sbuffer.append("; Column#: ");
sbuffer.append(column);
}
}
return sbuffer.toString();
}
/**
* Get the location information as a string.
*
* @return A string with location info, or null
* if there is no location information.
*/
public String getLocationAsString() {
if (null != locator) {
StringBuffer sbuffer = new StringBuffer();
String systemID = locator.getSystemId();
int line = locator.getLineNumber();
int column = locator.getColumnNumber();
if (null != systemID) {
sbuffer.append("; SystemID: ");
sbuffer.append(systemID);
}
if (0 != line) {
sbuffer.append("; Line#: ");
sbuffer.append(line);
}
if (0 != column) {
sbuffer.append("; Column#: ");
sbuffer.append(column);
}
return sbuffer.toString();
} else {
return null;
}
}
/**
* Print the the trace of methods from where the error
* originated. This will trace all nested exception
* objects, as well as this object.
*/
public void printStackTrace() {
printStackTrace(new java.io.PrintWriter(System.err, true));
}
/**
* Print the the trace of methods from where the error
* originated. This will trace all nested exception
* objects, as well as this object.
* @param s The stream where the dump will be sent to.
*/
public void printStackTrace(java.io.PrintStream s) {
printStackTrace(new java.io.PrintWriter(s));
}
/**
* Print the the trace of methods from where the error
* originated. This will trace all nested exception
* objects, as well as this object.
* @param s The writer where the dump will be sent to.
*/
public void printStackTrace(java.io.PrintWriter s) {
if (s == null) {
s = new java.io.PrintWriter(System.err, true);
}
try {
String locInfo = getLocationAsString();
if (null != locInfo) {
s.println(locInfo);
}
super.printStackTrace(s);
} catch (Throwable e) {}
}
}

@ -1,6 +1,5 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -21,12 +20,8 @@
package com.sun.org.apache.xml.internal.dtm;
import com.sun.org.apache.xml.internal.res.XMLErrorResources;
import com.sun.org.apache.xml.internal.res.XMLMessages;
import com.sun.org.apache.xml.internal.utils.PrefixResolver;
import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
/**
* A DTMManager instance can be used to create DTM and
@ -99,11 +94,11 @@ public abstract class DTMManager
*
* @return new DTMManager instance, never null.
*
* @throws DTMConfigurationException
* @throws DTMException
* if the implementation is not available or cannot be instantiated.
*/
public static DTMManager newInstance(XMLStringFactory xsf)
throws DTMConfigurationException
throws DTMException
{
final DTMManager factoryImpl = new com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault();
factoryImpl.setXMLStringFactory(xsf);
@ -315,20 +310,6 @@ public abstract class DTMManager
// -------------------- private methods --------------------
/**
* Temp debug code - this will be removed after we test everything
*/
private static boolean debug;
static
{
try
{
debug = SecuritySupport.getSystemProperty("dtm.debug") != null;
}
catch (SecurityException ex){}
}
/** This value, set at compile time, controls how many bits of the
* DTM node identifier numbers are used to identify a node within a
* document, and thus sets the maximum number of nodes per
@ -394,47 +375,4 @@ public abstract class DTMManager
{
return IDENT_NODE_DEFAULT;
}
//
// Classes
//
/**
* A configuration error.
* Originally in ObjectFactory. This is the only portion used in this package
*/
static class ConfigurationError
extends Error {
static final long serialVersionUID = 5122054096615067992L;
//
// Data
//
/** Exception. */
private Exception exception;
//
// Constructors
//
/**
* Construct a new instance with the specified detail string and
* exception.
*/
ConfigurationError(String msg, Exception x) {
super(msg);
this.exception = x;
} // <init>(String,Exception)
//
// Public methods
//
/** Returns the exception associated to this error. */
Exception getException() {
return exception;
} // getException():Exception
} // class ConfigurationError
}

@ -34,7 +34,7 @@ import jdk.xml.internal.SecuritySupport;
* The CatalogFeatures holds a collection of features and properties.
*
*
* <table class="plain">
* <table class="plain" id="CatalogFeatures">
* <caption>Catalog Features</caption>
* <thead>
* <tr>
@ -55,7 +55,7 @@ import jdk.xml.internal.SecuritySupport;
* <tbody>
*
* <tr>
* <th scope="row" style="font-weight:normal">FILES</th>
* <th scope="row" style="font-weight:normal" id="FILES">FILES</th>
* <td>A semicolon-delimited list of URIs to locate the catalog files.
* The URIs must be absolute and have a URL protocol handler for the URI scheme.
* </td>
@ -71,7 +71,7 @@ import jdk.xml.internal.SecuritySupport;
* </tr>
*
* <tr>
* <th rowspan="2" scope="row" style="font-weight:normal">PREFER</th>
* <th rowspan="2" scope="row" style="font-weight:normal" id="PREFER">PREFER</th>
* <td rowspan="2">Indicates the preference between the public and system
* identifiers. The default value is public [3].</td>
* <td rowspan="2">javax.xml.catalog.prefer</td>
@ -91,7 +91,7 @@ import jdk.xml.internal.SecuritySupport;
* </tr>
*
* <tr>
* <th rowspan="2" scope="row" style="font-weight:normal">DEFER</th>
* <th rowspan="2" scope="row" style="font-weight:normal" id="DEFER">DEFER</th>
* <td rowspan="2">Indicates that the alternative catalogs including those
* specified in delegate entries or nextCatalog are not read until they are
* needed. The default value is true.</td>
@ -111,7 +111,7 @@ import jdk.xml.internal.SecuritySupport;
* </tr>
*
* <tr>
* <th rowspan="3" scope="row" style="font-weight:normal">RESOLVE</th>
* <th rowspan="3" scope="row" style="font-weight:normal" id="RESOLVE">RESOLVE</th>
* <td rowspan="3">Determines the action if there is no matching entry found after
* all of the specified catalogs are exhausted. The default is strict.</td>
* <td rowspan="3">javax.xml.catalog.resolve [4]</td>

@ -34,7 +34,7 @@ import com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl;
/**
* Factory that creates new {@code javax.xml.datatype} {@code Object}s that map XML to/from Java {@code Object}s.
* <p>
* <p id="DatatypeFactory.newInstance">
* A new instance of the {@code DatatypeFactory} is created through the {@link #newInstance()} method
* that uses the following implementation resolution mechanisms to determine an implementation:
* <ol>

@ -149,23 +149,13 @@
* <li>xs:unsignedShort</li>
* </ul>
*
* <hr>
*
* <ul>
* <li>Author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a></li>
* <li>See <a href="http://www.w3.org/TR/xmlschema-2/#dateTime">
* @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
* @see <a href="http://www.w3.org/TR/xmlschema-2/#dateTime">
* W3C XML Schema 1.0 Part 2, Section 3.2.7-14</a>
* </li>
* <li>See <a href="http://www.w3.org/TR/xpath-datamodel#dt-dayTimeDuration">
* @see <a href="http://www.w3.org/TR/xpath-datamodel#dt-dayTimeDuration">
* XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration</a>
* </li>
* <li>See <a href="http://www.w3.org/TR/xpath-datamodel#dt-yearMonthDuration">
* @see <a href="http://www.w3.org/TR/xpath-datamodel#dt-yearMonthDuration">
* XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a>
* </li>
* <li>Since 1.5</li>
* </ul>
*
* <hr>
* @since 1.5
*/

@ -32,6 +32,8 @@ package javax.xml.transform;
*/
public class TransformerConfigurationException extends TransformerException {
private static final long serialVersionUID = 1285547467942875745L;
/**
* Create a new <code>TransformerConfigurationException</code> with no
* detail message.

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,36 +27,47 @@ package javax.xml.transform;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.CodeSigner;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Permissions;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.util.Objects;
/**
* This class specifies an exceptional condition that occured
* This class specifies an exceptional condition that occurred
* during the transformation process.
*
* @since 1.4
*/
public class TransformerException extends Exception {
/** Field locator specifies where the error occured */
private static final long serialVersionUID = 975798773772956428L;
/** Field locator specifies where the error occurred */
SourceLocator locator;
/**
* Method getLocator retrieves an instance of a SourceLocator
* object that specifies where an error occured.
* object that specifies where an error occurred.
*
* @return A SourceLocator object, or null if none was specified.
*/
public SourceLocator getLocator() {
return locator;
return this.locator;
}
/**
* Method setLocator sets an instance of a SourceLocator
* object that specifies where an error occured.
* object that specifies where an error occurred.
*
* @param location A SourceLocator object, or null to clear the location.
*/
public void setLocator(SourceLocator location) {
locator = location;
this.locator = location;
}
/** Field containedException specifies a wrapped exception. May be null. */
@ -76,7 +87,9 @@ public class TransformerException extends Exception {
* Returns the cause of this throwable or <code>null</code> if the
* cause is nonexistent or unknown. (The cause is the throwable that
* caused this throwable to get thrown.)
* @return the cause, or null if unknown
*/
@Override
public Throwable getCause() {
return ((containedException == this)
@ -108,6 +121,7 @@ public class TransformerException extends Exception {
* {@link #TransformerException(String,Throwable)}, or this method has already
* been called on this throwable.
*/
@Override
public synchronized Throwable initCause(Throwable cause) {
// TransformerException doesn't set its cause (probably
@ -136,11 +150,7 @@ public class TransformerException extends Exception {
* @param message The error or warning message.
*/
public TransformerException(String message) {
super(message);
this.containedException = null;
this.locator = null;
this(message, null, null);
}
/**
@ -149,11 +159,7 @@ public class TransformerException extends Exception {
* @param e The exception to be wrapped.
*/
public TransformerException(Throwable e) {
super(e.toString());
this.containedException = e;
this.locator = null;
this(null, null, e);
}
/**
@ -167,13 +173,7 @@ public class TransformerException extends Exception {
* @param e Any exception
*/
public TransformerException(String message, Throwable e) {
super(((message == null) || (message.length() == 0))
? e.toString()
: message);
this.containedException = e;
this.locator = null;
this(message, null, e);
}
/**
@ -187,11 +187,7 @@ public class TransformerException extends Exception {
* @param locator The locator object for the error or warning.
*/
public TransformerException(String message, SourceLocator locator) {
super(message);
this.containedException = null;
this.locator = locator;
this(message, locator, null);
}
/**
@ -204,8 +200,9 @@ public class TransformerException extends Exception {
*/
public TransformerException(String message, SourceLocator locator,
Throwable e) {
super(message);
super(((message == null) || (message.length() == 0))
? ((e == null) ? "" : e.toString())
: message);
this.containedException = e;
this.locator = locator;
@ -219,34 +216,9 @@ public class TransformerException extends Exception {
* location information appended.
*/
public String getMessageAndLocation() {
StringBuffer sbuffer = new StringBuffer();
String message = super.getMessage();
if (null != message) {
sbuffer.append(message);
}
if (null != locator) {
String systemID = locator.getSystemId();
int line = locator.getLineNumber();
int column = locator.getColumnNumber();
if (null != systemID) {
sbuffer.append("; SystemID: ");
sbuffer.append(systemID);
}
if (0 != line) {
sbuffer.append("; Line#: ");
sbuffer.append(line);
}
if (0 != column) {
sbuffer.append("; Column#: ");
sbuffer.append(column);
}
}
StringBuilder sbuffer = new StringBuilder();
sbuffer.append(Objects.toString(super.getMessage(), ""));
sbuffer.append(Objects.toString(getLocationAsString(), ""));
return sbuffer.toString();
}
@ -258,9 +230,29 @@ public class TransformerException extends Exception {
* if there is no location information.
*/
public String getLocationAsString() {
if (locator == null) {
return null;
}
if (null != locator) {
StringBuffer sbuffer = new StringBuffer();
if (System.getSecurityManager() == null) {
return getLocationString();
} else {
return AccessController.doPrivileged((PrivilegedAction<String>) () ->
getLocationString(),
new AccessControlContext(new ProtectionDomain[] {getNonPrivDomain()}));
}
}
/**
* Constructs the location string.
* @return the location string
*/
private String getLocationString() {
if (locator == null) {
return null;
}
StringBuilder sbuffer = new StringBuilder();
String systemID = locator.getSystemId();
int line = locator.getLineNumber();
int column = locator.getColumnNumber();
@ -281,9 +273,6 @@ public class TransformerException extends Exception {
}
return sbuffer.toString();
} else {
return null;
}
}
/**
@ -291,6 +280,7 @@ public class TransformerException extends Exception {
* originated. This will trace all nested exception
* objects, as well as this object.
*/
@Override
public void printStackTrace() {
printStackTrace(new java.io.PrintWriter(System.err, true));
}
@ -301,6 +291,7 @@ public class TransformerException extends Exception {
* objects, as well as this object.
* @param s The stream where the dump will be sent to.
*/
@Override
public void printStackTrace(java.io.PrintStream s) {
printStackTrace(new java.io.PrintWriter(s));
}
@ -311,6 +302,7 @@ public class TransformerException extends Exception {
* objects, as well as this object.
* @param s The writer where the dump will be sent to.
*/
@Override
public void printStackTrace(java.io.PrintWriter s) {
if (s == null) {
@ -358,11 +350,8 @@ public class TransformerException extends Exception {
} else {
exception = null;
}
} catch (InvocationTargetException ite) {
exception = null;
} catch (IllegalAccessException iae) {
exception = null;
} catch (NoSuchMethodException nsme) {
} catch (InvocationTargetException | IllegalAccessException
| NoSuchMethodException e) {
exception = null;
}
}
@ -371,4 +360,14 @@ public class TransformerException extends Exception {
s.flush();
}
}
/**
* Creates a ProtectionDomain that has no permission.
* @return a ProtectionDomain
*/
private ProtectionDomain getNonPrivDomain() {
CodeSource nullSource = new CodeSource(null, (CodeSigner[]) null);
PermissionCollection noPermission = new Permissions();
return new ProtectionDomain(nullSource, noPermission);
}
}

@ -440,3 +440,6 @@ ea819b6009d33a72e6672bab6c101d51db0cfb4c jdk-9+176
b44a721aee3d3b2537754e559fe9ecccadea548b jdk-9+177
6d17fd0a5133a0dd916c77a9a24ae7f0ca402876 jdk-10+15
bc8289ce1ed3ed5fff62152ed46da3be0b60b7c3 jdk-10+16
d0190aaf1816081d9b2e0577b65b793804896d1e jdk-9+178
56ac1831ac5924b5092a53a85d6fc68749501fb8 jdk-9+179
4c07d366c2e177edba7aa54c4b015e4dbf12bc83 jdk-10+17

@ -84,6 +84,14 @@ public class XmlUtil {
private final static String LEXICAL_HANDLER_PROPERTY =
"http://xml.org/sax/properties/lexical-handler";
private static final String DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl";
private static final String EXTERNAL_GE = "http://xml.org/sax/features/external-general-entities";
private static final String EXTERNAL_PE = "http://xml.org/sax/features/external-parameter-entities";
private static final String LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName());
private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.ws.disableXmlSecurity";
@ -327,10 +335,24 @@ public class XmlUtil {
public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
boolean securityOn = !xmlSecurityDisabled(disableSecurity);
factory.setFeature(featureToSet, securityOn);
factory.setNamespaceAware(true);
if (securityOn) {
factory.setExpandEntityReferences(false);
featureToSet = DISALLOW_DOCTYPE_DECL;
factory.setFeature(featureToSet, true);
featureToSet = EXTERNAL_GE;
factory.setFeature(featureToSet, false);
featureToSet = EXTERNAL_PE;
factory.setFeature(featureToSet, false);
featureToSet = LOAD_EXTERNAL_DTD;
factory.setFeature(featureToSet, false);
}
} catch (ParserConfigurationException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[] {factory.getClass().getName()} );
}
return factory;
}
@ -347,10 +369,23 @@ public class XmlUtil {
public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) {
SAXParserFactory factory = SAXParserFactory.newInstance();
String featureToSet = XMLConstants.FEATURE_SECURE_PROCESSING;
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
boolean securityOn = !xmlSecurityDisabled(disableSecurity);
factory.setFeature(featureToSet, securityOn);
factory.setNamespaceAware(true);
if (securityOn) {
featureToSet = DISALLOW_DOCTYPE_DECL;
factory.setFeature(featureToSet, true);
featureToSet = EXTERNAL_GE;
factory.setFeature(featureToSet, false);
featureToSet = EXTERNAL_PE;
factory.setFeature(featureToSet, false);
featureToSet = LOAD_EXTERNAL_DTD;
factory.setFeature(featureToSet, false);
}
} catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support "+featureToSet+" feature!", new Object[]{factory.getClass().getName()});
}
return factory;
}

@ -112,29 +112,13 @@ public class DOMForest {
this.entityResolver = entityResolver;
this.errorReceiver = errReceiver;
this.logic = logic;
// secure xml processing can be switched off if input requires it
boolean disableXmlSecurity = options == null ? false : options.disableXmlSecurity;
DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(disableXmlSecurity);
this.parserFactory = XmlUtil.newSAXParserFactory(disableXmlSecurity);
try {
// secure xml processing can be switched off if input requires it
boolean secureProcessingEnabled = options == null || !options.disableXmlSecurity;
DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(!secureProcessingEnabled);
dbf.setNamespaceAware(true);
this.documentBuilder = dbf.newDocumentBuilder();
this.parserFactory = XmlUtil.newSAXParserFactory(secureProcessingEnabled);
this.parserFactory.setNamespaceAware(true);
if(secureProcessingEnabled){
dbf.setExpandEntityReferences(false);
try {
parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
parserFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
parserFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
} catch (SAXNotRecognizedException e){
throw new ParserConfigurationException(e.getMessage());
} catch (SAXNotSupportedException e) {
throw new ParserConfigurationException(e.getMessage());
}
}
} catch (ParserConfigurationException e) {
throw new AssertionError(e);
}

@ -437,3 +437,6 @@ e6c4f6ef717d104dba880e2dae538690c993b46f jdk-9+175
80acf577b7d0b886fb555c9916552844f6cc72af jdk-9+177
e069834e2c518a7bc2ffadc8c7e3cd7ec69fa8a0 jdk-10+15
3281b964ab104002623d744e8b77a12269b70acd jdk-10+16
443025bee731eb2225371b92c1c74b519b7baf33 jdk-9+178
06df1ce4b9b887d05ce6a13f4def3547e434dd1a jdk-9+179
d93f2fd542b7d7855c2cd49ae15ebcc3d441a83b jdk-10+17

@ -116,6 +116,9 @@ TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(BUILDTOOLS_OUTPUTD
TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.cldrconverter.CLDRConverter
TOOL_GENERATELSREQUIVMAPS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generatelsrequivmaps.EquivMapsGenerator
TOOL_GENMODULESXML = $(JAVA_SMALL) $(INTERIM_LANGTOOLS_BOOTCLASSPATH) \
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes) \
build.tools.module.GenJdepsModulesXml

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -63,6 +63,16 @@ GENSRC_JAVA_BASE += $(COPY_ZH_HK)
################################################################################
GENSRC_LSREQUIVMAPS := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/LocaleEquivalentMaps.java
$(GENSRC_LSREQUIVMAPS): $(JDK_TOPDIR)/make/data/lsrdata/language-subtag-registry.txt $(BUILD_TOOLS_JDK)
$(call MakeDir, $(@D))
$(TOOL_GENERATELSREQUIVMAPS) $< $@
GENSRC_JAVA_BASE += $(GENSRC_LSREQUIVMAPS)
################################################################################
java.base: $(GENSRC_JAVA_BASE)
all: java.base

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -42,17 +42,17 @@ define SetupCharacterData
-spec $(UNICODEDATA)/UnicodeData.txt \
-specialcasing $(UNICODEDATA)/SpecialCasing.txt \
-proplist $(UNICODEDATA)/PropList.txt \
-o $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java -string \
-o $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java \
-usecharforbyte $3
GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java
endef
$(eval $(call SetupCharacterData,CharacterDataLatin1, , -latin1 8))
$(eval $(call SetupCharacterData,CharacterData00, -plane 0, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData01, -plane 1, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData02, -plane 2, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData0E, -plane 14, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData00, -string -plane 0, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData01, -string -plane 1, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData02, -string -plane 2, 11 4 1))
$(eval $(call SetupCharacterData,CharacterData0E, -string -plane 14, 11 4 1))
# Copy two Java files that need no preprocessing.
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template

@ -19,7 +19,6 @@ text: .text%Java_java_lang_System_initProperties;
text: .text%GetJavaProperties;
text: .text%uname: OUTPUTDIR/java_props_md.o;
text: .text%mapLookup: OUTPUTDIR/java_props_md.o;
text: .text%setPathEnvironment: OUTPUTDIR/java_props_md.o;
text: .text%JNU_NewStringPlatform;
text: .text%JNU_CallStaticMethodByName;
text: .text%NewStringPlatform;

@ -40,16 +40,9 @@ $(eval $(call SetupRMICompilation,RMI_12, \
RUN_V12 := true))
GENCLASSES += $(RMI_12)
$(eval $(call SetupRMICompilation,RMI_11, \
CLASSES := sun.rmi.registry.RegistryImpl \
sun.rmi.transport.DGCImpl, \
CLASSES_DIR := $(CLASSES_DIR)/java.rmi, \
STUB_CLASSES_DIR := $(STUB_CLASSES_DIR)/java.rmi, \
RUN_V11 := true))
GENCLASSES += $(RMI_11)
################################################################################
all: $(RMI_11) $(RMI_12)
all: $(RMI_12)
.PHONY: all

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -21,36 +21,41 @@
* questions.
*/
import java.nio.charset.*;
import java.nio.file.*;
import java.util.*;
package build.tools.generatelsrequivmaps;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
/**
* This tool reads the IANA Language Subtag Registry data file downloaded from
* http://www.iana.org/assignments/language-subtag-registry, which is specified
* in the command line and generates a .java source file as specified in
* command line. The generated .java source file contains equivalent language
* maps. These equivalent language maps are used by LocaleMatcher.java
* for the locale matching mechanism specified in RFC 4647 "Matching of Language
* Tags".
*/
public class EquivMapsGenerator {
/*
* IANA Language Subtag Registry file downloaded from
* http://www.iana.org/assignments/language-subtag-registry
*/
private static final String DEFAULT_LSR_FILE =
"language-subtag-registry.txt";
private static boolean verbose = false;
public static void main(String[] args) throws Exception {
String fileLSR = DEFAULT_LSR_FILE;
for (int i = 0; i < args.length; i++) {
String s = args[i];
if (s.equals("-lsr")) {
fileLSR = args[++i];
} else if (s.equals("-verbose")) {
verbose = true;
}
if (args.length != 2) {
System.err.println("Usage: java EquivMapsGenerator"
+ " language-subtag-registry.txt LocaleEquivalentMaps.java");
System.exit(1);
}
readLSRfile(fileLSR);
readLSRfile(args[0]);
generateEquivalentMap();
generateSourceCode();
generateSourceCode(args[1]);
}
private static String LSRrevisionDate;
@ -68,17 +73,13 @@ public class EquivMapsGenerator {
String type = null;
String tag = null;
String preferred = null;
int mappingNum = 0;
for (String line : Files.readAllLines(Paths.get(filename),
Charset.forName("UTF-8"))) {
line = line.toLowerCase();
line = line.toLowerCase(Locale.ROOT);
int index = line.indexOf(' ')+1;
if (line.startsWith("file-date:")) {
LSRrevisionDate = line.substring(index);
if (verbose) {
System.out.println("LSR revision date=" + LSRrevisionDate);
}
} else if (line.startsWith("type:")) {
type = line.substring(index);
} else if (line.startsWith("tag:") || line.startsWith("subtag:")) {
@ -86,32 +87,10 @@ public class EquivMapsGenerator {
} else if (line.startsWith("preferred-value:")
&& !type.equals("extlang")) {
preferred = line.substring(index);
mappingNum++;
processDeprecatedData(type, tag, preferred);
} else if (line.equals("%%")) {
type = null;
tag = null;
preferred = null;
}
}
if (verbose) {
System.out.println("readLSRfile(" + filename + ")");
System.out.println(" Total number of mapping=" + mappingNum);
System.out.println("\n Map for language. Size="
+ initialLanguageMap.size());
for (String key : initialLanguageMap.keySet()) {
System.out.println(" " + key + ": \""
+ initialLanguageMap.get(key) + "\"");
}
System.out.println("\n Map for region and variant. Size="
+ initialRegionVariantMap.size());
for (String key : initialRegionVariantMap.keySet()) {
System.out.println(" " + key + ": \""
+ initialRegionVariantMap.get(key) + "\"");
}
}
}
@ -174,32 +153,6 @@ public class EquivMapsGenerator {
sortedRegionVariantMap.put(subtags[1], subtags[0]);
}
if (verbose) {
System.out.println("generateEquivalentMap()");
System.out.println(" \nSorted map for language subtags which have only one equivalent. Size="
+ sortedLanguageMap1.size());
for (String key : sortedLanguageMap1.keySet()) {
System.out.println(" " + key + ": \""
+ sortedLanguageMap1.get(key) + "\"");
}
System.out.println("\n Sorted map for language subtags which have multiple equivalents. Size="
+ sortedLanguageMap2.size());
for (String key : sortedLanguageMap2.keySet()) {
String[] s = sortedLanguageMap2.get(key);
if (s.length >= 2) {
System.out.println(" " + key + ": " + generateValuesString(s) + "");
}
}
System.out.println("\n Sorted map for region and variant subtags. Size="
+ sortedRegionVariantMap.size());
for (String key : sortedRegionVariantMap.keySet()) {
System.out.println(" " + key + ": \""
+ sortedRegionVariantMap.get(key) + "\"");
}
}
System.out.println();
}
/* create the array of subtags excluding the subtag at index location */
@ -226,8 +179,36 @@ public class EquivMapsGenerator {
return outputStr;
}
private static final String COPYRIGHT = "/*\n"
+ " * Copyright (c) 2012, %d, Oracle and/or its affiliates. All rights reserved.\n"
+ " * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n"
+ " *\n"
+ " * This code is free software; you can redistribute it and/or modify it\n"
+ " * under the terms of the GNU General Public License version 2 only, as\n"
+ " * published by the Free Software Foundation. Oracle designates this\n"
+ " * particular file as subject to the \"Classpath\" exception as provided\n"
+ " * by Oracle in the LICENSE file that accompanied this code.\n"
+ " *\n"
+ " * This code is distributed in the hope that it will be useful, but WITHOUT\n"
+ " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n"
+ " * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n"
+ " * version 2 for more details (a copy is included in the LICENSE file that\n"
+ " * accompanied this code).\n"
+ " *\n"
+ " * You should have received a copy of the GNU General Public License version\n"
+ " * 2 along with this work; if not, write to the Free Software Foundation,\n"
+ " * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n"
+ " *\n"
+ " * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n"
+ " * or visit www.oracle.com if you need additional information or have any\n"
+ " * questions.\n"
+ "*/\n\n";
private static final String headerText =
"final class LocaleEquivalentMaps {\n\n"
"package sun.util.locale;\n\n"
+ "import java.util.HashMap;\n"
+ "import java.util.Map;\n\n"
+ "final class LocaleEquivalentMaps {\n\n"
+ " static final Map<String, String> singleEquivMap;\n"
+ " static final Map<String, String[]> multiEquivsMap;\n"
+ " static final Map<String, String> regionVariantEquivMap;\n\n"
@ -241,32 +222,60 @@ public class EquivMapsGenerator {
" }\n\n"
+ "}";
private static void generateSourceCode() {
System.out.println(headerText
+ " // LSR Revision: " + LSRrevisionDate);
private static String getOpenJDKCopyright() {
int year = ZonedDateTime.now(ZoneId
.of("America/Los_Angeles")).getYear();
return String.format(Locale.US, COPYRIGHT, year);
}
for (String key : sortedLanguageMap1.keySet()) {
String value = sortedLanguageMap1.get(key);
System.out.println(" singleEquivMap.put(\""
+ key + "\", \"" + value + "\");");
}
System.out.println();
for (String key : sortedLanguageMap2.keySet()) {
String[] values = sortedLanguageMap2.get(key);
/**
* The input lsr data file is in UTF-8, so theoretically for the characters
* beyond US-ASCII, the generated Java String literals need to be Unicode
* escaped (\\uXXXX) while writing to a file. But as of now, there is not
* the case since we don't use "description", "comment" or alike.
*/
private static void generateSourceCode(String fileName) {
if (values.length >= 2) {
System.out.println(" multiEquivsMap.put(\""
+ key + "\", new String[] {" + generateValuesString(values) + "});");
try (BufferedWriter writer = Files.newBufferedWriter(
Paths.get(fileName))) {
writer.write(getOpenJDKCopyright());
writer.write(headerText
+ " // LSR Revision: " + LSRrevisionDate);
writer.newLine();
for (String key : sortedLanguageMap1.keySet()) {
String value = sortedLanguageMap1.get(key);
writer.write(" singleEquivMap.put(\""
+ key + "\", \"" + value + "\");");
writer.newLine();
}
}
System.out.println();
for (String key : sortedRegionVariantMap.keySet()) {
String value = sortedRegionVariantMap.get(key);
System.out.println(" regionVariantEquivMap.put(\""
+ key + "\", \"" + value + "\");");
writer.newLine();
for (String key : sortedLanguageMap2.keySet()) {
String[] values = sortedLanguageMap2.get(key);
if (values.length >= 2) {
writer.write(" multiEquivsMap.put(\""
+ key + "\", new String[] {"
+ generateValuesString(values) + "});");
writer.newLine();
}
}
writer.newLine();
for (String key : sortedRegionVariantMap.keySet()) {
String value = sortedRegionVariantMap.get(key);
writer.write(" regionVariantEquivMap.put(\""
+ key + "\", \"" + value + "\");");
writer.newLine();
}
writer.write(footerText);
} catch (IOException ex) {
ex.printStackTrace(System.err);
System.exit(1);
}
System.out.println(footerText);
}
}

@ -50,7 +50,12 @@ public class FilterOutputStream extends OutputStream {
/**
* Whether the stream is closed; implicitly initialized to false.
*/
private boolean closed;
private volatile boolean closed;
/**
* Object used to prevent a race on the 'closed' instance variable.
*/
private final Object closeLock = new Object();
/**
* Creates an output stream filter built on top of the specified
@ -165,7 +170,12 @@ public class FilterOutputStream extends OutputStream {
if (closed) {
return;
}
closed = true;
synchronized (closeLock) {
if (closed) {
return;
}
closed = true;
}
Throwable flushException = null;
try {

@ -364,9 +364,9 @@ public final class Class<T> implements java.io.Serializable,
// Reflective call to get caller class is only needed if a security manager
// is present. Avoid the overhead of making this call otherwise.
caller = Reflection.getCallerClass();
if (VM.isSystemDomainLoader(loader)) {
if (loader == null) {
ClassLoader ccl = ClassLoader.getClassLoader(caller);
if (!VM.isSystemDomainLoader(ccl)) {
if (ccl != null) {
sm.checkPermission(
SecurityConstants.GET_CLASSLOADER_PERMISSION);
}

@ -881,9 +881,9 @@ class LambdaFormEditor {
System.arraycopy(lambdaForm.names, skip + outArgs, names2, skip + inTypes, bodyLength);
int arity2 = names2.length - bodyLength;
int result2 = lambdaForm.result;
if (result2 >= 0) {
if (result2 >= skip) {
if (result2 < skip + outArgs) {
result2 = reorder[result2 - skip];
result2 = reorder[result2 - skip] + skip;
} else {
result2 = result2 - outArgs + inTypes;
}

@ -2476,7 +2476,7 @@ return mh1;
return false;
}
ClassLoader loader = defc.getClassLoader();
if (!jdk.internal.misc.VM.isSystemDomainLoader(loader)) {
if (loader != null) {
ClassLoader sysl = ClassLoader.getSystemClassLoader();
boolean found = false;
while (sysl != null) {

@ -453,7 +453,7 @@ public class Proxy implements java.io.Serializable {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
ClassLoader ccl = caller.getClassLoader();
if (VM.isSystemDomainLoader(loader) && !VM.isSystemDomainLoader(ccl)) {
if (loader == null && ccl != null) {
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
}
ReflectUtil.checkProxyPackageAccess(ccl, interfaces);

@ -70,7 +70,7 @@ public abstract class AbstractSelector
extends Selector
{
private AtomicBoolean selectorOpen = new AtomicBoolean(true);
private final AtomicBoolean selectorOpen = new AtomicBoolean(true);
// The provider that created this selector
private final SelectorProvider provider;

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -560,6 +560,7 @@ public class CodeSource implements java.io.Serializable {
{
CertificateFactory cf;
Hashtable<String, CertificateFactory> cfs = null;
List<java.security.cert.Certificate> certList = null;
ois.defaultReadObject(); // location
@ -569,7 +570,7 @@ public class CodeSource implements java.io.Serializable {
// we know of 3 different cert types: X.509, PGP, SDSI, which
// could all be present in the stream at the same time
cfs = new Hashtable<>(3);
this.certs = new java.security.cert.Certificate[size];
certList = new ArrayList<>(size > 20 ? 20 : size);
}
for (int i = 0; i < size; i++) {
@ -600,13 +601,17 @@ public class CodeSource implements java.io.Serializable {
ois.readFully(encoded);
ByteArrayInputStream bais = new ByteArrayInputStream(encoded);
try {
this.certs[i] = cf.generateCertificate(bais);
certList.add(cf.generateCertificate(bais));
} catch (CertificateException ce) {
throw new IOException(ce.getMessage());
}
bais.close();
}
if (certList != null) {
this.certs = certList.toArray(
new java.security.cert.Certificate[size]);
}
// Deserialize array of code signers (if any)
try {
this.signers = ((CodeSigner[])ois.readObject()).clone();

@ -57,7 +57,7 @@ import javax.crypto.SecretKey;
* and catching the CloneNotSupportedException:
*
* <pre>{@code
* MessageDigest md = MessageDigest.getInstance("SHA");
* MessageDigest md = MessageDigest.getInstance("SHA-256");
*
* try {
* md.update(toChapter1);
@ -496,7 +496,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
/**
* Returns a string that identifies the algorithm, independent of
* implementation details. The name should be a standard
* Java Security name (such as "SHA", "MD5", and so on).
* Java Security name (such as "SHA-256").
* See the MessageDigest section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#messagedigest-algorithms">
* Java Security Standard Algorithm Names Specification</a>

@ -51,11 +51,10 @@ import sun.security.jca.GetInstance.Instance;
* authentication and integrity assurance of digital data.
*
* <p> The signature algorithm can be, among others, the NIST standard
* DSA, using DSA and SHA-1. The DSA algorithm using the
* SHA-1 message digest algorithm can be specified as {@code SHA1withDSA}.
* In the case of RSA, there are multiple choices for the message digest
* algorithm, so the signing algorithm could be specified as, for example,
* {@code MD2withRSA}, {@code MD5withRSA}, or {@code SHA1withRSA}.
* DSA, using DSA and SHA-256. The DSA algorithm using the
* SHA-256 message digest algorithm can be specified as {@code SHA256withDSA}.
* In the case of RSA the signing algorithm could be specified as, for example,
* {@code SHA256withRSA}.
* The algorithm name must be specified, as there is no default.
*
* <p> A Signature object can be used to generate and verify digital

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -81,13 +81,12 @@ import java.io.*;
* verification in an attempt to bypass a security check.
*
* <p> The signature algorithm can be, among others, the NIST standard
* DSA, using DSA and SHA-1. The algorithm is specified using the
* DSA, using DSA and SHA-256. The algorithm is specified using the
* same convention as that for signatures. The DSA algorithm using the
* SHA-1 message digest algorithm can be specified, for example, as
* "SHA/DSA" or "SHA-1/DSA" (they are equivalent). In the case of
* RSA, there are multiple choices for the message digest algorithm,
* so the signing algorithm could be specified as, for example,
* "MD2/RSA", "MD5/RSA" or "SHA-1/RSA". The algorithm name must be
* SHA-256 message digest algorithm can be specified, for example, as
* "SHA256withDSA". In the case of
* RSA the signing algorithm could be specified as, for example,
* "SHA256withRSA". The algorithm name must be
* specified, as there is no default.
*
* <p> The name of the Cryptography Package Provider is designated

@ -35,6 +35,9 @@
package java.util.concurrent;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.HashSet;
@ -573,6 +576,9 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
private static final RuntimePermission shutdownPerm =
new RuntimePermission("modifyThread");
/* The context to be used when executing the finalizer, or null. */
private final AccessControlContext acc;
/**
* Class Worker mainly maintains interrupt control state for
* threads running tasks, along with other minor bookkeeping.
@ -1308,6 +1314,9 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
throw new IllegalArgumentException();
if (workQueue == null || threadFactory == null || handler == null)
throw new NullPointerException();
this.acc = System.getSecurityManager() == null ?
null :
AccessController.getContext();
this.corePoolSize = corePoolSize;
this.maximumPoolSize = maximumPoolSize;
this.workQueue = workQueue;
@ -1478,6 +1487,9 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
* Invokes {@code shutdown} when this executor is no longer
* referenced and it has no threads.
*
* <p>This method is invoked with privileges that are restricted by
* the security context of the caller that invokes the constructor.
*
* @deprecated The {@code finalize} method has been deprecated.
* Subclasses that override {@code finalize} in order to perform cleanup
* should be modified to use alternative cleanup mechanisms and
@ -1489,7 +1501,13 @@ public class ThreadPoolExecutor extends AbstractExecutorService {
*/
@Deprecated(since="9")
protected void finalize() {
shutdown();
SecurityManager sm = System.getSecurityManager();
if (sm == null || acc == null) {
shutdown();
} else {
PrivilegedAction<Void> pa = () -> { shutdown(); return null; };
AccessController.doPrivileged(pa, acc);
}
}
/**

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -180,10 +180,12 @@ class JarVerifier {
// only set the jev object for entries that have a signature
// (either verified or not)
if (sigFileSigners.get(name) != null ||
verifiedSigners.get(name) != null) {
mev.setEntry(name, je);
return;
if (!name.equals(JarFile.MANIFEST_NAME)) {
if (sigFileSigners.get(name) != null ||
verifiedSigners.get(name) != null) {
mev.setEntry(name, je);
return;
}
}
// don't compute the digest for this entry

@ -667,11 +667,11 @@ import java.util.stream.StreamSupport;
* <tr><td>{@code \p{Alpha}}</td>
* <td>An alphabetic character:{@code \p{IsAlphabetic}}</td></tr>
* <tr><td>{@code \p{Digit}}</td>
* <td>A decimal digit character:{@code p{IsDigit}}</td></tr>
* <td>A decimal digit character:{@code \p{IsDigit}}</td></tr>
* <tr><td>{@code \p{Alnum}}</td>
* <td>An alphanumeric character:{@code [\p{IsAlphabetic}\p{IsDigit}]}</td></tr>
* <tr><td>{@code \p{Punct}}</td>
* <td>A punctuation character:{@code p{IsPunctuation}}</td></tr>
* <td>A punctuation character:{@code \p{IsPunctuation}}</td></tr>
* <tr><td>{@code \p{Graph}}</td>
* <td>A visible character: {@code [^\p{IsWhite_Space}\p{gc=Cc}\p{gc=Cs}\p{gc=Cn}]}</td></tr>
* <tr><td>{@code \p{Print}}</td>

@ -59,7 +59,7 @@ import sun.security.jca.*;
* <p>A <i>transformation</i> is a string that describes the operation (or
* set of operations) to be performed on the given input, to produce some
* output. A transformation always includes the name of a cryptographic
* algorithm (e.g., <i>DES</i>), and may be followed by a feedback mode and
* algorithm (e.g., <i>AES</i>), and may be followed by a feedback mode and
* padding scheme.
*
* <p> A transformation is of the form:
@ -75,17 +75,19 @@ import sun.security.jca.*;
* For example, the following is a valid transformation:
*
* <pre>
* Cipher c = Cipher.getInstance("<i>DES/CBC/PKCS5Padding</i>");
* Cipher c = Cipher.getInstance("<i>AES/CBC/PKCS5Padding</i>");
* </pre>
*
* Using modes such as {@code CFB} and {@code OFB}, block
* ciphers can encrypt data in units smaller than the cipher's actual
* block size. When requesting such a mode, you may optionally specify
* the number of bits to be processed at a time by appending this number
* to the mode name as shown in the "{@code DES/CFB8/NoPadding}" and
* "{@code DES/OFB32/PKCS5Padding}" transformations. If no such
* number is specified, a provider-specific default is used. (For
* example, the SunJCE provider uses a default of 64 bits for DES.)
* to the mode name as shown in the "{@code AES/CFB8/NoPadding}" and
* "{@code AES/OFB32/PKCS5Padding}" transformations. If no such
* number is specified, a provider-specific default is used.
* (See the
* {@extLink security_guide_jdk_providers JDK Providers Documentation}
* for the JDK Providers default values.)
* Thus, block ciphers can be turned into byte-oriented stream ciphers by
* using an 8 bit mode such as CFB8 or OFB8.
* <p>
@ -308,7 +310,7 @@ public class Cipher {
/*
* array containing the components of a Cipher transformation:
*
* index 0: algorithm component (e.g., DES)
* index 0: algorithm component (e.g., AES)
* index 1: feedback component (e.g., CFB)
* index 2: padding component (e.g., PKCS5Padding)
*/
@ -354,8 +356,8 @@ public class Cipher {
// transform string to lookup in the provider
final String transform;
// the mode/padding suffix in upper case. for example, if the algorithm
// to lookup is "DES/CBC/PKCS5Padding" suffix is "/CBC/PKCS5PADDING"
// if loopup is "DES", suffix is the empty string
// to lookup is "AES/CBC/PKCS5Padding" suffix is "/CBC/PKCS5PADDING"
// if lookup is "AES", suffix is the empty string
// needed because aliases prevent straight transform.equals()
final String suffix;
// value to pass to setMode() or null if no such call required
@ -440,11 +442,11 @@ public class Cipher {
}
if ((mode == null) && (pad == null)) {
// DES
// AES
Transform tr = new Transform(alg, "", null, null);
return Collections.singletonList(tr);
} else { // if ((mode != null) && (pad != null)) {
// DES/CBC/PKCS5Padding
// AES/CBC/PKCS5Padding
List<Transform> list = new ArrayList<>(4);
list.add(new Transform(alg, "/" + mode + "/" + pad, null, null));
list.add(new Transform(alg, "/" + mode, null, pad));
@ -488,7 +490,7 @@ public class Cipher {
* {@link Security#getProviders() Security.getProviders()}.
*
* @param transformation the name of the transformation, e.g.,
* <i>DES/CBC/PKCS5Padding</i>.
* <i>AES/CBC/PKCS5Padding</i>.
* See the Cipher section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names">
* Java Security Standard Algorithm Names Specification</a>
@ -566,7 +568,7 @@ public class Cipher {
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @param transformation the name of the transformation,
* e.g., <i>DES/CBC/PKCS5Padding</i>.
* e.g., <i>AES/CBC/PKCS5Padding</i>.
* See the Cipher section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names">
* Java Security Standard Algorithm Names Specification</a>
@ -626,7 +628,7 @@ public class Cipher {
* does not have to be registered in the provider list.
*
* @param transformation the name of the transformation,
* e.g., <i>DES/CBC/PKCS5Padding</i>.
* e.g., <i>AES/CBC/PKCS5Padding</i>.
* See the Cipher section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#cipher-algorithm-names">
* Java Security Standard Algorithm Names Specification</a>

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -59,7 +59,7 @@ import java.nio.ByteBuffer;
* <p>A <i>transformation</i> is a string that describes the operation (or
* set of operations) to be performed on the given input, to produce some
* output. A transformation always includes the name of a cryptographic
* algorithm (e.g., <i>DES</i>), and may be followed by a feedback mode and
* algorithm (e.g., <i>AES</i>), and may be followed by a feedback mode and
* padding scheme.
*
* <p> A transformation is of the form:
@ -75,7 +75,7 @@ import java.nio.ByteBuffer;
* For example, the following is a valid transformation:
*
* <pre>
* Cipher c = Cipher.getInstance("<i>DES/CBC/PKCS5Padding</i>");
* Cipher c = Cipher.getInstance("<i>AES/CBC/PKCS5Padding</i>");
* </pre>
*
* <p>A provider may supply a separate class for each combination
@ -125,32 +125,32 @@ import java.nio.ByteBuffer;
* </ul>
*
* <p>For example, a provider may supply a subclass of <code>CipherSpi</code>
* that implements <i>DES/ECB/PKCS5Padding</i>, one that implements
* <i>DES/CBC/PKCS5Padding</i>, one that implements
* <i>DES/CFB/PKCS5Padding</i>, and yet another one that implements
* <i>DES/OFB/PKCS5Padding</i>. That provider would have the following
* that implements <i>AES/ECB/PKCS5Padding</i>, one that implements
* <i>AES/CBC/PKCS5Padding</i>, one that implements
* <i>AES/CFB/PKCS5Padding</i>, and yet another one that implements
* <i>AES/OFB/PKCS5Padding</i>. That provider would have the following
* <code>Cipher</code> properties in its master class:
*
* <ul>
*
* <li>
* <pre>
* <code>Cipher.</code><i>DES/ECB/PKCS5Padding</i>
* <code>Cipher.</code><i>AES/ECB/PKCS5Padding</i>
* </pre>
*
* <li>
* <pre>
* <code>Cipher.</code><i>DES/CBC/PKCS5Padding</i>
* <code>Cipher.</code><i>AES/CBC/PKCS5Padding</i>
* </pre>
*
* <li>
* <pre>
* <code>Cipher.</code><i>DES/CFB/PKCS5Padding</i>
* <code>Cipher.</code><i>AES/CFB/PKCS5Padding</i>
* </pre>
*
* <li>
* <pre>
* <code>Cipher.</code><i>DES/OFB/PKCS5Padding</i>
* <code>Cipher.</code><i>AES/OFB/PKCS5Padding</i>
* </pre>
*
* </ul>
@ -158,7 +158,7 @@ import java.nio.ByteBuffer;
* <p>Another provider may implement a class for each of the above modes
* (i.e., one class for <i>ECB</i>, one for <i>CBC</i>, one for <i>CFB</i>,
* and one for <i>OFB</i>), one class for <i>PKCS5Padding</i>,
* and a generic <i>DES</i> class that subclasses from <code>CipherSpi</code>.
* and a generic <i>AES</i> class that subclasses from <code>CipherSpi</code>.
* That provider would have the following
* <code>Cipher</code> properties in its master class:
*
@ -166,7 +166,7 @@ import java.nio.ByteBuffer;
*
* <li>
* <pre>
* <code>Cipher.</code><i>DES</i>
* <code>Cipher.</code><i>AES</i>
* </pre>
*
* </ul>

@ -50,7 +50,7 @@ import sun.security.jca.GetInstance.Instance;
*
* <p> A MAC mechanism that is based on cryptographic hash functions is
* referred to as HMAC. HMAC can be used with any cryptographic hash function,
* e.g., MD5 or SHA-1, in combination with a secret shared key. HMAC is
* e.g., SHA256 or SHA384, in combination with a secret shared key. HMAC is
* specified in RFC 2104.
*
* <p> Every implementation of the Java platform is required to support

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,7 +40,7 @@ import java.security.NoSuchProviderException;
* <p> Given any Serializable object, one can create a SealedObject
* that encapsulates the original object, in serialized
* format (i.e., a "deep copy"), and seals (encrypts) its serialized contents,
* using a cryptographic algorithm such as DES, to protect its
* using a cryptographic algorithm such as AES, to protect its
* confidentiality. The encrypted content can later be decrypted (with
* the corresponding algorithm using the correct decryption key) and
* de-serialized, yielding the original object.

@ -25,6 +25,8 @@
package jdk.internal.logger;
import jdk.internal.misc.VM;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.HashMap;
@ -140,15 +142,9 @@ public class DefaultLoggerFinder extends LoggerFinder {
return AccessController.doPrivileged(new PrivilegedAction<>() {
@Override
public Boolean run() {
final ClassLoader moduleCL = m.getClassLoader();
if (moduleCL == null) return true;
ClassLoader cl = ClassLoader.getPlatformClassLoader();
while (cl != null && moduleCL != cl) {
cl = cl.getParent();
}
// returns true if moduleCL is the platform class loader
// or one of its ancestors.
return moduleCL == cl;
return VM.isSystemDomainLoader(m.getClassLoader());
}
});
}

@ -124,11 +124,11 @@ public class VM {
}
/**
* Returns true if the given class loader is in the system domain
* in which all permissions are granted.
* Returns true if the given class loader is the bootstrap class loader
* or the platform class loader.
*/
public static boolean isSystemDomainLoader(ClassLoader loader) {
return loader == null;
return loader == null || loader == ClassLoader.getPlatformClassLoader();
}
/**

@ -316,8 +316,7 @@ public class Reflection {
*/
public static boolean isCallerSensitive(Method m) {
final ClassLoader loader = m.getDeclaringClass().getClassLoader();
if (VM.isSystemDomainLoader(loader) ||
loader == ClassLoaders.platformClassLoader()) {
if (VM.isSystemDomainLoader(loader)) {
return m.isAnnotationPresent(CallerSensitive.class);
}
return false;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -246,13 +246,16 @@ abstract class AsynchronousChannelGroupImpl
abstract void shutdownHandlerTasks();
private void shutdownExecutors() {
AccessController.doPrivileged(new PrivilegedAction<>() {
public Void run() {
pool.executor().shutdown();
timeoutExecutor.shutdown();
return null;
}
});
AccessController.doPrivileged(
new PrivilegedAction<>() {
public Void run() {
pool.executor().shutdown();
timeoutExecutor.shutdown();
return null;
}
},
null,
new RuntimePermission("modifyThread"));
}
@Override

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import java.security.Key;
import java.security.KeyRep;
import java.security.PrivateKey;
import java.security.KeyFactory;
import java.security.MessageDigest;
import java.security.Security;
import java.security.Provider;
import java.security.InvalidKeyException;
@ -419,18 +420,9 @@ public class PKCS8Key implements PrivateKey {
// that encoding
byte[] b2 = ((Key)object).getEncoded();
// do the comparison
int i;
if (b1.length != b2.length)
return false;
for (i = 0; i < b1.length; i++) {
if (b1[i] != b2[i]) {
return false;
}
}
return true;
// time-constant comparison
return MessageDigest.isEqual(b1, b2);
}
return false;
}

@ -323,6 +323,12 @@ public class SignerInfo implements DerEncoder {
data = content.getContentBytes();
}
Timestamp timestamp = null;
try {
timestamp = getTimestamp();
} catch (Exception ignore) {
}
ConstraintsParameters cparams =
new ConstraintsParameters(timestamp);
String digestAlgname = getDigestAlgorithmId().getName();

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -64,6 +64,13 @@ abstract class DSA extends SignatureSpi {
/* Are we debugging? */
private static final boolean debug = false;
/* The number of bits used in exponent blinding */
private static final int BLINDING_BITS = 7;
/* The constant component of the exponent blinding value */
private static final BigInteger BLINDING_CONSTANT =
BigInteger.valueOf(1 << BLINDING_BITS);
/* The parameter object */
private DSAParams params;
@ -368,8 +375,19 @@ abstract class DSA extends SignatureSpi {
return null;
}
private BigInteger generateR(BigInteger p, BigInteger q, BigInteger g,
BigInteger k) {
// exponent blinding to hide information from timing channel
SecureRandom random = getSigningRandom();
// start with a random blinding component
BigInteger blindingValue = new BigInteger(BLINDING_BITS, random);
// add the fixed blinding component
blindingValue = blindingValue.add(BLINDING_CONSTANT);
// replace k with a blinded value that is congruent (mod q)
k = k.add(q.multiply(blindingValue));
BigInteger temp = g.modPow(k, p);
return temp.mod(q);
}
@ -434,43 +452,8 @@ abstract class DSA extends SignatureSpi {
byte[] kValue = new byte[(q.bitLength() + 7)/8 + 8];
random.nextBytes(kValue);
BigInteger k = new BigInteger(1, kValue).mod(
return new BigInteger(1, kValue).mod(
q.subtract(BigInteger.ONE)).add(BigInteger.ONE);
// Using an equivalent exponent of fixed length (same as q or 1 bit
// less than q) to keep the kG timing relatively constant.
//
// Note that this is an extra step on top of the approach defined in
// FIPS 186-4 AppendixB.2.1 so as to make a fixed length K.
k = k.add(q).divide(BigInteger.TWO);
// An alternative implementation based on FIPS 186-4 AppendixB2.2
// with fixed-length K.
//
// Please keep it here as we may need to switch to it in the future.
//
// SecureRandom random = getSigningRandom();
// byte[] kValue = new byte[(q.bitLength() + 7)/8];
// BigInteger d = q.subtract(BigInteger.TWO);
// BigInteger k;
// do {
// random.nextBytes(kValue);
// BigInteger c = new BigInteger(1, kValue);
// if (c.compareTo(d) <= 0) {
// k = c.add(BigInteger.ONE);
// // Using an equivalent exponent of fixed length to keep
// // the g^k timing relatively constant.
// //
// // Note that this is an extra step on top of the approach
// // defined in FIPS 186-4 AppendixB.2.2 so as to make a
// // fixed length K.
// if (k.bitLength() >= q.bitLength()) {
// break;
// }
// }
// } while (true);
return k;
}
// Use the application-specified SecureRandom Object if provided.

@ -344,7 +344,7 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi {
// add the algorithm checker
checkers.add(new AlgorithmChecker(builder.trustAnchor,
buildParams.date(), null));
buildParams.date(), buildParams.variant()));
BasicChecker basicChecker = null;
if (nextState.keyParamsNeeded()) {

@ -79,6 +79,9 @@ public abstract class HandshakeMessage {
public static final Debug debug = Debug.getInstance("ssl");
// enum HandshakeType:
//
// Please update the isUnsupported() method accordingly if the handshake
// types get updated in the future.
static final byte ht_hello_request = 0; // RFC 5246
static final byte ht_client_hello = 1; // RFC 5246
static final byte ht_server_hello = 2; // RFC 5246
@ -130,6 +133,24 @@ public abstract class HandshakeMessage {
return b;
}
static boolean isUnsupported(byte handshakeType) {
return (handshakeType != ht_hello_request) &&
(handshakeType != ht_client_hello) &&
(handshakeType != ht_server_hello) &&
(handshakeType != ht_hello_verify_request) &&
(handshakeType != ht_new_session_ticket) &&
(handshakeType != ht_certificate) &&
(handshakeType != ht_server_key_exchange) &&
(handshakeType != ht_certificate_request) &&
(handshakeType != ht_server_hello_done) &&
(handshakeType != ht_certificate_verify) &&
(handshakeType != ht_client_key_exchange) &&
(handshakeType != ht_finished) &&
(handshakeType != ht_certificate_url) &&
(handshakeType != ht_certificate_status) &&
(handshakeType != ht_supplemental_data);
}
private static byte[] genPad(int b, int count) {
byte[] padding = new byte[count];
Arrays.fill(padding, (byte)b);

@ -1034,6 +1034,12 @@ abstract class Handshaker {
input.mark(4);
messageType = (byte)input.getInt8();
if (HandshakeMessage.isUnsupported(messageType)) {
throw new SSLProtocolException(
"Received unsupported or unknown handshake message: " +
messageType);
}
messageLen = input.getInt24();
if (input.available() < messageLen) {

@ -752,7 +752,6 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
private int minSize; // the minimal available key size
private int maxSize; // the maximal available key size
private int prohibitedSize = -1; // unavailable key sizes
private int size;
public KeySizeConstraint(String algo, Operator operator, int length) {
algorithm = algo;
@ -811,8 +810,9 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
return;
}
throw new CertPathValidatorException(
"Algorithm constraints check failed on keysize limits. "
+ algorithm + " " + size + "bit key" + extendedMsg(cp),
"Algorithm constraints check failed on keysize limits. " +
algorithm + " " + KeyUtil.getKeySize(key) + "bit key" +
extendedMsg(cp),
null, null, -1, BasicReason.ALGORITHM_CONSTRAINED);
}
}
@ -864,7 +864,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
return true;
}
size = KeyUtil.getKeySize(key);
int size = KeyUtil.getKeySize(key);
if (size == 0) {
return false; // we don't allow any key of size 0.
} else if (size > 0) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import java.security.Principal;
import java.security.cert.*;
import java.util.*;
import javax.security.auth.x500.X500Principal;
import javax.net.ssl.SNIHostName;
import sun.net.util.IPAddressUtil;
import sun.security.ssl.ClientKeyExchangeService;
@ -201,6 +202,15 @@ public class HostnameChecker {
private void matchDNS(String expectedName, X509Certificate cert,
boolean chainsToPublicCA)
throws CertificateException {
// Check that the expected name is a valid domain name.
try {
// Using the checking implemented in SNIHostName
SNIHostName sni = new SNIHostName(expectedName);
} catch (IllegalArgumentException iae) {
throw new CertificateException(
"Illegal given domain name: " + expectedName, iae);
}
Collection<List<?>> subjAltNames = cert.getSubjectAlternativeNames();
if (subjAltNames != null) {
boolean foundDNS = false;
@ -277,6 +287,19 @@ public class HostnameChecker {
if (hasIllegalWildcard(name, template, chainsToPublicCA)) {
return false;
}
// check the validity of the domain name template.
try {
// Replacing wildcard character '*' with 'x' so as to check
// the domain name template validity.
//
// Using the checking implemented in SNIHostName
SNIHostName sni = new SNIHostName(template.replace('*', 'x'));
} catch (IllegalArgumentException iae) {
// It would be nice to add debug log if not matching.
return false;
}
if (checkType == TYPE_TLS) {
return matchAllWildcards(name, template);
} else if (checkType == TYPE_LDAP) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -107,6 +107,8 @@ public class ManifestEntryVerifier {
/* get the headers from the manifest for this entry */
/* if there aren't any, we can't verify any digests for this entry */
skip = false;
Attributes attr = man.getAttributes(name);
if (attr == null) {
// ugh. we should be able to remove this at some point.
@ -141,7 +143,6 @@ public class ManifestEntryVerifier {
}
if (digest != null) {
skip = false;
digest.reset();
digests.add(digest);
manifestHashes.add(
@ -197,6 +198,10 @@ public class ManifestEntryVerifier {
return null;
}
if (digests.isEmpty()) {
throw new SecurityException("digest missing for " + name);
}
if (signers != null)
return signers;

@ -1,256 +0,0 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 sun.util.locale;
import java.util.HashMap;
import java.util.Map;
/**
* Locale equivalent map for BCP47 Locale matching
*/
final class LocaleEquivalentMaps {
static final Map<String, String> singleEquivMap;
static final Map<String, String[]> multiEquivsMap;
static final Map<String, String> regionVariantEquivMap;
static {
singleEquivMap = new HashMap<>();
multiEquivsMap = new HashMap<>();
regionVariantEquivMap = new HashMap<>();
// This is an auto-generated file and should not be manually edited.
// LSR Revision: 2016-02-10
singleEquivMap.put("aam", "aas");
singleEquivMap.put("aas", "aam");
singleEquivMap.put("acn", "xia");
singleEquivMap.put("adp", "dz");
singleEquivMap.put("adx", "pcr");
singleEquivMap.put("ami", "i-ami");
singleEquivMap.put("art-lojban", "jbo");
singleEquivMap.put("ase", "sgn-us");
singleEquivMap.put("aue", "ktz");
singleEquivMap.put("ayx", "nun");
singleEquivMap.put("bfi", "sgn-gb");
singleEquivMap.put("bjd", "drl");
singleEquivMap.put("bnn", "i-bnn");
singleEquivMap.put("bzs", "sgn-br");
singleEquivMap.put("cir", "meg");
singleEquivMap.put("cjr", "mom");
singleEquivMap.put("cka", "cmr");
singleEquivMap.put("cmk", "xch");
singleEquivMap.put("cmn-hans", "zh-cmn-hans");
singleEquivMap.put("cmn-hant", "zh-cmn-hant");
singleEquivMap.put("cmr", "cka");
singleEquivMap.put("csn", "sgn-co");
singleEquivMap.put("dev", "gav");
singleEquivMap.put("drh", "khk");
singleEquivMap.put("drl", "bjd");
singleEquivMap.put("dse", "sgn-nl");
singleEquivMap.put("dsl", "sgn-dk");
singleEquivMap.put("dz", "adp");
singleEquivMap.put("ema", "uok");
singleEquivMap.put("en-gb-oed", "en-gb-oxendict");
singleEquivMap.put("en-gb-oxendict", "en-gb-oed");
singleEquivMap.put("fsl", "sgn-fr");
singleEquivMap.put("gal", "ilw");
singleEquivMap.put("gan", "zh-gan");
singleEquivMap.put("gav", "dev");
singleEquivMap.put("gsg", "sgn-de");
singleEquivMap.put("gss", "sgn-gr");
singleEquivMap.put("gti", "nyc");
singleEquivMap.put("he", "iw");
singleEquivMap.put("hle", "sca");
singleEquivMap.put("hrr", "jal");
singleEquivMap.put("hsn", "zh-xiang");
singleEquivMap.put("i-ami", "ami");
singleEquivMap.put("i-bnn", "bnn");
singleEquivMap.put("i-klingon", "tlh");
singleEquivMap.put("i-lux", "lb");
singleEquivMap.put("i-navajo", "nv");
singleEquivMap.put("i-pwn", "pwn");
singleEquivMap.put("i-tao", "tao");
singleEquivMap.put("i-tay", "tay");
singleEquivMap.put("i-tsu", "tsu");
singleEquivMap.put("ibi", "opa");
singleEquivMap.put("id", "in");
singleEquivMap.put("ilw", "gal");
singleEquivMap.put("in", "id");
singleEquivMap.put("ise", "sgn-it");
singleEquivMap.put("isg", "sgn-ie");
singleEquivMap.put("iw", "he");
singleEquivMap.put("jal", "hrr");
singleEquivMap.put("jbo", "art-lojban");
singleEquivMap.put("ji", "yi");
singleEquivMap.put("jsl", "sgn-jp");
singleEquivMap.put("jv", "jw");
singleEquivMap.put("jw", "jv");
singleEquivMap.put("kgh", "kml");
singleEquivMap.put("khk", "drh");
singleEquivMap.put("kml", "kgh");
singleEquivMap.put("koj", "kwv");
singleEquivMap.put("ktz", "aue");
singleEquivMap.put("kwq", "yam");
singleEquivMap.put("kwv", "koj");
singleEquivMap.put("kxe", "tvd");
singleEquivMap.put("lb", "i-lux");
singleEquivMap.put("lcq", "ppr");
singleEquivMap.put("lii", "raq");
singleEquivMap.put("lmm", "rmx");
singleEquivMap.put("lrr", "yma");
singleEquivMap.put("meg", "cir");
singleEquivMap.put("mfs", "sgn-mx");
singleEquivMap.put("mo", "ro");
singleEquivMap.put("mom", "cjr");
singleEquivMap.put("mtm", "ymt");
singleEquivMap.put("nan", "zh-min-nan");
singleEquivMap.put("nb", "no-bok");
singleEquivMap.put("ncs", "sgn-ni");
singleEquivMap.put("ngv", "nnx");
singleEquivMap.put("nn", "no-nyn");
singleEquivMap.put("nnx", "ngv");
singleEquivMap.put("no-bok", "nb");
singleEquivMap.put("no-nyn", "nn");
singleEquivMap.put("nsl", "sgn-no");
singleEquivMap.put("nun", "ayx");
singleEquivMap.put("nv", "i-navajo");
singleEquivMap.put("nyc", "gti");
singleEquivMap.put("opa", "ibi");
singleEquivMap.put("oyb", "thx");
singleEquivMap.put("pcr", "adx");
singleEquivMap.put("phr", "pmu");
singleEquivMap.put("pmu", "phr");
singleEquivMap.put("ppr", "lcq");
singleEquivMap.put("psr", "sgn-pt");
singleEquivMap.put("pub", "puz");
singleEquivMap.put("puz", "pub");
singleEquivMap.put("pwn", "i-pwn");
singleEquivMap.put("raq", "lii");
singleEquivMap.put("ras", "tie");
singleEquivMap.put("rmx", "lmm");
singleEquivMap.put("ro", "mo");
singleEquivMap.put("sca", "hle");
singleEquivMap.put("sfb", "sgn-be-fr");
singleEquivMap.put("sfs", "sgn-za");
singleEquivMap.put("sgg", "sgn-ch-de");
singleEquivMap.put("sgn-be-fr", "sfb");
singleEquivMap.put("sgn-be-nl", "vgt");
singleEquivMap.put("sgn-br", "bzs");
singleEquivMap.put("sgn-ch-de", "sgg");
singleEquivMap.put("sgn-co", "csn");
singleEquivMap.put("sgn-de", "gsg");
singleEquivMap.put("sgn-dk", "dsl");
singleEquivMap.put("sgn-es", "ssp");
singleEquivMap.put("sgn-fr", "fsl");
singleEquivMap.put("sgn-gb", "bfi");
singleEquivMap.put("sgn-gr", "gss");
singleEquivMap.put("sgn-ie", "isg");
singleEquivMap.put("sgn-it", "ise");
singleEquivMap.put("sgn-jp", "jsl");
singleEquivMap.put("sgn-mx", "mfs");
singleEquivMap.put("sgn-ni", "ncs");
singleEquivMap.put("sgn-nl", "dse");
singleEquivMap.put("sgn-no", "nsl");
singleEquivMap.put("sgn-pt", "psr");
singleEquivMap.put("sgn-se", "swl");
singleEquivMap.put("sgn-us", "ase");
singleEquivMap.put("sgn-za", "sfs");
singleEquivMap.put("ssp", "sgn-es");
singleEquivMap.put("suj", "xsj");
singleEquivMap.put("swl", "sgn-se");
singleEquivMap.put("taj", "tsf");
singleEquivMap.put("tao", "i-tao");
singleEquivMap.put("tay", "i-tay");
singleEquivMap.put("thx", "oyb");
singleEquivMap.put("tie", "ras");
singleEquivMap.put("tkk", "twm");
singleEquivMap.put("tlh", "i-klingon");
singleEquivMap.put("tlw", "weo");
singleEquivMap.put("tsf", "taj");
singleEquivMap.put("tsu", "i-tsu");
singleEquivMap.put("tvd", "kxe");
singleEquivMap.put("twm", "tkk");
singleEquivMap.put("uok", "ema");
singleEquivMap.put("vgt", "sgn-be-nl");
singleEquivMap.put("weo", "tlw");
singleEquivMap.put("wuu", "zh-wuu");
singleEquivMap.put("xch", "cmk");
singleEquivMap.put("xia", "acn");
singleEquivMap.put("xsj", "suj");
singleEquivMap.put("yam", "kwq");
singleEquivMap.put("yi", "ji");
singleEquivMap.put("yma", "lrr");
singleEquivMap.put("ymt", "mtm");
singleEquivMap.put("yos", "zom");
singleEquivMap.put("yue", "zh-yue");
singleEquivMap.put("yug", "yuu");
singleEquivMap.put("yuu", "yug");
singleEquivMap.put("zh-cmn-hans", "cmn-hans");
singleEquivMap.put("zh-cmn-hant", "cmn-hant");
singleEquivMap.put("zh-gan", "gan");
singleEquivMap.put("zh-min-nan", "nan");
singleEquivMap.put("zh-wuu", "wuu");
singleEquivMap.put("zh-xiang", "hsn");
singleEquivMap.put("zh-yue", "yue");
singleEquivMap.put("zom", "yos");
multiEquivsMap.put("ccq", new String[] {"rki", "ybd"});
multiEquivsMap.put("cmn", new String[] {"zh-guoyu", "zh-cmn"});
multiEquivsMap.put("drw", new String[] {"prs", "tnf"});
multiEquivsMap.put("gfx", new String[] {"vaj", "mwj", "oun"});
multiEquivsMap.put("hak", new String[] {"i-hak", "zh-hakka"});
multiEquivsMap.put("i-hak", new String[] {"hak", "zh-hakka"});
multiEquivsMap.put("mry", new String[] {"mst", "myt"});
multiEquivsMap.put("mst", new String[] {"mry", "myt"});
multiEquivsMap.put("mwj", new String[] {"vaj", "gfx", "oun"});
multiEquivsMap.put("myt", new String[] {"mry", "mst"});
multiEquivsMap.put("oun", new String[] {"vaj", "gfx", "mwj"});
multiEquivsMap.put("prs", new String[] {"drw", "tnf"});
multiEquivsMap.put("rki", new String[] {"ccq", "ybd"});
multiEquivsMap.put("tnf", new String[] {"prs", "drw"});
multiEquivsMap.put("vaj", new String[] {"gfx", "mwj", "oun"});
multiEquivsMap.put("ybd", new String[] {"rki", "ccq"});
multiEquivsMap.put("zh-cmn", new String[] {"cmn", "zh-guoyu"});
multiEquivsMap.put("zh-guoyu", new String[] {"cmn", "zh-cmn"});
multiEquivsMap.put("zh-hakka", new String[] {"hak", "i-hak"});
regionVariantEquivMap.put("-alalc97", "-heploc");
regionVariantEquivMap.put("-bu", "-mm");
regionVariantEquivMap.put("-cd", "-zr");
regionVariantEquivMap.put("-dd", "-de");
regionVariantEquivMap.put("-de", "-dd");
regionVariantEquivMap.put("-fr", "-fx");
regionVariantEquivMap.put("-fx", "-fr");
regionVariantEquivMap.put("-heploc", "-alalc97");
regionVariantEquivMap.put("-mm", "-bu");
regionVariantEquivMap.put("-tl", "-tp");
regionVariantEquivMap.put("-tp", "-tl");
regionVariantEquivMap.put("-yd", "-ye");
regionVariantEquivMap.put("-ye", "-yd");
regionVariantEquivMap.put("-zr", "-cd");
}
}

@ -545,21 +545,21 @@ krb5.kdc.bad.policy = tryLast
# jdkCA
# This constraint prohibits the specified algorithm only if the
# algorithm is used in a certificate chain that terminates at a marked
# trust anchor in the lib/security/cacerts keystore. If the jdkCA
# constraint is not set, then all chains using the specified algorithm
# trust anchor in the lib/security/cacerts keystore. If the jdkCA
# constraint is not set, then all chains using the specified algorithm
# are restricted. jdkCA may only be used once in a DisabledAlgorithm
# expression.
# Example:  To apply this constraint to SHA-1 certificates, include
# the following:  "SHA1 jdkCA"
# Example: To apply this constraint to SHA-1 certificates, include
# the following: "SHA1 jdkCA"
#
# DenyAfterConstraint:
# denyAfter YYYY-MM-DD
# This constraint prohibits a certificate with the specified algorithm
# from being used after the date regardless of the certificate's
# validity.  JAR files that are signed and timestamped before the
# validity. JAR files that are signed and timestamped before the
# constraint date with certificates containing the disabled algorithm
# will not be restricted.  The date is processed in the UTC timezone.
# This constraint can only be used once in a DisabledAlgorithm
# will not be restricted. The date is processed in the UTC timezone.
# This constraint can only be used once in a DisabledAlgorithm
# expression.
# Example: To deny usage of RSA 2048 bit certificates after Feb 3 2020,
# use the following: "RSA keySize == 2048 & denyAfter 2020-02-03"

@ -459,6 +459,8 @@ static void *CCalloc(context_type *context, int size, jboolean zero);
static fullinfo_type cp_index_to_class_fullinfo(context_type *, int, int);
static const char* get_result_signature(const char* signature);
static char signature_to_fieldtype(context_type *context,
const char **signature_p, fullinfo_type *info);
@ -2789,7 +2791,7 @@ push_stack(context_type *context, unsigned int inumber, stack_info_type *new_sta
operand);
const char *result_signature;
check_and_push(context, signature, VM_STRING_UTF);
result_signature = strchr(signature, JVM_SIGNATURE_ENDFUNC);
result_signature = get_result_signature(signature);
if (result_signature++ == NULL) {
CCerror(context, "Illegal signature %s", signature);
}
@ -3712,6 +3714,42 @@ CFerror(context_type *context, char *format, ...)
longjmp(context->jump_buffer, 1);
}
/*
* Need to scan the entire signature to find the result type because
* types in the arg list and the result type could contain embedded ')'s.
*/
static const char* get_result_signature(const char* signature) {
const char *p;
for (p = signature; *p != JVM_SIGNATURE_ENDFUNC; p++) {
switch (*p) {
case JVM_SIGNATURE_BOOLEAN:
case JVM_SIGNATURE_BYTE:
case JVM_SIGNATURE_CHAR:
case JVM_SIGNATURE_SHORT:
case JVM_SIGNATURE_INT:
case JVM_SIGNATURE_FLOAT:
case JVM_SIGNATURE_DOUBLE:
case JVM_SIGNATURE_LONG:
case JVM_SIGNATURE_FUNC: /* ignore initial (, if given */
break;
case JVM_SIGNATURE_CLASS:
while (*p != JVM_SIGNATURE_ENDCLASS) p++;
break;
case JVM_SIGNATURE_ARRAY:
while (*p == JVM_SIGNATURE_ARRAY) p++;
/* If an array of classes, skip over class name, too. */
if (*p == JVM_SIGNATURE_CLASS) {
while (*p != JVM_SIGNATURE_ENDCLASS) p++;
}
break;
default:
/* Indicate an error. */
return NULL;
}
}
return p++; /* skip over ')'. */
}
static char
signature_to_fieldtype(context_type *context,
const char **signature_p, fullinfo_type *full_info_p)

@ -505,6 +505,8 @@ int ZEXPORT deflateResetKeep (strm)
s->pending = 0;
s->pending_out = s->pending_buf;
s->high_water = 0; /* reset to its inital value 0 */
if (s->wrap < 0) {
s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
}

@ -76,6 +76,21 @@
> n = len;
--------------------------
(6) deflate.c #8184306
*** 503,512 ****
--- 503,514 ----
s = (deflate_state *)strm->state;
s->pending = 0;
s->pending_out = s->pending_buf;
+ s->high_water = 0; /* reset to its inital value 0 */
+
if (s->wrap < 0) {
s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
}
s->status =
#ifdef GZIP

@ -392,6 +392,17 @@ public class JPEGImageReader extends ImageReader {
}
}
private void skipPastImage(int imageIndex) {
cbLock.lock();
try {
gotoImage(imageIndex);
skipImage();
} catch (IOException | IndexOutOfBoundsException e) {
} finally {
cbLock.unlock();
}
}
@SuppressWarnings("fallthrough")
private int getNumImagesOnThread(boolean allowSearch)
throws IOException {
@ -1340,7 +1351,8 @@ public class JPEGImageReader extends ImageReader {
* just a 1-line intermediate data transfer buffer that will not
* affect the acceleration of the resulting image.
*/
boolean aborted = readImage(structPointer,
boolean aborted = readImage(imageIndex,
structPointer,
buffer.getData(),
numRasterBands,
srcBands,
@ -1502,7 +1514,8 @@ public class JPEGImageReader extends ImageReader {
/**
* Returns {@code true} if the read was aborted.
*/
private native boolean readImage(long structPointer,
private native boolean readImage(int imageIndex,
long structPointer,
byte [] buffer,
int numRasterBands,
int [] srcBands,

@ -26,6 +26,9 @@
package javax.imageio.spi;
import java.io.File;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@ -755,13 +758,14 @@ class SubRegistry {
Class<?> category;
// Provider Objects organized by partial oridering
PartiallyOrderedSet<Object> poset = new PartiallyOrderedSet<>();
// Provider Objects organized by partial ordering
final PartiallyOrderedSet<Object> poset = new PartiallyOrderedSet<>();
// Class -> Provider Object of that class
// No way to express heterogeneous map, we want
// Map<Class<T>, T>, where T is ?
Map<Class<?>, Object> map = new HashMap<>();
final Map<Class<?>, Object> map = new HashMap<>();
final Map<Class<?>, AccessControlContext> accMap = new HashMap<>();
public SubRegistry(ServiceRegistry registry, Class<?> category) {
this.registry = registry;
@ -776,6 +780,7 @@ class SubRegistry {
deregisterServiceProvider(oprovider);
}
map.put(provider.getClass(), provider);
accMap.put(provider.getClass(), AccessController.getContext());
poset.add(provider);
if (provider instanceof RegisterableService) {
RegisterableService rs = (RegisterableService)provider;
@ -800,6 +805,7 @@ class SubRegistry {
if (provider == oprovider) {
map.remove(provider.getClass());
accMap.remove(provider.getClass());
poset.remove(provider);
if (provider instanceof RegisterableService) {
RegisterableService rs = (RegisterableService)provider;
@ -849,10 +855,17 @@ class SubRegistry {
if (provider instanceof RegisterableService) {
RegisterableService rs = (RegisterableService)provider;
rs.onDeregistration(registry, category);
AccessControlContext acc = accMap.get(provider.getClass());
if (acc != null || System.getSecurityManager() == null) {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
rs.onDeregistration(registry, category);
return null;
}, acc);
}
}
}
poset.clear();
accMap.clear();
}
@SuppressWarnings("deprecation")

@ -29,6 +29,10 @@ import java.lang.ref.WeakReference;
import java.awt.Image;
import java.awt.image.ImageObserver;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.PrivilegedAction;
public abstract class ImageWatched {
public static Link endlink = new Link();
@ -85,16 +89,26 @@ public abstract class ImageWatched {
}
}
static class AccWeakReference<T> extends WeakReference<T> {
private final AccessControlContext acc;
AccWeakReference(T ref) {
super(ref);
acc = AccessController.getContext();
}
}
/*
* Standard Link implementation to manage a Weak Reference
* to an ImageObserver.
*/
public static class WeakLink extends Link {
private WeakReference<ImageObserver> myref;
private final AccWeakReference<ImageObserver> myref;
private Link next;
public WeakLink(ImageObserver obs, Link next) {
myref = new WeakReference<ImageObserver>(obs);
myref = new AccWeakReference<ImageObserver>(obs);
this.next = next;
}
@ -120,6 +134,19 @@ public abstract class ImageWatched {
return this;
}
private static boolean update(ImageObserver iw, AccessControlContext acc,
Image img, int info,
int x, int y, int w, int h) {
if (acc != null || System.getSecurityManager() != null) {
return AccessController.doPrivileged(
(PrivilegedAction<Boolean>) () -> {
return iw.imageUpdate(img, info, x, y, w, h);
}, acc);
}
return false;
}
public boolean newInfo(Image img, int info,
int x, int y, int w, int h)
{
@ -129,7 +156,7 @@ public abstract class ImageWatched {
if (myiw == null) {
// My referent is null so we must prune in a second pass.
ret = true;
} else if (myiw.imageUpdate(img, info, x, y, w, h) == false) {
} else if (update(myiw, myref.acc, img, info, x, y, w, h) == false) {
// My referent has lost interest so clear it and ask
// for a pruning pass to remove it later.
myref.clear();

@ -72,6 +72,7 @@ static jmethodID JPEGImageReader_acceptPixelsID;
static jmethodID JPEGImageReader_pushBackID;
static jmethodID JPEGImageReader_passStartedID;
static jmethodID JPEGImageReader_passCompleteID;
static jmethodID JPEGImageReader_skipPastImageID;
static jmethodID JPEGImageWriter_writeOutputDataID;
static jmethodID JPEGImageWriter_warningOccurredID;
static jmethodID JPEGImageWriter_warningWithMessageID;
@ -1472,6 +1473,10 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs
cls,
"pushBack",
"(I)V"));
CHECK_NULL(JPEGImageReader_skipPastImageID = (*env)->GetMethodID(env,
cls,
"skipPastImage",
"(I)V"));
CHECK_NULL(JPEGQTable_tableID = (*env)->GetFieldID(env,
qTableClass,
"qTable",
@ -1853,6 +1858,7 @@ JNIEXPORT jboolean JNICALL
Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage
(JNIEnv *env,
jobject this,
jint imageIndex,
jlong ptr,
jbyteArray buffer,
jint numBands,
@ -2181,12 +2187,23 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage
* We are done, but we might not have read all the lines, or all
* the passes, so use jpeg_abort instead of jpeg_finish_decompress.
*/
if (cinfo->output_scanline == cinfo->output_height) {
// if ((cinfo->output_scanline == cinfo->output_height) &&
//(jpeg_input_complete(cinfo))) { // We read the whole file
jpeg_finish_decompress(cinfo);
} else {
if ((cinfo->output_scanline != cinfo->output_height) ||
data->abortFlag == JNI_TRUE)
{
jpeg_abort_decompress(cinfo);
} else if ((!jpeg_input_complete(cinfo)) &&
(progressive &&
(cinfo->input_scan_number > maxProgressivePass))) {
/* We haven't reached EOI, but we need to skip to there */
(*cinfo->src->term_source) (cinfo);
/* We can use jpeg_abort to release memory and reset global_state */
jpeg_abort((j_common_ptr) cinfo);
(*env)->CallVoidMethod(env,
this,
JPEGImageReader_skipPastImageID,
imageIndex);
} else {
jpeg_finish_decompress(cinfo);
}
free(scanLinePtr);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -73,8 +73,8 @@ import javax.security.auth.Subject;
* must not be null; the behavior is unspecified if it is.</p>
*
* <p>Class loading aspects are detailed in the
* <a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
* JMX Specification, version 1.4</a> PDF document.</p>
* <a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
* JMX Specification, version 1.4</a></p>
*
* <p>Most methods in this interface parallel methods in the {@link
* MBeanServerConnection} interface. Where an aspect of the behavior

@ -2,7 +2,7 @@
<head>
<title>RMI connector</title>
<!--
Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -316,19 +316,8 @@ questions.
<p>If an RMI connector client or server receives from its peer an
instance of a class that it does not know, and if dynamic code
downloading is active for the RMI connection, then the class can
be downloaded from a codebase specified by the peer. The
article <a
href="{@docRoot}/../technotes/guides/rmi/codebase.html"><em>Dynamic
code downloading using Java RMI</em></a> explains this in more
detail.</p>
@see <a href="{@docRoot}/../technotes/guides/rmi/index.html">
Java&trade; Remote Method
Invocation (RMI)</a>
@see <a href="{@docRoot}/../technotes/guides/jndi/index.html">
Java Naming and Directory Interface&trade; (JNDI)</a>
be downloaded from a codebase specified by the peer.
{@extLink rmi_guide Java RMI Guide} explains this in more detail.</p>
@see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045,
section 6.8, "Base64 Content-Transfer-Encoding"</a>

@ -588,8 +588,8 @@ public class ManagementFactory {
Class<T> mxbeanInterface)
throws java.io.IOException {
// Only allow MXBean interfaces from rt.jar loaded by the
// bootstrap class loader
// Only allow MXBean interfaces from the platform modules loaded by the
// bootstrap or platform class loader
final Class<?> cls = mxbeanInterface;
ClassLoader loader =
AccessController.doPrivileged(

@ -2,7 +2,7 @@
<head>
<title>javax.management.loading package</title>
<!--
Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -67,11 +67,8 @@ questions.
<code>PrivateClassLoader</code>.</p>
<p id="spec">
@see <a href="{@docRoot}/../technotes/guides/jmx/">
Java Platform documentation on JMX technology</a>,
in particular the
<a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
JMX Specification, version 1.4(pdf).</a>
@see <a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a>
@since 1.5
</BODY>

@ -2,7 +2,7 @@
<head>
<title>javax.management.modelmbean package</title>
<!--
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -114,9 +114,8 @@ mbs.invoke(mapName, "get", new Object[] {"key"}, new String[] {Object.class.getN
<ul>
<li>See the <i>JMX 1.4 Specification</i>
PDF document available from the
<a href="{@docRoot}/../technotes/guides/jmx/">
Java Platform documentation on JMX technology</a>
<a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a>
</ul>
@since 1.5

@ -2,7 +2,7 @@
<head>
<title>javax.management.monitor package</title>
<!--
Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -184,11 +184,8 @@ questions.
</li>
</ul>
<p id="spec">
@see <a href="{@docRoot}/../technotes/guides/jmx/">
Java Platform documentation on JMX technology</a>,
in particular the
<a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
JMX Specification, version 1.4(pdf).</a>
@see <a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a>
@since 1.5
</BODY>

@ -2,7 +2,7 @@
<head>
<title>javax.management.openmbean package</title>
<!--
Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -142,10 +142,7 @@ questions.
then {@code minValue} must not be greater than {@code maxValue}.
</ul>
@see <a href="{@docRoot}/../technotes/guides/jmx/">
Java Platform documentation on JMX technology</a>,
in particular the
<a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
@see <a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a>
@since 1.5

@ -2,7 +2,7 @@
<head>
<title>javax.management package</title>
<!--
Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -389,11 +389,8 @@ questions.
</ul>
<p id="spec">
@see <a href="{@docRoot}/../technotes/guides/jmx/index.html">
Java Platform documentation on JMX technology</a>
in particular the
<a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
JMX Specification, version 1.4(pdf).</a>
@see <a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a>
@since 1.5

@ -2,7 +2,7 @@
<head>
<title>javax.management.relation package</title>
<!--
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -136,10 +136,7 @@ Set&lt;ObjectName&gt; dependentASet = dependentAMap.keySet();
// Set of ObjectName containing moduleB
</pre>
@see <a href="{@docRoot}/../technotes/guides/jmx/">
Java Platform documentation on JMX technology</a>,
in particular the
<a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
@see <a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a>
@since 1.5

@ -2,7 +2,7 @@
<head>
<title>JMX&trade; Remote API.</title>
<!--
Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@ -32,8 +32,8 @@ questions.
This package defines the essential interfaces for making a JMX
MBean server manageable remotely. The specification of this
functionality is completed by Part III of the
<a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
JMX Specification, version 1.4</a> PDF document.</p>
<a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a></p>
<p>The JMX specification defines the notion of <b>connectors</b>.
A connector is attached to a JMX API MBean server and makes it
@ -194,10 +194,7 @@ rmi://192.18.1.9 username 1
connector server.</p>
@see <a href="{@docRoot}/../technotes/guides/jmx/">
Java Platform documentation on JMX technology</a>,
in particular the
<a href="{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf">
@see <a href="https://jcp.org/aboutJava/communityprocess/mrel/jsr160/index2.html">
JMX Specification, version 1.4</a>
@since 1.5

@ -1234,6 +1234,7 @@ public final class LdapClient implements PooledConnection {
static final int LDAP_REF_FOLLOW = 0x01; // follow referrals
static final int LDAP_REF_THROW = 0x02; // throw referral ex.
static final int LDAP_REF_IGNORE = 0x03; // ignore referrals
static final int LDAP_REF_FOLLOW_SCHEME = 0x04; // follow referrals of the same scheme
static final String LDAP_URL = "ldap://"; // LDAPv3
static final String LDAPS_URL = "ldaps://"; // LDAPv3

@ -2414,6 +2414,9 @@ final public class LdapCtx extends ComponentDirContext
// First determine the referral mode
if (ref != null) {
switch (ref) {
case "follow-scheme":
handleReferrals = LdapClient.LDAP_REF_FOLLOW_SCHEME;
break;
case "follow":
handleReferrals = LdapClient.LDAP_REF_FOLLOW;
break;
@ -2979,8 +2982,23 @@ final public class LdapCtx extends ComponentDirContext
r = new LdapReferralException(resolvedName, resolvedObj, remainName,
msg, envprops, fullDN, handleReferrals, reqCtls);
// only one set of URLs is present
r.setReferralInfo(res.referrals == null ? null :
res.referrals.elementAt(0), false);
Vector<String> refs;
if (res.referrals == null) {
refs = null;
} else if (handleReferrals == LdapClient.LDAP_REF_FOLLOW_SCHEME) {
refs = new Vector<>();
for (String s : res.referrals.elementAt(0)) {
if (s.startsWith("ldap:")) {
refs.add(s);
}
}
if (refs.isEmpty()) {
refs = null;
}
} else {
refs = res.referrals.elementAt(0);
}
r.setReferralInfo(refs, false);
if (hopCount > 1) {
r.setHopCount(hopCount);

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -117,7 +117,8 @@ final public class LdapReferralException extends
// If following referral, request controls are passed to referral ctx
this.reqCtls =
(handleReferrals == LdapClient.LDAP_REF_FOLLOW ? reqCtls : null);
(handleReferrals == LdapClient.LDAP_REF_FOLLOW ||
handleReferrals == LdapClient.LDAP_REF_FOLLOW_SCHEME ? reqCtls : null);
}
/**

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