diff --git a/.hgtags b/.hgtags
index a38996c9f81..02c963d4e45 100644
--- a/.hgtags
+++ b/.hgtags
@@ -296,3 +296,4 @@ b2f9702efbe95527ea3a991474fda23987ff1c5c jdk9-b48
6efe265424e3f1ea596408a1f71baf2de316c772 jdk9-b51
d6224d6021459ac8b3832e822f5acc849fa944af jdk9-b52
874d76e4699dfcd61ae1826c9fe0ddc1610ad598 jdk9-b53
+82cd31c5d6ca8d4c1653f4eb1c09eb2d9a3b2813 jdk9-b54
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 3f0dfcd4c01..26a93cd5862 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -296,3 +296,4 @@ d1f37d39ff2421f956a6ddf316cf763807bc3363 jdk9-b50
6207b4b8731ca75c51b031c47daa813ab92ef558 jdk9-b51
1822e59f17121b09e7899cf338cfb6e37fe5fceb jdk9-b52
d6ed47125a76cd1cf8a100568507bfb5e9669d9f jdk9-b53
+cb7367141e910e265b8344a8facee740bd1e5467 jdk9-b54
diff --git a/corba/.hgtags b/corba/.hgtags
index 44432f01614..c5b68217544 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -296,3 +296,4 @@ a13c49c5f2899b702652a460ed7aa73123e671e6 jdk9-b48
2309c02386d1fa4ced5051873ffb9e04874f7a44 jdk9-b51
b8538bbb6f224ab1dabba579137099c166ad4724 jdk9-b52
aadc16ca5ab7d56f92ef9dbfa443595a939241b4 jdk9-b53
+d469c5ad0c763e325a78e0af3016878a57dfc5cc jdk9-b54
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 756de55c3cc..69d0b8f6543 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -456,3 +456,4 @@ e0947f58c9c1426aa0d98b98ebb78357b27a7b99 jdk9-b50
403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51
9fb7fdc554db5be5c5b10f88f529ec3b870c44e3 jdk9-b52
effd5ef0c3eb4bb85aa975c489d6761dbf13ad6a jdk9-b53
+c3b117fa5bdedfafd9ed236403e6d406911195b1 jdk9-b54
diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
index b0d4280a4d3..89973056451 100644
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2014 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -2204,7 +2204,8 @@ void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register t
// Write the card table byte if needed.
void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) {
- CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set();
+ CardTableModRefBS* bs =
+ barrier_set_cast(Universe::heap()->barrier_set());
assert(bs->kind() == BarrierSet::CardTableModRef ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
#ifdef ASSERT
@@ -2310,9 +2311,8 @@ void MacroAssembler::g1_write_barrier_post(Register Rstore_addr, Register Rnew_v
Label& filtered = (filtered_ext != NULL) ? *filtered_ext : filtered_int;
assert_different_registers(Rstore_addr, Rnew_val, Rtmp1, Rtmp2);
- G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::G1SATBCT ||
- bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier");
+ G1SATBCardTableLoggingModRefBS* bs =
+ barrier_set_cast(Universe::heap()->barrier_set());
// Does store cross heap regions?
if (G1RSBarrierRegionFilter) {
diff --git a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
index 43258ce2a9a..6c085197515 100644
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
@@ -694,7 +694,7 @@ class StubGenerator: public StubCodeGenerator {
__ release();
}
- CardTableModRefBS* const ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* const ct = barrier_set_cast(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
assert_different_registers(addr, count, tmp);
diff --git a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp
index 9f9fc75bd1b..c27f81abd6d 100644
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -916,7 +916,7 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
Register cardtable = G5;
Register tmp = G1_scratch;
Register tmp2 = G3_scratch;
- jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base;
+ jbyte* byte_map_base = barrier_set_cast(bs)->byte_map_base;
Label not_already_dirty, restart, refill, young_card;
diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
index 226b80daade..3a932ccee55 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -3858,9 +3858,8 @@ void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val
if (new_val == G0) return;
- G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::G1SATBCT ||
- bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier");
+ G1SATBCardTableLoggingModRefBS* bs =
+ barrier_set_cast(Universe::heap()->barrier_set());
if (G1RSBarrierRegionFilter) {
xor3(store_addr, new_val, tmp);
@@ -3904,7 +3903,8 @@ void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val
void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_val, Register tmp) {
// If we're writing constant NULL, we can skip the write barrier.
if (new_val == G0) return;
- CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set();
+ CardTableModRefBS* bs =
+ barrier_set_cast(Universe::heap()->barrier_set());
assert(bs->kind() == BarrierSet::CardTableModRef ||
bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
card_table_write(bs->byte_map_base, tmp, store_addr);
diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
index 780120bd60d..196bc8d4840 100644
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1019,7 +1019,7 @@ class StubGenerator: public StubCodeGenerator {
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
{
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
assert_different_registers(addr, count, tmp);
diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
index 63da256a7a9..fa7e8c3dd0f 100644
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1718,8 +1718,8 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
// arg0: store_address
Address store_addr(rbp, 2*BytesPerWord);
- BarrierSet* bs = Universe::heap()->barrier_set();
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct =
+ barrier_set_cast(Universe::heap()->barrier_set());
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label done;
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index 85c738ad4ed..32af915065d 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -4204,8 +4204,8 @@ void MacroAssembler::g1_write_barrier_post(Register store_addr,
Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
PtrQueue::byte_offset_of_buf()));
- BarrierSet* bs = Universe::heap()->barrier_set();
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct =
+ barrier_set_cast(Universe::heap()->barrier_set());
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label done;
@@ -4305,7 +4305,7 @@ void MacroAssembler::store_check_part_1(Register obj) {
void MacroAssembler::store_check_part_2(Register obj) {
BarrierSet* bs = Universe::heap()->barrier_set();
assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
// The calculation for byte_map_base is as follows:
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
index 1622fe5ffc5..086ac2f2ba6 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -752,7 +752,7 @@ class StubGenerator: public StubCodeGenerator {
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
{
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label L_loop;
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index c3c2500126d..7f6dbc83847 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1272,7 +1272,7 @@ class StubGenerator: public StubCodeGenerator {
case BarrierSet::CardTableModRef:
case BarrierSet::CardTableExtension:
{
- CardTableModRefBS* ct = (CardTableModRefBS*)bs;
+ CardTableModRefBS* ct = barrier_set_cast(bs);
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
Label L_loop;
diff --git a/hotspot/src/os/windows/vm/attachListener_windows.cpp b/hotspot/src/os/windows/vm/attachListener_windows.cpp
index 3b3d0ca9d08..916118eb9fa 100644
--- a/hotspot/src/os/windows/vm/attachListener_windows.cpp
+++ b/hotspot/src/os/windows/vm/attachListener_windows.cpp
@@ -62,7 +62,7 @@ class Win32AttachOperation;
class Win32AttachListener: AllStatic {
private:
enum {
- preallocate_count = 4 // number of preallocated operations
+ max_enqueued_operations = 4
};
// protects the preallocated list and the operation list
@@ -83,9 +83,12 @@ class Win32AttachListener: AllStatic {
static void set_tail(Win32AttachOperation* tail) { _tail = tail; }
- // used to wakeup the listener
- static HANDLE _wakeup;
- static HANDLE wakeup() { return _wakeup; }
+ // A semaphore is used for communication about enqueued operations.
+ // The maximum count for the semaphore object will be set to "max_enqueued_operations".
+ // The state of a semaphore is signaled when its count is greater than
+ // zero (there are operations enqueued), and nonsignaled when it is zero.
+ static HANDLE _enqueued_ops_semaphore;
+ static HANDLE enqueued_ops_semaphore() { return _enqueued_ops_semaphore; }
public:
enum {
@@ -110,7 +113,7 @@ class Win32AttachListener: AllStatic {
// statics
HANDLE Win32AttachListener::_mutex;
-HANDLE Win32AttachListener::_wakeup;
+HANDLE Win32AttachListener::_enqueued_ops_semaphore;
Win32AttachOperation* Win32AttachListener::_avail;
Win32AttachOperation* Win32AttachListener::_head;
Win32AttachOperation* Win32AttachListener::_tail;
@@ -155,20 +158,19 @@ class Win32AttachOperation: public AttachOperation {
};
-// preallocate the required number of operations
+// Preallocate the maximum number of operations that can be enqueued.
int Win32AttachListener::init() {
_mutex = (void*)::CreateMutex(NULL, FALSE, NULL);
guarantee(_mutex != (HANDLE)NULL, "mutex creation failed");
- _wakeup = ::CreateSemaphore(NULL, 0, 1, NULL);
- guarantee(_wakeup != (HANDLE)NULL, "semaphore creation failed");
+ _enqueued_ops_semaphore = ::CreateSemaphore(NULL, 0, max_enqueued_operations, NULL);
+ guarantee(_enqueued_ops_semaphore != (HANDLE)NULL, "semaphore creation failed");
set_head(NULL);
set_tail(NULL);
-
- // preallocate a few operations
set_available(NULL);
- for (int i=0; iset_next(available());
set_available(op);
@@ -221,8 +223,12 @@ int Win32AttachListener::enqueue(char* cmd, char* arg0, char* arg1, char* arg2,
op->set_arg(2, arg2);
op->set_pipe(pipename);
- // wakeup the thread waiting for operations
- ::ReleaseSemaphore(wakeup(), 1, NULL);
+ // Increment number of enqueued operations.
+ // Side effect: Semaphore will be signaled and will release
+ // any blocking waiters (i.e. the AttachListener thread).
+ BOOL not_exceeding_semaphore_maximum_count =
+ ::ReleaseSemaphore(enqueued_ops_semaphore(), 1, NULL);
+ guarantee(not_exceeding_semaphore_maximum_count, "invariant");
}
::ReleaseMutex(mutex());
@@ -230,10 +236,12 @@ int Win32AttachListener::enqueue(char* cmd, char* arg0, char* arg1, char* arg2,
}
-// dequeue the operation from the head of the operation list. If
+// dequeue the operation from the head of the operation list.
Win32AttachOperation* Win32AttachListener::dequeue() {
for (;;) {
- DWORD res = ::WaitForSingleObject(wakeup(), INFINITE);
+ DWORD res = ::WaitForSingleObject(enqueued_ops_semaphore(), INFINITE);
+ // returning from WaitForSingleObject will have decreased
+ // the current count of the semaphore by 1.
guarantee(res == WAIT_OBJECT_0, "wait failed");
res = ::WaitForSingleObject(mutex(), INFINITE);
diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp
index 4e0563a6a68..92640ccc7ea 100644
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2105,8 +2105,14 @@ void LIR_OpProfileCall::print_instr(outputStream* out) const {
// LIR_OpProfileType
void LIR_OpProfileType::print_instr(outputStream* out) const {
- out->print("exact = "); exact_klass()->print_name_on(out);
- out->print("current = "); ciTypeEntries::print_ciklass(out, current_klass());
+ out->print("exact = ");
+ if (exact_klass() == NULL) {
+ out->print("unknown");
+ } else {
+ exact_klass()->print_name_on(out);
+ }
+ out->print(" current = "); ciTypeEntries::print_ciklass(out, current_klass());
+ out->print(" ");
mdp()->print(out); out->print(" ");
obj()->print(out); out->print(" ");
tmp()->print(out); out->print(" ");
diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
index 0a1e7410503..a606b7bf843 100644
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
@@ -1582,9 +1582,9 @@ void LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_Opr
////////////////////////////////////////////////////////////////////////
void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
-
- assert(sizeof(*((CardTableModRefBS*)_bs)->byte_map_base) == sizeof(jbyte), "adjust this code");
- LIR_Const* card_table_base = new LIR_Const(((CardTableModRefBS*)_bs)->byte_map_base);
+ CardTableModRefBS* ct = barrier_set_cast(_bs);
+ assert(sizeof(*(ct->byte_map_base)) == sizeof(jbyte), "adjust this code");
+ LIR_Const* card_table_base = new LIR_Const(ct->byte_map_base);
if (addr->is_address()) {
LIR_Address* address = addr->as_address_ptr();
// ptr cannot be an object because we use this barrier for array card marks
@@ -1609,7 +1609,6 @@ void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc*
__ move(new LIR_Address(FrameMap::Rthread_opr, in_bytes(JavaThread::card_table_base_offset()), T_ADDRESS), tmp);
}
- CardTableModRefBS* ct = (CardTableModRefBS*)_bs;
LIR_Address *card_addr = new LIR_Address(tmp, addr, (LIR_Address::Scale) -CardTableModRefBS::card_shift, 0, T_BYTE);
if(((int)ct->byte_map_base & 0xff) == 0) {
__ move(tmp, card_addr);
diff --git a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp
index 634878e62e9..a647d8553c9 100644
--- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp
@@ -43,7 +43,7 @@
#define TRACE_BCEA(level, code)
#endif
-// Maintain a map of which aguments a local variable or
+// Maintain a map of which arguments a local variable or
// stack slot may contain. In addition to tracking
// arguments, it tracks two special values, "allocated"
// which represents any object allocated in the current
@@ -319,14 +319,16 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod*
bool must_record_dependencies = false;
for (i = arg_size - 1; i >= 0; i--) {
ArgumentMap arg = state.raw_pop();
- if (!is_argument(arg))
+ // Check if callee arg is a caller arg or an allocated object
+ bool allocated = arg.contains_allocated();
+ if (!(is_argument(arg) || allocated))
continue;
for (int j = 0; j < _arg_size; j++) {
if (arg.contains(j)) {
_arg_modified[j] |= analyzer._arg_modified[i];
}
}
- if (!is_arg_stack(arg)) {
+ if (!(is_arg_stack(arg) || allocated)) {
// arguments have already been recognized as escaping
} else if (analyzer.is_arg_stack(i) && !analyzer.is_arg_returned(i)) {
set_method_escape(arg);
@@ -1392,12 +1394,12 @@ void BCEscapeAnalyzer::dump() {
method()->print_short_name();
tty->print_cr(has_dependencies() ? " (not stored)" : "");
tty->print(" non-escaping args: ");
- _arg_local.print_on(tty);
+ _arg_local.print();
tty->print(" stack-allocatable args: ");
- _arg_stack.print_on(tty);
+ _arg_stack.print();
if (_return_local) {
tty->print(" returned args: ");
- _arg_returned.print_on(tty);
+ _arg_returned.print();
} else if (is_return_allocated()) {
tty->print_cr(" return allocated value");
} else {
diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp
index 65a38fe037c..5cc8a6844ae 100644
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1091,6 +1091,7 @@ static void merge_in_new_methods(InstanceKlass* klass,
}
// update idnum for new location
merged_methods->at(i)->set_method_idnum(i);
+ merged_methods->at(i)->set_orig_method_idnum(i);
}
// Verify correct order
diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp
index 4228fc2f561..25323c595f6 100644
--- a/hotspot/src/share/vm/code/codeCache.cpp
+++ b/hotspot/src/share/vm/code/codeCache.cpp
@@ -360,7 +360,7 @@ CodeBlob* CodeCache::next_blob(CodeBlob* cb) {
* run the constructor for the CodeBlob subclass he is busy
* instantiating.
*/
-CodeBlob* CodeCache::allocate(int size, int code_blob_type) {
+CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool strict) {
// Possibly wakes up the sweeper thread.
NMethodSweeper::notify(code_blob_type);
assert_locked_or_safepoint(CodeCache_lock);
@@ -379,11 +379,28 @@ CodeBlob* CodeCache::allocate(int size, int code_blob_type) {
if (cb != NULL) break;
if (!heap->expand_by(CodeCacheExpansionSize)) {
// Expansion failed
- if (SegmentedCodeCache && (code_blob_type == CodeBlobType::NonNMethod)) {
- // Fallback solution: Store non-nmethod code in the non-profiled code heap.
- // Note that at in the sweeper, we check the reverse_free_ratio of the non-profiled
- // code heap and force stack scanning if less than 10% if the code heap are free.
- return allocate(size, CodeBlobType::MethodNonProfiled);
+ if (SegmentedCodeCache && !strict) {
+ // Fallback solution: Try to store code in another code heap.
+ // Note that in the sweeper, we check the reverse_free_ratio of the code heap
+ // and force stack scanning if less than 10% of the code heap are free.
+ int type = code_blob_type;
+ switch (type) {
+ case CodeBlobType::NonNMethod:
+ type = CodeBlobType::MethodNonProfiled;
+ strict = false; // Allow recursive search for other heaps
+ break;
+ case CodeBlobType::MethodProfiled:
+ type = CodeBlobType::MethodNonProfiled;
+ strict = true;
+ break;
+ case CodeBlobType::MethodNonProfiled:
+ type = CodeBlobType::MethodProfiled;
+ strict = true;
+ break;
+ }
+ if (heap_available(type)) {
+ return allocate(size, type, strict);
+ }
}
MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
CompileBroker::handle_full_code_cache(code_blob_type);
diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp
index d682f90c5b2..09879b125da 100644
--- a/hotspot/src/share/vm/code/codeCache.hpp
+++ b/hotspot/src/share/vm/code/codeCache.hpp
@@ -122,7 +122,7 @@ class CodeCache : AllStatic {
static void initialize();
// Allocation/administration
- static CodeBlob* allocate(int size, int code_blob_type); // allocates a new CodeBlob
+ static CodeBlob* allocate(int size, int code_blob_type, bool strict = false); // allocates a new CodeBlob
static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled
static int alignment_unit(); // guaranteed alignment of all CodeBlobs
static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
diff --git a/hotspot/src/share/vm/compiler/disassembler.cpp b/hotspot/src/share/vm/compiler/disassembler.cpp
index d59bd653111..46cd7fb1f25 100644
--- a/hotspot/src/share/vm/compiler/disassembler.cpp
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp
@@ -343,8 +343,8 @@ void decode_env::print_address(address adr) {
}
BarrierSet* bs = Universe::heap()->barrier_set();
- if (bs->kind() == BarrierSet::CardTableModRef &&
- adr == (address)((CardTableModRefBS*)(bs))->byte_map_base) {
+ if (bs->is_a(BarrierSet::CardTableModRef) &&
+ adr == (address)(barrier_set_cast(bs)->byte_map_base)) {
st->print("word_map_base");
if (WizardMode) st->print(" " INTPTR_FORMAT, (intptr_t)adr);
return;
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
index b588cce717e..73f265a4028 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -97,9 +97,7 @@ ConcurrentMarkSweepThread::ConcurrentMarkSweepThread(CMSCollector* collector)
void ConcurrentMarkSweepThread::run() {
assert(this == cmst(), "just checking");
- this->record_stack_base_and_size();
- this->initialize_thread_local_storage();
- this->set_active_handles(JNIHandleBlock::allocate_block());
+ initialize_in_thread();
// From this time Thread::current() should be working.
assert(this == Thread::current(), "just checking");
if (BindCMSThreadToCPU && !os::bind_to_processor(CPUForCMSThread)) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index 0119858fe5b..bdd5e551016 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1440,7 +1440,7 @@ public:
CMCountDataClosureBase(G1CollectedHeap* g1h,
BitMap* region_bm, BitMap* card_bm):
_g1h(g1h), _cm(g1h->concurrent_mark()),
- _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
+ _ct_bs(barrier_set_cast(g1h->barrier_set())),
_region_bm(region_bm), _card_bm(card_bm) { }
};
@@ -3111,7 +3111,7 @@ class AggregateCountDataHRClosure: public HeapRegionClosure {
BitMap* cm_card_bm,
uint max_worker_id) :
_g1h(g1h), _cm(g1h->concurrent_mark()),
- _ct_bs((CardTableModRefBS*) (g1h->barrier_set())),
+ _ct_bs(barrier_set_cast(g1h->barrier_set())),
_cm_card_bm(cm_card_bm), _max_worker_id(max_worker_id) { }
bool doHeapRegion(HeapRegion* hr) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
index da75e61a8a7..4e199a6c28e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@ HeapWord* G1ParGCAllocator::allocate_direct_or_new_plab(InCSetState dest,
if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context);
add_to_alloc_buffer_waste(alloc_buf->words_remaining());
- alloc_buf->retire(false /* end_of_gc */, false /* retain */);
+ alloc_buf->retire();
HeapWord* buf = _g1h->par_allocate_during_gc(dest, gclab_word_size, context);
if (buf == NULL) {
@@ -154,9 +154,7 @@ void G1DefaultParGCAllocator::retire_alloc_buffers() {
G1ParGCAllocBuffer* const buf = _alloc_buffers[state];
if (buf != NULL) {
add_to_alloc_buffer_waste(buf->words_remaining());
- buf->flush_stats_and_retire(_g1h->alloc_buffer_stats(state),
- true /* end_of_gc */,
- false /* retain */);
+ buf->flush_and_retire_stats(_g1h->alloc_buffer_stats(state));
}
}
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp
index b32a4191dca..f14b1df4d8c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -159,11 +159,11 @@ public:
_retired = false;
}
- virtual void retire(bool end_of_gc, bool retain) {
+ virtual void retire() {
if (_retired) {
return;
}
- ParGCAllocBuffer::retire(end_of_gc, retain);
+ ParGCAllocBuffer::retire();
_retired = true;
}
};
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index fa51a4b29c5..c47a8516a63 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1274,7 +1274,7 @@ public:
virtual bool is_in_closed_subset(const void* p) const;
G1SATBCardTableLoggingModRefBS* g1_barrier_set() {
- return (G1SATBCardTableLoggingModRefBS*) barrier_set();
+ return barrier_set_cast(barrier_set());
}
// This resets the card table to all zeros. It is used after
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
index b97a3a17828..829faeb4f87 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
@@ -33,8 +33,11 @@
#include "runtime/orderAccess.inline.hpp"
#include "runtime/thread.inline.hpp"
-G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind) :
- CardTableModRefBS(whole_heap, kind) { }
+G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(
+ MemRegion whole_heap,
+ const BarrierSet::FakeRtti& fake_rtti) :
+ CardTableModRefBS(whole_heap, fake_rtti.add_tag(BarrierSet::G1SATBCT))
+{ }
void G1SATBCardTableModRefBS::enqueue(oop pre_val) {
// Nulls should have been already filtered.
@@ -130,7 +133,7 @@ void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, si
G1SATBCardTableLoggingModRefBS::
G1SATBCardTableLoggingModRefBS(MemRegion whole_heap) :
- G1SATBCardTableModRefBS(whole_heap, BarrierSet::G1SATBCTLogging),
+ G1SATBCardTableModRefBS(whole_heap, BarrierSet::FakeRtti(G1SATBCTLogging)),
_dcqs(JavaThread::dirty_card_queue_set()),
_listener()
{
@@ -203,7 +206,7 @@ G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field,
if (new_val == NULL) return;
// Otherwise, log it.
G1SATBCardTableLoggingModRefBS* g1_bs =
- (G1SATBCardTableLoggingModRefBS*)Universe::heap()->barrier_set();
+ barrier_set_cast(Universe::heap()->barrier_set());
g1_bs->write_ref_field_work(field, new_val);
}
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
index 98c8b65f3a3..c307815782d 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
@@ -43,7 +43,7 @@ protected:
g1_young_gen = CT_MR_BS_last_reserved << 1
};
- G1SATBCardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind);
+ G1SATBCardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
~G1SATBCardTableModRefBS() { }
public:
@@ -53,10 +53,6 @@ public:
// pre-marking object graph.
static void enqueue(oop pre_val);
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::G1SATBCT || CardTableModRefBS::is_a(bsn);
- }
-
virtual bool has_write_ref_pre_barrier() { return true; }
// This notes that we don't need to access any BarrierSet data
@@ -128,6 +124,11 @@ public:
}
};
+template<>
+struct BarrierSet::GetName {
+ static const BarrierSet::Name value = BarrierSet::G1SATBCT;
+};
+
class G1SATBCardTableLoggingModRefBSChangedListener : public G1MappingChangedListener {
private:
G1SATBCardTableLoggingModRefBS* _card_table;
@@ -159,11 +160,6 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS {
virtual void resize_covered_region(MemRegion new_region) { ShouldNotReachHere(); }
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::G1SATBCTLogging ||
- G1SATBCardTableModRefBS::is_a(bsn);
- }
-
void write_ref_field_work(void* field, oop new_val, bool release = false);
// Can be called from static contexts.
@@ -177,4 +173,9 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS {
void write_ref_array_work(MemRegion mr) { invalidate(mr); }
};
+template<>
+struct BarrierSet::GetName {
+ static const BarrierSet::Name value = BarrierSet::G1SATBCTLogging;
+};
+
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1SATBCARDTABLEMODREFBS_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 68a67678208..3ad7f190563 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -193,7 +193,7 @@ void HeapRegion::par_clear() {
HeapRegionRemSet* hrrs = rem_set();
hrrs->clear();
CardTableModRefBS* ct_bs =
- (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set();
+ barrier_set_cast(G1CollectedHeap::heap()->barrier_set());
ct_bs->clear(MemRegion(bottom(), end()));
}
@@ -643,13 +643,9 @@ public:
// _vo == UseNextMarking -> use "next" marking information,
// _vo == UseMarkWord -> use mark word from object header.
VerifyLiveClosure(G1CollectedHeap* g1h, VerifyOption vo) :
- _g1h(g1h), _bs(NULL), _containing_obj(NULL),
- _failures(false), _n_failures(0), _vo(vo)
- {
- BarrierSet* bs = _g1h->barrier_set();
- if (bs->is_a(BarrierSet::CardTableModRef))
- _bs = (CardTableModRefBS*)bs;
- }
+ _g1h(g1h), _bs(barrier_set_cast(g1h->barrier_set())),
+ _containing_obj(NULL), _failures(false), _n_failures(0), _vo(vo)
+ { }
void set_containing_obj(oop obj) {
_containing_obj = obj;
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index c4b0f9717e4..a54864db074 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -232,7 +232,7 @@ HeapWord* ParScanThreadState::alloc_in_to_space_slow(size_t word_sz) {
if (word_sz * 100 <
ParallelGCBufferWastePct * plab->word_sz()) {
// Is small enough; abandon this buffer and start a new one.
- plab->retire(false, false);
+ plab->retire();
size_t buf_size = plab->word_sz();
HeapWord* buf_space = sp->par_allocate(buf_size);
if (buf_space == NULL) {
@@ -463,10 +463,7 @@ void ParScanThreadStateSet::flush()
// Flush stats related to To-space PLAB activity and
// retire the last buffer.
- par_scan_state.to_space_alloc_buffer()->
- flush_stats_and_retire(_gen.plab_stats(),
- true /* end_of_gc */,
- false /* retain */);
+ par_scan_state.to_space_alloc_buffer()->flush_and_retire_stats(_gen.plab_stats());
// Every thread has its own age table. We need to merge
// them all into one.
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
index 9630cb09357..7448978578c 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@ class CheckForUnmarkedObjects : public ObjectClosure {
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
_young_gen = heap->young_gen();
- _card_table = (CardTableExtension*)heap->barrier_set();
+ _card_table = barrier_set_cast(heap->barrier_set());
// No point in asserting barrier set type here. Need to make CardTableExtension
// a unique barrier set type.
}
@@ -341,7 +341,9 @@ void CardTableExtension::verify_all_young_refs_precise() {
PSOldGen* old_gen = heap->old_gen();
- CheckForPreciseMarks check(heap->young_gen(), (CardTableExtension*)heap->barrier_set());
+ CheckForPreciseMarks check(
+ heap->young_gen(),
+ barrier_set_cast(heap->barrier_set()));
old_gen->oop_iterate_no_header(&check);
@@ -349,8 +351,8 @@ void CardTableExtension::verify_all_young_refs_precise() {
}
void CardTableExtension::verify_all_young_refs_precise_helper(MemRegion mr) {
- CardTableExtension* card_table = (CardTableExtension*)Universe::heap()->barrier_set();
- // FIX ME ASSERT HERE
+ CardTableExtension* card_table =
+ barrier_set_cast(Universe::heap()->barrier_set());
jbyte* bot = card_table->byte_for(mr.start());
jbyte* top = card_table->byte_for(mr.end());
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
index d2d3319da75..dd29609e050 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
@@ -54,10 +54,16 @@ class CardTableExtension : public CardTableModRefBS {
};
CardTableExtension(MemRegion whole_heap) :
- CardTableModRefBS(whole_heap, BarrierSet::CardTableModRef) { }
-
- // Too risky for the 4/10/02 putback
- // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }
+ CardTableModRefBS(
+ whole_heap,
+ // Concrete tag should be BarrierSet::CardTableExtension.
+ // That will presently break things in a bunch of places though.
+ // The concrete tag is used as a dispatch key in many places, and
+ // CardTableExtension does not correctly dispatch in some of those
+ // uses. This will be addressed as part of a reorganization of the
+ // BarrierSet hierarchy.
+ BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableExtension))
+ { }
// Scavenge support
void scavenge_contents_parallel(ObjectStartArray* start_array,
@@ -110,4 +116,9 @@ class CardTableExtension : public CardTableModRefBS {
#endif // ASSERT
};
+template<>
+struct BarrierSet::GetName {
+ static const BarrierSet::Name value = BarrierSet::CardTableExtension;
+};
+
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
index b3b550af6cc..ff58762c20e 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,7 @@ void GCTaskThread::run() {
// Set up the thread for stack overflow support
this->record_stack_base_and_size();
this->initialize_thread_local_storage();
+ this->initialize_named_thread();
// Bind yourself to your processor.
if (processor_id() != GCTaskManager::sentinel_worker()) {
if (TraceGCTaskThread) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
index e6411517bbb..7288b963c9b 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
@@ -1,6 +1,5 @@
-
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -233,15 +232,12 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
young_gen->to_space()->is_empty();
young_gen_empty = eden_empty && survivors_empty;
- BarrierSet* bs = heap->barrier_set();
- if (bs->is_a(BarrierSet::ModRef)) {
- ModRefBarrierSet* modBS = (ModRefBarrierSet*)bs;
- MemRegion old_mr = heap->old_gen()->reserved();
- if (young_gen_empty) {
- modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
- } else {
- modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
- }
+ ModRefBarrierSet* modBS = barrier_set_cast(heap->barrier_set());
+ MemRegion old_mr = heap->old_gen()->reserved();
+ if (young_gen_empty) {
+ modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
+ } else {
+ modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
}
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
index a578d75f902..c7ac0eb5a9b 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -111,8 +111,8 @@ void PSOldGen::initialize_work(const char* perf_data_name, int level) {
Universe::heap()->barrier_set()->resize_covered_region(cmr);
- CardTableModRefBS* _ct = (CardTableModRefBS*)Universe::heap()->barrier_set();
- assert (_ct->kind() == BarrierSet::CardTableModRef, "Sanity");
+ CardTableModRefBS* _ct =
+ barrier_set_cast(Universe::heap()->barrier_set());
// Verify that the start and end of this generation is the start of a card.
// If this wasn't true, a single card could span more than one generation,
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
index 28cff7813d7..3e89b0a98e0 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1050,16 +1050,12 @@ void PSParallelCompact::post_compact()
bool young_gen_empty = eden_empty && from_space->is_empty() &&
to_space->is_empty();
- BarrierSet* bs = heap->barrier_set();
- if (bs->is_a(BarrierSet::ModRef)) {
- ModRefBarrierSet* modBS = (ModRefBarrierSet*)bs;
- MemRegion old_mr = heap->old_gen()->reserved();
-
- if (young_gen_empty) {
- modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
- } else {
- modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
- }
+ ModRefBarrierSet* modBS = barrier_set_cast(heap->barrier_set());
+ MemRegion old_mr = heap->old_gen()->reserved();
+ if (young_gen_empty) {
+ modBS->clear(MemRegion(old_mr.start(), old_mr.end()));
+ } else {
+ modBS->invalidate(MemRegion(old_mr.start(), old_mr.end()));
}
// Delete metaspaces for unloaded class loaders and clean up loader_data graph
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
index db5a5281df5..3c0542f3b80 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
@@ -1,6 +1,5 @@
-
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -866,9 +865,7 @@ void PSScavenge::initialize() {
NULL); // header provides liveness info
// Cache the cardtable
- BarrierSet* bs = Universe::heap()->barrier_set();
- assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind");
- _card_table = (CardTableExtension*)bs;
+ _card_table = barrier_set_cast(heap->barrier_set());
_counters = new CollectorCounters("PSScavenge", 0);
}
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
index f829e934408..df320d87ff0 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -183,8 +183,8 @@ void OldToYoungRootsTask::do_it(GCTaskManager* manager, uint which) {
PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which);
assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
- CardTableExtension* card_table = (CardTableExtension *)Universe::heap()->barrier_set();
- // FIX ME! Assert that card_table is the type we believe it to be.
+ CardTableExtension* card_table =
+ barrier_set_cast(Universe::heap()->barrier_set());
card_table->scavenge_contents_parallel(_gen->start_array(),
_gen->object_space(),
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
index c90da2b0d39..9002cd06f26 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,7 @@ void ConcurrentGCThread::create_and_start() {
void ConcurrentGCThread::initialize_in_thread() {
this->record_stack_base_and_size();
this->initialize_thread_local_storage();
+ this->initialize_named_thread();
this->set_active_handles(JNIHandleBlock::allocate_block());
// From this time Thread::current() should be working.
assert(this == Thread::current(), "just checking");
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
index 0a396050fbe..fe21e584cf7 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,27 +24,30 @@
#include "precompiled.hpp"
#include "gc_implementation/shared/parGCAllocBuffer.hpp"
-#include "memory/sharedHeap.hpp"
+#include "memory/threadLocalAllocBuffer.hpp"
#include "oops/arrayOop.hpp"
#include "oops/oop.inline.hpp"
-#include "utilities/globalDefinitions.hpp"
-PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+size_t ParGCAllocBuffer::min_size() {
+ // Make sure that we return something that is larger than AlignmentReserve
+ return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
+}
+
+size_t ParGCAllocBuffer::max_size() {
+ return ThreadLocalAllocBuffer::max_size();
+}
ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
_word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
- _end(NULL), _hard_end(NULL),
- _retained(false), _retained_filler(),
- _allocated(0), _wasted(0)
+ _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0)
{
- assert (min_size() > AlignmentReserve, "Inconsistency!");
- // arrayOopDesc::header_size depends on command line initialization.
- FillerHeaderSize = align_object_size(arrayOopDesc::header_size(T_INT));
- AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? FillerHeaderSize : 0;
+ // ArrayOopDesc::header_size depends on command line initialization.
+ AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
+ assert(min_size() > AlignmentReserve,
+ err_msg("Minimum PLAB size " SIZE_FORMAT" must be larger than alignment reserve " SIZE_FORMAT" "
+ "to be able to contain objects", min_size(), AlignmentReserve));
}
-size_t ParGCAllocBuffer::FillerHeaderSize;
-
// If the minimum object size is greater than MinObjAlignment, we can
// end up with a shard at the end of the buffer that's smaller than
// the smallest object. We can't allow that because the buffer must
@@ -52,39 +55,33 @@ size_t ParGCAllocBuffer::FillerHeaderSize;
// sure we have enough space for a filler int array object.
size_t ParGCAllocBuffer::AlignmentReserve;
-void ParGCAllocBuffer::retire(bool end_of_gc, bool retain) {
- assert(!retain || end_of_gc, "Can only retain at GC end.");
- if (_retained) {
- // If the buffer had been retained shorten the previous filler object.
- assert(_retained_filler.end() <= _top, "INVARIANT");
- CollectedHeap::fill_with_object(_retained_filler);
- // Wasted space book-keeping, otherwise (normally) done in invalidate()
- _wasted += _retained_filler.word_size();
- _retained = false;
- }
- assert(!end_of_gc || !_retained, "At this point, end_of_gc ==> !_retained.");
- if (_top < _hard_end) {
- CollectedHeap::fill_with_object(_top, _hard_end);
- if (!retain) {
- invalidate();
- } else {
- // Is there wasted space we'd like to retain for the next GC?
- if (pointer_delta(_end, _top) > FillerHeaderSize) {
- _retained = true;
- _retained_filler = MemRegion(_top, FillerHeaderSize);
- _top = _top + FillerHeaderSize;
- } else {
- invalidate();
- }
- }
- }
-}
+void ParGCAllocBuffer::flush_and_retire_stats(PLABStats* stats) {
+ // Retire the last allocation buffer.
+ size_t unused = retire_internal();
-void ParGCAllocBuffer::flush_stats(PLABStats* stats) {
- assert(ResizePLAB, "Wasted work");
+ // Now flush the statistics.
stats->add_allocated(_allocated);
stats->add_wasted(_wasted);
- stats->add_unused(pointer_delta(_end, _top));
+ stats->add_unused(unused);
+
+ // Since we have flushed the stats we need to clear the _allocated and _wasted
+ // fields in case somebody retains an instance of this over GCs. Not doing so
+ // will artifically inflate the values in the statistics.
+ _allocated = 0;
+ _wasted = 0;
+}
+
+void ParGCAllocBuffer::retire() {
+ _wasted += retire_internal();
+}
+
+size_t ParGCAllocBuffer::retire_internal() {
+ size_t result = 0;
+ if (_top < _hard_end) {
+ CollectedHeap::fill_with_object(_top, _hard_end);
+ result += invalidate();
+ }
+ return result;
}
// Compute desired plab size and latch result for later
@@ -101,44 +98,37 @@ void PLABStats::adjust_desired_plab_sz(uint no_of_gc_workers) {
err_msg("Inconsistency in PLAB stats: "
"_allocated: "SIZE_FORMAT", "
"_wasted: "SIZE_FORMAT", "
- "_unused: "SIZE_FORMAT", "
- "_used : "SIZE_FORMAT,
- _allocated, _wasted, _unused, _used));
+ "_unused: "SIZE_FORMAT,
+ _allocated, _wasted, _unused));
_allocated = 1;
}
- double wasted_frac = (double)_unused/(double)_allocated;
- size_t target_refills = (size_t)((wasted_frac*TargetSurvivorRatio)/
- TargetPLABWastePct);
+ double wasted_frac = (double)_unused / (double)_allocated;
+ size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct);
if (target_refills == 0) {
target_refills = 1;
}
- _used = _allocated - _wasted - _unused;
- size_t plab_sz = _used/(target_refills*no_of_gc_workers);
- if (PrintPLAB) gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " ", plab_sz);
+ size_t used = _allocated - _wasted - _unused;
+ size_t recent_plab_sz = used / (target_refills * no_of_gc_workers);
// Take historical weighted average
- _filter.sample(plab_sz);
+ _filter.sample(recent_plab_sz);
// Clip from above and below, and align to object boundary
- plab_sz = MAX2(min_size(), (size_t)_filter.average());
- plab_sz = MIN2(max_size(), plab_sz);
- plab_sz = align_object_size(plab_sz);
+ size_t new_plab_sz = MAX2(min_size(), (size_t)_filter.average());
+ new_plab_sz = MIN2(max_size(), new_plab_sz);
+ new_plab_sz = align_object_size(new_plab_sz);
// Latch the result
- if (PrintPLAB) gclog_or_tty->print(" desired_plab_sz = " SIZE_FORMAT ") ", plab_sz);
- _desired_plab_sz = plab_sz;
- // Now clear the accumulators for next round:
- // note this needs to be fixed in the case where we
- // are retaining across scavenges. FIX ME !!! XXX
- _allocated = 0;
- _wasted = 0;
- _unused = 0;
+ if (PrintPLAB) {
+ gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT" desired_plab_sz = " SIZE_FORMAT") ", recent_plab_sz, new_plab_sz);
+ }
+ _desired_plab_sz = new_plab_sz;
+
+ reset();
}
#ifndef PRODUCT
void ParGCAllocBuffer::print() {
- gclog_or_tty->print("parGCAllocBuffer: _bottom: " PTR_FORMAT " _top: " PTR_FORMAT
- " _end: " PTR_FORMAT " _hard_end: " PTR_FORMAT " _retained: %c"
- " _retained_filler: [" PTR_FORMAT "," PTR_FORMAT ")\n",
- _bottom, _top, _end, _hard_end,
- "FT"[_retained], _retained_filler.start(), _retained_filler.end());
+ gclog_or_tty->print_cr("parGCAllocBuffer: _bottom: " PTR_FORMAT " _top: " PTR_FORMAT
+ " _end: " PTR_FORMAT " _hard_end: " PTR_FORMAT ")",
+ p2i(_bottom), p2i(_top), p2i(_end), p2i(_hard_end));
}
#endif // !PRODUCT
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
index 953ab2f554b..a8991a0816b 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,37 +24,43 @@
#ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
#define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
-#include "gc_interface/collectedHeap.hpp"
+
+#include "gc_implementation/shared/gcUtil.hpp"
#include "memory/allocation.hpp"
-#include "memory/blockOffsetTable.hpp"
-#include "memory/threadLocalAllocBuffer.hpp"
+#include "runtime/atomic.hpp"
#include "utilities/globalDefinitions.hpp"
-// Forward decl.
-
+// Forward declarations.
class PLABStats;
// A per-thread allocation buffer used during GC.
class ParGCAllocBuffer: public CHeapObj {
protected:
- char head[32];
- size_t _word_sz; // in HeapWord units
+ char head[32];
+ size_t _word_sz; // In HeapWord units
HeapWord* _bottom;
HeapWord* _top;
- HeapWord* _end; // last allocatable address + 1
- HeapWord* _hard_end; // _end + AlignmentReserve
- bool _retained; // whether we hold a _retained_filler
- MemRegion _retained_filler;
+ HeapWord* _end; // Last allocatable address + 1
+ HeapWord* _hard_end; // _end + AlignmentReserve
// In support of ergonomic sizing of PLAB's
size_t _allocated; // in HeapWord units
size_t _wasted; // in HeapWord units
- char tail[32];
- static size_t FillerHeaderSize;
+ char tail[32];
static size_t AlignmentReserve;
- // Flush the stats supporting ergonomic sizing of PLAB's
- // Should not be called directly
- void flush_stats(PLABStats* stats);
+ // Force future allocations to fail and queries for contains()
+ // to return false. Returns the amount of unused space in this PLAB.
+ size_t invalidate() {
+ _end = _hard_end;
+ size_t remaining = pointer_delta(_end, _top); // Calculate remaining space.
+ _top = _end; // Force future allocations to fail.
+ _bottom = _end; // Force future contains() queries to return false.
+ return remaining;
+ }
+
+ // Fill in remaining space with a dummy object and invalidate the PLAB. Returns
+ // the amount of remaining space.
+ size_t retire_internal();
public:
// Initializes the buffer to be empty, but with the given "word_sz".
@@ -62,14 +68,10 @@ public:
ParGCAllocBuffer(size_t word_sz);
virtual ~ParGCAllocBuffer() {}
- static const size_t min_size() {
- // Make sure that we return something that is larger than AlignmentReserve
- return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
- }
-
- static const size_t max_size() {
- return ThreadLocalAllocBuffer::max_size();
- }
+ // Minimum PLAB size.
+ static size_t min_size();
+ // Maximum PLAB size.
+ static size_t max_size();
// If an allocation of the given "word_sz" can be satisfied within the
// buffer, do the allocation, returning a pointer to the start of the
@@ -128,62 +130,37 @@ public:
_allocated += word_sz();
}
- // Flush the stats supporting ergonomic sizing of PLAB's
- // and retire the current buffer.
- void flush_stats_and_retire(PLABStats* stats, bool end_of_gc, bool retain) {
- // We flush the stats first in order to get a reading of
- // unused space in the last buffer.
- if (ResizePLAB) {
- flush_stats(stats);
+ // Flush allocation statistics into the given PLABStats supporting ergonomic
+ // sizing of PLAB's and retire the current buffer. To be called at the end of
+ // GC.
+ void flush_and_retire_stats(PLABStats* stats);
- // Since we have flushed the stats we need to clear
- // the _allocated and _wasted fields. Not doing so
- // will artifically inflate the values in the stats
- // to which we add them.
- // The next time we flush these values, we will add
- // what we have just flushed in addition to the size
- // of the buffers allocated between now and then.
- _allocated = 0;
- _wasted = 0;
- }
- // Retire the last allocation buffer.
- retire(end_of_gc, retain);
- }
-
- // Force future allocations to fail and queries for contains()
- // to return false
- void invalidate() {
- assert(!_retained, "Shouldn't retain an invalidated buffer.");
- _end = _hard_end;
- _wasted += pointer_delta(_end, _top); // unused space
- _top = _end; // force future allocations to fail
- _bottom = _end; // force future contains() queries to return false
- }
-
- // Fills in the unallocated portion of the buffer with a garbage object.
- // If "end_of_gc" is TRUE, is after the last use in the GC. IF "retain"
- // is true, attempt to re-use the unused portion in the next GC.
- virtual void retire(bool end_of_gc, bool retain);
+ // Fills in the unallocated portion of the buffer with a garbage object and updates
+ // statistics. To be called during GC.
+ virtual void retire();
void print() PRODUCT_RETURN;
};
-// PLAB stats book-keeping
+// PLAB book-keeping.
class PLABStats VALUE_OBJ_CLASS_SPEC {
- size_t _allocated; // total allocated
+ size_t _allocated; // Total allocated
size_t _wasted; // of which wasted (internal fragmentation)
size_t _unused; // Unused in last buffer
- size_t _used; // derived = allocated - wasted - unused
- size_t _desired_plab_sz;// output of filter (below), suitably trimmed and quantized
+ size_t _desired_plab_sz;// Output of filter (below), suitably trimmed and quantized
AdaptiveWeightedAverage
- _filter; // integrator with decay
+ _filter; // Integrator with decay
+ void reset() {
+ _allocated = 0;
+ _wasted = 0;
+ _unused = 0;
+ }
public:
PLABStats(size_t desired_plab_sz_, unsigned wt) :
_allocated(0),
_wasted(0),
_unused(0),
- _used(0),
_desired_plab_sz(desired_plab_sz_),
_filter(wt)
{ }
@@ -200,9 +177,9 @@ class PLABStats VALUE_OBJ_CLASS_SPEC {
return _desired_plab_sz;
}
+ // Updates the current desired PLAB size. Computes the new desired PLAB size,
+ // updates _desired_plab_sz and clears sensor accumulators.
void adjust_desired_plab_sz(uint no_of_gc_workers);
- // filter computation, latches output to
- // _desired_plab_sz, clears sensor accumulators
void add_allocated(size_t v) {
Atomic::add_ptr(v, &_allocated);
diff --git a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp
index 2349a45adb7..12591db754b 100644
--- a/hotspot/src/share/vm/memory/barrierSet.hpp
+++ b/hotspot/src/share/vm/memory/barrierSet.hpp
@@ -27,6 +27,7 @@
#include "memory/memRegion.hpp"
#include "oops/oopsHierarchy.hpp"
+#include "utilities/fakeRttiSupport.hpp"
// This class provides the interface between a barrier implementation and
// the rest of the system.
@@ -34,18 +35,57 @@
class BarrierSet: public CHeapObj {
friend class VMStructs;
public:
- enum Name {
- ModRef,
- CardTableModRef,
- CardTableExtension,
- G1SATBCT,
- G1SATBCTLogging
+ // Fake RTTI support. For a derived class T to participate
+ // - T must have a corresponding Name entry.
+ // - GetName must be specialized to return the corresponding Name
+ // entry.
+ // - If T is a base class, the constructor must have a FakeRtti
+ // parameter and pass it up to its base class, with the tag set
+ // augmented with the corresponding Name entry.
+ // - If T is a concrete class, the constructor must create a
+ // FakeRtti object whose tag set includes the corresponding Name
+ // entry, and pass it up to its base class.
+
+ enum Name { // associated class
+ ModRef, // ModRefBarrierSet
+ CardTableModRef, // CardTableModRefBS
+ CardTableForRS, // CardTableModRefBSForCTRS
+ CardTableExtension, // CardTableExtension
+ G1SATBCT, // G1SATBCardTableModRefBS
+ G1SATBCTLogging // G1SATBCardTableLoggingModRefBS
};
+protected:
+ typedef FakeRttiSupport FakeRtti;
+
+private:
+ FakeRtti _fake_rtti;
+
+ // Metafunction mapping a class derived from BarrierSet to the
+ // corresponding Name enum tag.
+ template struct GetName;
+
+ // Downcast argument to a derived barrier set type.
+ // The cast is checked in a debug build.
+ // T must have a specialization for BarrierSet::GetName.
+ template friend T* barrier_set_cast(BarrierSet* bs);
+
+public:
+ // Note: This is not presently the Name corresponding to the
+ // concrete class of this object.
+ BarrierSet::Name kind() const { return _fake_rtti.concrete_tag(); }
+
+ // Test whether this object is of the type corresponding to bsn.
+ bool is_a(BarrierSet::Name bsn) const { return _fake_rtti.has_tag(bsn); }
+
+ // End of fake RTTI support.
+
+public:
enum Flags {
None = 0,
TargetUninitialized = 1
};
+
protected:
// Some barrier sets create tables whose elements correspond to parts of
// the heap; the CardTableModRefBS is an example. Such barrier sets will
@@ -53,17 +93,12 @@ protected:
// "covering" parts of the heap that are committed. At most one covered
// region per generation is needed.
static const int _max_covered_regions = 2;
- Name _kind;
- BarrierSet(Name kind) : _kind(kind) { }
+ BarrierSet(const FakeRtti& fake_rtti) : _fake_rtti(fake_rtti) { }
~BarrierSet() { }
public:
- // To get around prohibition on RTTI.
- BarrierSet::Name kind() { return _kind; }
- virtual bool is_a(BarrierSet::Name bsn) = 0;
-
// These operations indicate what kind of barriers the BarrierSet has.
virtual bool has_read_ref_barrier() = 0;
virtual bool has_read_prim_barrier() = 0;
@@ -177,4 +212,10 @@ public:
virtual void print_on(outputStream* st) const = 0;
};
+template
+inline T* barrier_set_cast(BarrierSet* bs) {
+ assert(bs->is_a(BarrierSet::GetName::value), "wrong type of barrier set");
+ return static_cast(bs);
+}
+
#endif // SHARE_VM_MEMORY_BARRIERSET_HPP
diff --git a/hotspot/src/share/vm/memory/barrierSet.inline.hpp b/hotspot/src/share/vm/memory/barrierSet.inline.hpp
index ded96f3448d..98437abf188 100644
--- a/hotspot/src/share/vm/memory/barrierSet.inline.hpp
+++ b/hotspot/src/share/vm/memory/barrierSet.inline.hpp
@@ -34,7 +34,7 @@
template void BarrierSet::write_ref_field_pre(T* field, oop new_val) {
if (kind() == CardTableModRef) {
- ((CardTableModRefBS*)this)->inline_write_ref_field_pre(field, new_val);
+ barrier_set_cast(this)->inline_write_ref_field_pre(field, new_val);
} else {
write_ref_field_pre_work(field, new_val);
}
@@ -42,7 +42,7 @@ template void BarrierSet::write_ref_field_pre(T* field, oop new_val) {
void BarrierSet::write_ref_field(void* field, oop new_val, bool release) {
if (kind() == CardTableModRef) {
- ((CardTableModRefBS*)this)->inline_write_ref_field(field, new_val, release);
+ barrier_set_cast(this)->inline_write_ref_field(field, new_val, release);
} else {
write_ref_field_work(field, new_val, release);
}
@@ -78,7 +78,7 @@ void BarrierSet::write_ref_array(HeapWord* start, size_t count) {
inline void BarrierSet::write_region(MemRegion mr) {
if (kind() == CardTableModRef) {
- ((CardTableModRefBS*)this)->inline_write_region(mr);
+ barrier_set_cast(this)->inline_write_region(mr);
} else {
write_region_work(mr);
}
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
index fdf264e4e88..d0024231c6d 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
@@ -53,8 +53,10 @@ size_t CardTableModRefBS::compute_byte_map_size()
return align_size_up(_guard_index + 1, MAX2(_page_size, granularity));
}
-CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind) :
- ModRefBarrierSet(kind),
+CardTableModRefBS::CardTableModRefBS(
+ MemRegion whole_heap,
+ const BarrierSet::FakeRtti& fake_rtti) :
+ ModRefBarrierSet(fake_rtti.add_tag(BarrierSet::CardTableModRef)),
_whole_heap(whole_heap),
_guard_index(0),
_guard_region(),
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
index f2d1c12a9ce..f7cf9e68499 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
@@ -279,11 +279,6 @@ public:
static int precleaned_card_val() { return precleaned_card; }
static int deferred_card_val() { return deferred_card; }
- // For RTTI simulation.
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn);
- }
-
virtual void initialize();
// *** Barrier set functions.
@@ -292,7 +287,7 @@ public:
protected:
- CardTableModRefBS(MemRegion whole_heap, BarrierSet::Name kind);
+ CardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
~CardTableModRefBS();
// Record a reference update. Note that these versions are precise!
@@ -462,6 +457,11 @@ public:
void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
};
+template<>
+struct BarrierSet::GetName {
+ static const BarrierSet::Name value = BarrierSet::CardTableModRef;
+};
+
class CardTableRS;
// A specialization for the CardTableRS gen rem set.
@@ -472,10 +472,24 @@ protected:
bool card_may_have_been_dirty(jbyte cv);
public:
CardTableModRefBSForCTRS(MemRegion whole_heap) :
- CardTableModRefBS(whole_heap, BarrierSet::CardTableModRef) {}
+ CardTableModRefBS(
+ whole_heap,
+ // Concrete tag should be BarrierSet::CardTableForRS.
+ // That will presently break things in a bunch of places though.
+ // The concrete tag is used as a dispatch key in many places, and
+ // CardTableForRS does not correctly dispatch in some of those
+ // uses. This will be addressed as part of a reorganization of the
+ // BarrierSet hierarchy.
+ BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableForRS))
+ {}
void set_CTRS(CardTableRS* rs) { _rs = rs; }
};
+template<>
+struct BarrierSet::GetName {
+ static const BarrierSet::Name value = BarrierSet::CardTableForRS;
+};
+
#endif // SHARE_VM_MEMORY_CARDTABLEMODREFBS_HPP
diff --git a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
index 394d2c513a6..ac7db902f83 100644
--- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
+++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
@@ -37,10 +37,6 @@ class Generation;
class ModRefBarrierSet: public BarrierSet {
public:
- bool is_a(BarrierSet::Name bsn) {
- return bsn == BarrierSet::ModRef;
- }
-
// Barriers only on ref writes.
bool has_read_ref_barrier() { return false; }
bool has_read_prim_barrier() { return false; }
@@ -60,7 +56,8 @@ public:
protected:
- ModRefBarrierSet(BarrierSet::Name kind) : BarrierSet(kind) { }
+ ModRefBarrierSet(const BarrierSet::FakeRtti& fake_rtti)
+ : BarrierSet(fake_rtti.add_tag(BarrierSet::ModRef)) { }
~ModRefBarrierSet() { }
virtual void write_ref_field_work(void* field, oop new_val, bool release = false) = 0;
@@ -100,4 +97,9 @@ public:
virtual void clear(MemRegion mr) = 0;
};
+template<>
+struct BarrierSet::GetName {
+ static const BarrierSet::Name value = BarrierSet::ModRef;
+};
+
#endif // SHARE_VM_MEMORY_MODREFBARRIERSET_HPP
diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp
index 3f3ae19ea01..f5b19fe7758 100644
--- a/hotspot/src/share/vm/oops/constMethod.hpp
+++ b/hotspot/src/share/vm/oops/constMethod.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -215,6 +215,7 @@ private:
u2 _max_stack; // Maximum number of entries on the expression stack
u2 _max_locals; // Number of local variables used by this method
u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
+ u2 _orig_method_idnum; // Original unique identification number for the method
// Constructor
ConstMethod(int byte_code_size,
@@ -473,6 +474,9 @@ public:
u2 method_idnum() const { return _method_idnum; }
void set_method_idnum(u2 idnum) { _method_idnum = idnum; }
+ u2 orig_method_idnum() const { return _orig_method_idnum; }
+ void set_orig_method_idnum(u2 idnum) { _orig_method_idnum = idnum; }
+
// max stack
int max_stack() const { return _max_stack; }
void set_max_stack(int size) { _max_stack = size; }
diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp
index 6355e0d8332..f9f73d218da 100644
--- a/hotspot/src/share/vm/oops/cpCache.cpp
+++ b/hotspot/src/share/vm/oops/cpCache.cpp
@@ -454,7 +454,6 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
new_method->name()->as_C_string(),
new_method->signature()->as_C_string()));
}
-
return true;
}
@@ -482,7 +481,6 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method,
new_method->name()->as_C_string(),
new_method->signature()->as_C_string()));
}
-
return true;
}
@@ -509,36 +507,33 @@ bool ConstantPoolCacheEntry::check_no_old_or_obsolete_entries() {
(!f1_as_method()->is_old() && !f1_as_method()->is_obsolete())));
}
-bool ConstantPoolCacheEntry::is_interesting_method_entry(Klass* k) {
+Method* ConstantPoolCacheEntry::get_interesting_method_entry(Klass* k) {
if (!is_method_entry()) {
// not a method entry so not interesting by default
- return false;
+ return NULL;
}
-
Method* m = NULL;
if (is_vfinal()) {
// virtual and final so _f2 contains method ptr instead of vtable index
m = f2_as_vfinal_method();
} else if (is_f1_null()) {
// NULL _f1 means this is a virtual entry so also not interesting
- return false;
+ return NULL;
} else {
if (!(_f1->is_method())) {
// _f1 can also contain a Klass* for an interface
- return false;
+ return NULL;
}
m = f1_as_method();
}
-
assert(m != NULL && m->is_method(), "sanity check");
if (m == NULL || !m->is_method() || (k != NULL && m->method_holder() != k)) {
// robustness for above sanity checks or method is not in
// the interesting class
- return false;
+ return NULL;
}
-
// the method is in the interesting class so the entry is interesting
- return true;
+ return m;
}
#endif // INCLUDE_JVMTI
@@ -615,7 +610,7 @@ void ConstantPoolCache::initialize(const intArray& inverse_index_map,
// If any entry of this ConstantPoolCache points to any of
// old_methods, replace it with the corresponding new_method.
void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed) {
+ int methods_length, bool * trace_name_printed) {
if (methods_length == 0) {
// nothing to do if there are no methods
@@ -626,7 +621,7 @@ void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new
Klass* old_holder = old_methods[0]->method_holder();
for (int i = 0; i < length(); i++) {
- if (!entry_at(i)->is_interesting_method_entry(old_holder)) {
+ if (entry_at(i)->get_interesting_method_entry(old_holder) == NULL) {
// skip uninteresting methods
continue;
}
@@ -650,10 +645,33 @@ void ConstantPoolCache::adjust_method_entries(Method** old_methods, Method** new
}
}
+// If any entry of this ConstantPoolCache points to any of
+// old_methods, replace it with the corresponding new_method.
+void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+ for (int i = 0; i < length(); i++) {
+ ConstantPoolCacheEntry* entry = entry_at(i);
+ Method* old_method = entry->get_interesting_method_entry(holder);
+ if (old_method == NULL || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ if (old_method->is_deleted()) {
+ // clean up entries with deleted methods
+ entry->initialize_entry(entry->constant_pool_index());
+ continue;
+ }
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ entry_at(i)->adjust_method_entry(old_method, new_method, trace_name_printed);
+ }
+}
+
// the constant pool cache should never contain old or obsolete methods
bool ConstantPoolCache::check_no_old_or_obsolete_entries() {
for (int i = 1; i < length(); i++) {
- if (entry_at(i)->is_interesting_method_entry(NULL) &&
+ if (entry_at(i)->get_interesting_method_entry(NULL) != NULL &&
!entry_at(i)->check_no_old_or_obsolete_entries()) {
return false;
}
@@ -663,7 +681,7 @@ bool ConstantPoolCache::check_no_old_or_obsolete_entries() {
void ConstantPoolCache::dump_cache() {
for (int i = 1; i < length(); i++) {
- if (entry_at(i)->is_interesting_method_entry(NULL)) {
+ if (entry_at(i)->get_interesting_method_entry(NULL) != NULL) {
entry_at(i)->print(tty, i);
}
}
diff --git a/hotspot/src/share/vm/oops/cpCache.hpp b/hotspot/src/share/vm/oops/cpCache.hpp
index debd09136c7..eeef44f653c 100644
--- a/hotspot/src/share/vm/oops/cpCache.hpp
+++ b/hotspot/src/share/vm/oops/cpCache.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -379,9 +379,9 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
bool adjust_method_entry(Method* old_method, Method* new_method,
- bool * trace_name_printed);
+ bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
- bool is_interesting_method_entry(Klass* k);
+ Method* get_interesting_method_entry(Klass* k);
#endif // INCLUDE_JVMTI
// Debugging & Printing
@@ -478,7 +478,8 @@ class ConstantPoolCache: public MetaspaceObj {
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
void adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed);
+ int methods_length, bool* trace_name_printed);
+ void adjust_method_entries(InstanceKlass* holder, bool* trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_cache();
#endif // INCLUDE_JVMTI
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index ce0fb5de7c3..91843cdb2f5 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -2793,30 +2793,33 @@ Method* InstanceKlass::method_at_itable(Klass* holder, int index, TRAPS) {
// not yet in the vtable due to concurrent subclass define and superinterface
// redefinition
// Note: those in the vtable, should have been updated via adjust_method_entries
-void InstanceKlass::adjust_default_methods(Method** old_methods, Method** new_methods,
- int methods_length, bool* trace_name_printed) {
+void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed) {
// search the default_methods for uses of either obsolete or EMCP methods
if (default_methods() != NULL) {
- for (int j = 0; j < methods_length; j++) {
- Method* old_method = old_methods[j];
- Method* new_method = new_methods[j];
+ for (int index = 0; index < default_methods()->length(); index ++) {
+ Method* old_method = default_methods()->at(index);
+ if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ assert(!old_method->is_deleted(), "default methods may not be deleted");
- for (int index = 0; index < default_methods()->length(); index ++) {
- if (default_methods()->at(index) == old_method) {
- default_methods()->at_put(index, new_method);
- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
- if (!(*trace_name_printed)) {
- // RC_TRACE_MESG macro has an embedded ResourceMark
- RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
- external_name(),
- old_method->method_holder()->external_name()));
- *trace_name_printed = true;
- }
- RC_TRACE(0x00100000, ("default method update: %s(%s) ",
- new_method->name()->as_C_string(),
- new_method->signature()->as_C_string()));
- }
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ default_methods()->at_put(index, new_method);
+ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+ if (!(*trace_name_printed)) {
+ // RC_TRACE_MESG macro has an embedded ResourceMark
+ RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s",
+ external_name(),
+ old_method->method_holder()->external_name()));
+ *trace_name_printed = true;
}
+ RC_TRACE(0x00100000, ("default method update: %s(%s) ",
+ new_method->name()->as_C_string(),
+ new_method->signature()->as_C_string()));
}
}
}
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index 5cbe4a824bb..507454e18b9 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -937,8 +937,7 @@ class InstanceKlass: public Klass {
Method* method_at_itable(Klass* holder, int index, TRAPS);
#if INCLUDE_JVMTI
- void adjust_default_methods(Method** old_methods, Method** new_methods,
- int methods_length, bool* trace_name_printed);
+ void adjust_default_methods(InstanceKlass* holder, bool* trace_name_printed);
#endif // INCLUDE_JVMTI
// Garbage collection
diff --git a/hotspot/src/share/vm/oops/klassVtable.cpp b/hotspot/src/share/vm/oops/klassVtable.cpp
index 8a0ec13191e..5cfa70a73ae 100644
--- a/hotspot/src/share/vm/oops/klassVtable.cpp
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp
@@ -863,44 +863,43 @@ bool klassVtable::adjust_default_method(int vtable_index, Method* old_method, Me
}
return updated;
}
-void klassVtable::adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed) {
- // search the vtable for uses of either obsolete or EMCP methods
- for (int j = 0; j < methods_length; j++) {
- Method* old_method = old_methods[j];
- Method* new_method = new_methods[j];
- // In the vast majority of cases we could get the vtable index
- // by using: old_method->vtable_index()
- // However, there are rare cases, eg. sun.awt.X11.XDecoratedPeer.getX()
- // in sun.awt.X11.XFramePeer where methods occur more than once in the
- // vtable, so, alas, we must do an exhaustive search.
- for (int index = 0; index < length(); index++) {
- if (unchecked_method_at(index) == old_method) {
- put_method_at(new_method, index);
- // For default methods, need to update the _default_methods array
- // which can only have one method entry for a given signature
- bool updated_default = false;
- if (old_method->is_default_method()) {
- updated_default = adjust_default_method(index, old_method, new_method);
- }
+// search the vtable for uses of either obsolete or EMCP methods
+void klassVtable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
+ int prn_enabled = 0;
+ for (int index = 0; index < length(); index++) {
+ Method* old_method = unchecked_method_at(index);
+ if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ assert(!old_method->is_deleted(), "vtable methods may not be deleted");
- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
- if (!(*trace_name_printed)) {
- // RC_TRACE_MESG macro has an embedded ResourceMark
- RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s",
- klass()->external_name(),
- old_method->method_holder()->external_name()));
- *trace_name_printed = true;
- }
- // RC_TRACE macro has an embedded ResourceMark
- RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s",
- new_method->name()->as_C_string(),
- new_method->signature()->as_C_string(),
- updated_default ? "true" : "false"));
- }
- // cannot 'break' here; see for-loop comment above.
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ put_method_at(new_method, index);
+ // For default methods, need to update the _default_methods array
+ // which can only have one method entry for a given signature
+ bool updated_default = false;
+ if (old_method->is_default_method()) {
+ updated_default = adjust_default_method(index, old_method, new_method);
+ }
+
+ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+ if (!(*trace_name_printed)) {
+ // RC_TRACE_MESG macro has an embedded ResourceMark
+ RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s",
+ klass()->external_name(),
+ old_method->method_holder()->external_name()));
+ *trace_name_printed = true;
}
+ // RC_TRACE macro has an embedded ResourceMark
+ RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s",
+ new_method->name()->as_C_string(),
+ new_method->signature()->as_C_string(),
+ updated_default ? "true" : "false"));
}
}
}
@@ -1193,37 +1192,35 @@ void klassItable::initialize_with_method(Method* m) {
}
#if INCLUDE_JVMTI
-void klassItable::adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed) {
- // search the itable for uses of either obsolete or EMCP methods
- for (int j = 0; j < methods_length; j++) {
- Method* old_method = old_methods[j];
- Method* new_method = new_methods[j];
- itableMethodEntry* ime = method_entry(0);
+// search the itable for uses of either obsolete or EMCP methods
+void klassItable::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
- // The itable can describe more than one interface and the same
- // method signature can be specified by more than one interface.
- // This means we have to do an exhaustive search to find all the
- // old_method references.
- for (int i = 0; i < _size_method_table; i++) {
- if (ime->method() == old_method) {
- ime->initialize(new_method);
+ itableMethodEntry* ime = method_entry(0);
+ for (int i = 0; i < _size_method_table; i++, ime++) {
+ Method* old_method = ime->method();
+ if (old_method == NULL || old_method->method_holder() != holder || !old_method->is_old()) {
+ continue; // skip uninteresting entries
+ }
+ assert(!old_method->is_deleted(), "itable methods may not be deleted");
- if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
- if (!(*trace_name_printed)) {
- // RC_TRACE_MESG macro has an embedded ResourceMark
- RC_TRACE_MESG(("adjust: name=%s",
- old_method->method_holder()->external_name()));
- *trace_name_printed = true;
- }
- // RC_TRACE macro has an embedded ResourceMark
- RC_TRACE(0x00200000, ("itable method update: %s(%s)",
- new_method->name()->as_C_string(),
- new_method->signature()->as_C_string()));
- }
- // cannot 'break' here; see for-loop comment above.
+ Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());
+
+ assert(new_method != NULL, "method_with_idnum() should not be NULL");
+ assert(old_method != new_method, "sanity check");
+
+ ime->initialize(new_method);
+
+ if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+ if (!(*trace_name_printed)) {
+ // RC_TRACE_MESG macro has an embedded ResourceMark
+ RC_TRACE_MESG(("adjust: name=%s",
+ old_method->method_holder()->external_name()));
+ *trace_name_printed = true;
}
- ime++;
+ // RC_TRACE macro has an embedded ResourceMark
+ RC_TRACE(0x00200000, ("itable method update: %s(%s)",
+ new_method->name()->as_C_string(),
+ new_method->signature()->as_C_string()));
}
}
}
diff --git a/hotspot/src/share/vm/oops/klassVtable.hpp b/hotspot/src/share/vm/oops/klassVtable.hpp
index 01ad63fcfa0..e4b4c9f5141 100644
--- a/hotspot/src/share/vm/oops/klassVtable.hpp
+++ b/hotspot/src/share/vm/oops/klassVtable.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -98,8 +98,7 @@ class klassVtable : public ResourceObj {
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
bool adjust_default_method(int vtable_index, Method* old_method, Method* new_method);
- void adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed);
+ void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_vtable();
#endif // INCLUDE_JVMTI
@@ -288,8 +287,7 @@ class klassItable : public ResourceObj {
// trace_name_printed is set to true if the current call has
// printed the klass name so that other routines in the adjust_*
// group don't print the klass name.
- void adjust_method_entries(Method** old_methods, Method** new_methods,
- int methods_length, bool * trace_name_printed);
+ void adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed);
bool check_no_old_or_obsolete_entries();
void dump_itable();
#endif // INCLUDE_JVMTI
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index 9e37b0b8504..ac0a422b83d 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -1450,6 +1450,7 @@ void Method::sort_methods(Array* methods, bool idempotent, bool set_idn
for (int i = 0; i < length; i++) {
Method* m = methods->at(i);
m->set_method_idnum(i);
+ m->set_orig_method_idnum(i);
}
}
}
diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp
index 8b279341dc8..d87864a7704 100644
--- a/hotspot/src/share/vm/oops/method.hpp
+++ b/hotspot/src/share/vm/oops/method.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -233,6 +233,9 @@ class Method : public Metadata {
u2 method_idnum() const { return constMethod()->method_idnum(); }
void set_method_idnum(u2 idnum) { constMethod()->set_method_idnum(idnum); }
+ u2 orig_method_idnum() const { return constMethod()->orig_method_idnum(); }
+ void set_orig_method_idnum(u2 idnum) { constMethod()->set_orig_method_idnum(idnum); }
+
// code size
int code_size() const { return constMethod()->code_size(); }
diff --git a/hotspot/src/share/vm/opto/arraycopynode.cpp b/hotspot/src/share/vm/opto/arraycopynode.cpp
new file mode 100644
index 00000000000..5542d7fc822
--- /dev/null
+++ b/hotspot/src/share/vm/opto/arraycopynode.cpp
@@ -0,0 +1,597 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "opto/arraycopynode.hpp"
+#include "opto/graphKit.hpp"
+
+ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
+ : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM),
+ _alloc_tightly_coupled(alloc_tightly_coupled),
+ _kind(None),
+ _arguments_validated(false) {
+ init_class_id(Class_ArrayCopy);
+ init_flags(Flag_is_macro);
+ C->add_macro_node(this);
+}
+
+uint ArrayCopyNode::size_of() const { return sizeof(*this); }
+
+ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
+ Node* src, Node* src_offset,
+ Node* dest, Node* dest_offset,
+ Node* length,
+ bool alloc_tightly_coupled,
+ Node* src_klass, Node* dest_klass,
+ Node* src_length, Node* dest_length) {
+
+ ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled);
+ Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
+
+ ac->init_req(ArrayCopyNode::Src, src);
+ ac->init_req(ArrayCopyNode::SrcPos, src_offset);
+ ac->init_req(ArrayCopyNode::Dest, dest);
+ ac->init_req(ArrayCopyNode::DestPos, dest_offset);
+ ac->init_req(ArrayCopyNode::Length, length);
+ ac->init_req(ArrayCopyNode::SrcLen, src_length);
+ ac->init_req(ArrayCopyNode::DestLen, dest_length);
+ ac->init_req(ArrayCopyNode::SrcKlass, src_klass);
+ ac->init_req(ArrayCopyNode::DestKlass, dest_klass);
+
+ if (may_throw) {
+ ac->set_req(TypeFunc::I_O , kit->i_o());
+ kit->add_safepoint_edges(ac, false);
+ }
+
+ return ac;
+}
+
+void ArrayCopyNode::connect_outputs(GraphKit* kit) {
+ kit->set_all_memory_call(this, true);
+ kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control)));
+ kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O)));
+ kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
+ kit->set_all_memory_call(this);
+}
+
+#ifndef PRODUCT
+const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"};
+void ArrayCopyNode::dump_spec(outputStream *st) const {
+ CallNode::dump_spec(st);
+ st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : "");
+}
+#endif
+
+intptr_t ArrayCopyNode::get_length_if_constant(PhaseGVN *phase) const {
+ // check that length is constant
+ Node* length = in(ArrayCopyNode::Length);
+ const Type* length_type = phase->type(length);
+
+ if (length_type == Type::TOP) {
+ return -1;
+ }
+
+ assert(is_clonebasic() || is_arraycopy() || is_copyof() || is_copyofrange(), "unexpected array copy type");
+
+ return is_clonebasic() ? length->find_intptr_t_con(-1) : length->find_int_con(-1);
+}
+
+int ArrayCopyNode::get_count(PhaseGVN *phase) const {
+ Node* src = in(ArrayCopyNode::Src);
+ const Type* src_type = phase->type(src);
+
+ if (is_clonebasic()) {
+ if (src_type->isa_instptr()) {
+ const TypeInstPtr* inst_src = src_type->is_instptr();
+ ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+ // ciInstanceKlass::nof_nonstatic_fields() doesn't take injected
+ // fields into account. They are rare anyway so easier to simply
+ // skip instances with injected fields.
+ if ((!inst_src->klass_is_exact() && (ik->is_interface() || ik->has_subklass())) || ik->has_injected_fields()) {
+ return -1;
+ }
+ int nb_fields = ik->nof_nonstatic_fields();
+ return nb_fields;
+ } else {
+ const TypeAryPtr* ary_src = src_type->isa_aryptr();
+ assert (ary_src != NULL, "not an array or instance?");
+ // clone passes a length as a rounded number of longs. If we're
+ // cloning an array we'll do it element by element. If the
+ // length input to ArrayCopyNode is constant, length of input
+ // array must be too.
+
+ assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con() ||
+ phase->is_IterGVN(), "inconsistent");
+
+ if (ary_src->size()->is_con()) {
+ return ary_src->size()->get_con();
+ }
+ return -1;
+ }
+ }
+
+ return get_length_if_constant(phase);
+}
+
+Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) {
+ if (!is_clonebasic()) {
+ return NULL;
+ }
+
+ Node* src = in(ArrayCopyNode::Src);
+ Node* dest = in(ArrayCopyNode::Dest);
+ Node* ctl = in(TypeFunc::Control);
+ Node* in_mem = in(TypeFunc::Memory);
+
+ const Type* src_type = phase->type(src);
+
+ assert(src->is_AddP(), "should be base + off");
+ assert(dest->is_AddP(), "should be base + off");
+ Node* base_src = src->in(AddPNode::Base);
+ Node* base_dest = dest->in(AddPNode::Base);
+
+ MergeMemNode* mem = MergeMemNode::make(in_mem);
+
+ const TypeInstPtr* inst_src = src_type->isa_instptr();
+
+ if (inst_src == NULL) {
+ return NULL;
+ }
+
+ if (!inst_src->klass_is_exact()) {
+ ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+ assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy");
+ phase->C->dependencies()->assert_leaf_type(ik);
+ }
+
+ ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
+ assert(ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem, "too many fields");
+
+ for (int i = 0; i < count; i++) {
+ ciField* field = ik->nonstatic_field_at(i);
+ int fieldidx = phase->C->alias_type(field)->index();
+ const TypePtr* adr_type = phase->C->alias_type(field)->adr_type();
+ Node* off = phase->MakeConX(field->offset());
+ Node* next_src = phase->transform(new AddPNode(base_src,base_src,off));
+ Node* next_dest = phase->transform(new AddPNode(base_dest,base_dest,off));
+ BasicType bt = field->layout_type();
+
+ const Type *type;
+ if (bt == T_OBJECT) {
+ if (!field->type()->is_loaded()) {
+ type = TypeInstPtr::BOTTOM;
+ } else {
+ ciType* field_klass = field->type();
+ type = TypeOopPtr::make_from_klass(field_klass->as_klass());
+ }
+ } else {
+ type = Type::get_const_basic_type(bt);
+ }
+
+ Node* v = LoadNode::make(*phase, ctl, mem->memory_at(fieldidx), next_src, adr_type, type, bt, MemNode::unordered);
+ v = phase->transform(v);
+ Node* s = StoreNode::make(*phase, ctl, mem->memory_at(fieldidx), next_dest, adr_type, v, bt, MemNode::unordered);
+ s = phase->transform(s);
+ mem->set_memory_at(fieldidx, s);
+ }
+
+ if (!finish_transform(phase, can_reshape, ctl, mem)) {
+ return NULL;
+ }
+
+ return mem;
+}
+
+bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,
+ Node*& adr_src,
+ Node*& base_src,
+ Node*& adr_dest,
+ Node*& base_dest,
+ BasicType& copy_type,
+ const Type*& value_type,
+ bool& disjoint_bases) {
+ Node* src = in(ArrayCopyNode::Src);
+ Node* dest = in(ArrayCopyNode::Dest);
+ const Type* src_type = phase->type(src);
+ const TypeAryPtr* ary_src = src_type->isa_aryptr();
+
+ if (is_arraycopy() || is_copyofrange() || is_copyof()) {
+ const Type* dest_type = phase->type(dest);
+ const TypeAryPtr* ary_dest = dest_type->isa_aryptr();
+ Node* src_offset = in(ArrayCopyNode::SrcPos);
+ Node* dest_offset = in(ArrayCopyNode::DestPos);
+
+ // newly allocated object is guaranteed to not overlap with source object
+ disjoint_bases = is_alloc_tightly_coupled();
+
+ if (ary_src == NULL || ary_src->klass() == NULL ||
+ ary_dest == NULL || ary_dest->klass() == NULL) {
+ // We don't know if arguments are arrays
+ return false;
+ }
+
+ BasicType src_elem = ary_src->klass()->as_array_klass()->element_type()->basic_type();
+ BasicType dest_elem = ary_dest->klass()->as_array_klass()->element_type()->basic_type();
+ if (src_elem == T_ARRAY) src_elem = T_OBJECT;
+ if (dest_elem == T_ARRAY) dest_elem = T_OBJECT;
+
+ if (src_elem != dest_elem || dest_elem == T_VOID) {
+ // We don't know if arguments are arrays of the same type
+ return false;
+ }
+
+ if (dest_elem == T_OBJECT && (!is_alloc_tightly_coupled() || !GraphKit::use_ReduceInitialCardMarks())) {
+ // It's an object array copy but we can't emit the card marking
+ // that is needed
+ return false;
+ }
+
+ value_type = ary_src->elem();
+
+ base_src = src;
+ base_dest = dest;
+
+ uint shift = exact_log2(type2aelembytes(dest_elem));
+ uint header = arrayOopDesc::base_offset_in_bytes(dest_elem);
+
+ adr_src = src;
+ adr_dest = dest;
+
+ src_offset = Compile::conv_I2X_index(phase, src_offset, ary_src->size());
+ dest_offset = Compile::conv_I2X_index(phase, dest_offset, ary_dest->size());
+
+ Node* src_scale = phase->transform(new LShiftXNode(src_offset, phase->intcon(shift)));
+ Node* dest_scale = phase->transform(new LShiftXNode(dest_offset, phase->intcon(shift)));
+
+ adr_src = phase->transform(new AddPNode(base_src, adr_src, src_scale));
+ adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, dest_scale));
+
+ adr_src = new AddPNode(base_src, adr_src, phase->MakeConX(header));
+ adr_dest = new AddPNode(base_dest, adr_dest, phase->MakeConX(header));
+
+ adr_src = phase->transform(adr_src);
+ adr_dest = phase->transform(adr_dest);
+
+ copy_type = dest_elem;
+ } else {
+ assert (is_clonebasic(), "should be");
+
+ disjoint_bases = true;
+ assert(src->is_AddP(), "should be base + off");
+ assert(dest->is_AddP(), "should be base + off");
+ adr_src = src;
+ base_src = src->in(AddPNode::Base);
+ adr_dest = dest;
+ base_dest = dest->in(AddPNode::Base);
+
+ assert(phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con() == phase->type(dest->in(AddPNode::Offset))->is_intptr_t()->get_con(), "same start offset?");
+ BasicType elem = ary_src->klass()->as_array_klass()->element_type()->basic_type();
+ if (elem == T_ARRAY) elem = T_OBJECT;
+
+ int diff = arrayOopDesc::base_offset_in_bytes(elem) - phase->type(src->in(AddPNode::Offset))->is_intptr_t()->get_con();
+ assert(diff >= 0, "clone should not start after 1st array element");
+ if (diff > 0) {
+ adr_src = phase->transform(new AddPNode(base_src, adr_src, phase->MakeConX(diff)));
+ adr_dest = phase->transform(new AddPNode(base_dest, adr_dest, phase->MakeConX(diff)));
+ }
+
+ copy_type = elem;
+ value_type = ary_src->elem();
+ }
+ return true;
+}
+
+const TypePtr* ArrayCopyNode::get_address_type(PhaseGVN *phase, Node* n) {
+ const Type* at = phase->type(n);
+ assert(at != Type::TOP, "unexpected type");
+ const TypePtr* atp = at->isa_ptr();
+ // adjust atp to be the correct array element address type
+ atp = atp->add_offset(Type::OffsetBot);
+ return atp;
+}
+
+void ArrayCopyNode::array_copy_test_overlap(PhaseGVN *phase, bool can_reshape, bool disjoint_bases, int count, Node*& forward_ctl, Node*& backward_ctl) {
+ Node* ctl = in(TypeFunc::Control);
+ if (!disjoint_bases && count > 1) {
+ Node* src_offset = in(ArrayCopyNode::SrcPos);
+ Node* dest_offset = in(ArrayCopyNode::DestPos);
+ assert(src_offset != NULL && dest_offset != NULL, "should be");
+ Node* cmp = phase->transform(new CmpINode(src_offset, dest_offset));
+ Node *bol = phase->transform(new BoolNode(cmp, BoolTest::lt));
+ IfNode *iff = new IfNode(ctl, bol, PROB_FAIR, COUNT_UNKNOWN);
+
+ phase->transform(iff);
+
+ forward_ctl = phase->transform(new IfFalseNode(iff));
+ backward_ctl = phase->transform(new IfTrueNode(iff));
+ } else {
+ forward_ctl = ctl;
+ }
+}
+
+Node* ArrayCopyNode::array_copy_forward(PhaseGVN *phase,
+ bool can_reshape,
+ Node* forward_ctl,
+ Node* start_mem_src,
+ Node* start_mem_dest,
+ const TypePtr* atp_src,
+ const TypePtr* atp_dest,
+ Node* adr_src,
+ Node* base_src,
+ Node* adr_dest,
+ Node* base_dest,
+ BasicType copy_type,
+ const Type* value_type,
+ int count) {
+ Node* mem = phase->C->top();
+ if (!forward_ctl->is_top()) {
+ // copy forward
+ mem = start_mem_dest;
+
+ if (count > 0) {
+ Node* v = LoadNode::make(*phase, forward_ctl, start_mem_src, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, forward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ for (int i = 1; i < count; i++) {
+ Node* off = phase->MakeConX(type2aelembytes(copy_type) * i);
+ Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
+ Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
+ v = LoadNode::make(*phase, forward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, forward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ }
+ } else if(can_reshape) {
+ PhaseIterGVN* igvn = phase->is_IterGVN();
+ igvn->_worklist.push(adr_src);
+ igvn->_worklist.push(adr_dest);
+ }
+ }
+ return mem;
+}
+
+Node* ArrayCopyNode::array_copy_backward(PhaseGVN *phase,
+ bool can_reshape,
+ Node* backward_ctl,
+ Node* start_mem_src,
+ Node* start_mem_dest,
+ const TypePtr* atp_src,
+ const TypePtr* atp_dest,
+ Node* adr_src,
+ Node* base_src,
+ Node* adr_dest,
+ Node* base_dest,
+ BasicType copy_type,
+ const Type* value_type,
+ int count) {
+ Node* mem = phase->C->top();
+ if (!backward_ctl->is_top()) {
+ // copy backward
+ mem = start_mem_dest;
+
+ if (count > 0) {
+ for (int i = count-1; i >= 1; i--) {
+ Node* off = phase->MakeConX(type2aelembytes(copy_type) * i);
+ Node* next_src = phase->transform(new AddPNode(base_src,adr_src,off));
+ Node* next_dest = phase->transform(new AddPNode(base_dest,adr_dest,off));
+ Node* v = LoadNode::make(*phase, backward_ctl, mem, next_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, backward_ctl,mem,next_dest,atp_dest,v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ }
+ Node* v = LoadNode::make(*phase, backward_ctl, mem, adr_src, atp_src, value_type, copy_type, MemNode::unordered);
+ v = phase->transform(v);
+ mem = StoreNode::make(*phase, backward_ctl, mem, adr_dest, atp_dest, v, copy_type, MemNode::unordered);
+ mem = phase->transform(mem);
+ } else if(can_reshape) {
+ PhaseIterGVN* igvn = phase->is_IterGVN();
+ igvn->_worklist.push(adr_src);
+ igvn->_worklist.push(adr_dest);
+ }
+ }
+ return mem;
+}
+
+bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
+ Node* ctl, Node *mem) {
+ if (can_reshape) {
+ PhaseIterGVN* igvn = phase->is_IterGVN();
+ igvn->set_delay_transform(false);
+ if (is_clonebasic()) {
+ Node* out_mem = proj_out(TypeFunc::Memory);
+
+ if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() ||
+ out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) {
+ assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking");
+ return false;
+ }
+
+ igvn->replace_node(out_mem->raw_out(0), mem);
+
+ Node* out_ctl = proj_out(TypeFunc::Control);
+ igvn->replace_node(out_ctl, ctl);
+ } else {
+ // replace fallthrough projections of the ArrayCopyNode by the
+ // new memory, control and the input IO.
+ CallProjections callprojs;
+ extract_projections(&callprojs, true);
+
+ igvn->replace_node(callprojs.fallthrough_ioproj, in(TypeFunc::I_O));
+ igvn->replace_node(callprojs.fallthrough_memproj, mem);
+ igvn->replace_node(callprojs.fallthrough_catchproj, ctl);
+
+ // The ArrayCopyNode is not disconnected. It still has the
+ // projections for the exception case. Replace current
+ // ArrayCopyNode with a dummy new one with a top() control so
+ // that this part of the graph stays consistent but is
+ // eventually removed.
+
+ set_req(0, phase->C->top());
+ remove_dead_region(phase, can_reshape);
+ }
+ } else {
+ if (in(TypeFunc::Control) != ctl) {
+ // we can't return new memory and control from Ideal at parse time
+ assert(!is_clonebasic(), "added control for clone?");
+ return false;
+ }
+ }
+ return true;
+}
+
+
+Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+ if (remove_dead_region(phase, can_reshape)) return this;
+
+ if (StressArrayCopyMacroNode && !can_reshape) {
+ phase->record_for_igvn(this);
+ return NULL;
+ }
+
+ // See if it's a small array copy and we can inline it as
+ // loads/stores
+ // Here we can only do:
+ // - arraycopy if all arguments were validated before and we don't
+ // need card marking
+ // - clone for which we don't need to do card marking
+
+ if (!is_clonebasic() && !is_arraycopy_validated() &&
+ !is_copyofrange_validated() && !is_copyof_validated()) {
+ return NULL;
+ }
+
+ assert(in(TypeFunc::Control) != NULL &&
+ in(TypeFunc::Memory) != NULL &&
+ in(ArrayCopyNode::Src) != NULL &&
+ in(ArrayCopyNode::Dest) != NULL &&
+ in(ArrayCopyNode::Length) != NULL &&
+ ((in(ArrayCopyNode::SrcPos) != NULL && in(ArrayCopyNode::DestPos) != NULL) ||
+ is_clonebasic()), "broken inputs");
+
+ if (in(TypeFunc::Control)->is_top() ||
+ in(TypeFunc::Memory)->is_top() ||
+ phase->type(in(ArrayCopyNode::Src)) == Type::TOP ||
+ phase->type(in(ArrayCopyNode::Dest)) == Type::TOP ||
+ (in(ArrayCopyNode::SrcPos) != NULL && in(ArrayCopyNode::SrcPos)->is_top()) ||
+ (in(ArrayCopyNode::DestPos) != NULL && in(ArrayCopyNode::DestPos)->is_top())) {
+ return NULL;
+ }
+
+ int count = get_count(phase);
+
+ if (count < 0 || count > ArrayCopyLoadStoreMaxElem) {
+ return NULL;
+ }
+
+ Node* mem = try_clone_instance(phase, can_reshape, count);
+ if (mem != NULL) {
+ return mem;
+ }
+
+ Node* adr_src = NULL;
+ Node* base_src = NULL;
+ Node* adr_dest = NULL;
+ Node* base_dest = NULL;
+ BasicType copy_type = T_ILLEGAL;
+ const Type* value_type = NULL;
+ bool disjoint_bases = false;
+
+ if (!prepare_array_copy(phase, can_reshape,
+ adr_src, base_src, adr_dest, base_dest,
+ copy_type, value_type, disjoint_bases)) {
+ return NULL;
+ }
+
+ Node* src = in(ArrayCopyNode::Src);
+ Node* dest = in(ArrayCopyNode::Dest);
+ const TypePtr* atp_src = get_address_type(phase, src);
+ const TypePtr* atp_dest = get_address_type(phase, dest);
+ uint alias_idx_src = phase->C->get_alias_index(atp_src);
+ uint alias_idx_dest = phase->C->get_alias_index(atp_dest);
+
+ Node *in_mem = in(TypeFunc::Memory);
+ Node *start_mem_src = in_mem;
+ Node *start_mem_dest = in_mem;
+ if (in_mem->is_MergeMem()) {
+ start_mem_src = in_mem->as_MergeMem()->memory_at(alias_idx_src);
+ start_mem_dest = in_mem->as_MergeMem()->memory_at(alias_idx_dest);
+ }
+
+
+ if (can_reshape) {
+ assert(!phase->is_IterGVN()->delay_transform(), "cannot delay transforms");
+ phase->is_IterGVN()->set_delay_transform(true);
+ }
+
+ Node* backward_ctl = phase->C->top();
+ Node* forward_ctl = phase->C->top();
+ array_copy_test_overlap(phase, can_reshape, disjoint_bases, count, forward_ctl, backward_ctl);
+
+ Node* forward_mem = array_copy_forward(phase, can_reshape, forward_ctl,
+ start_mem_src, start_mem_dest,
+ atp_src, atp_dest,
+ adr_src, base_src, adr_dest, base_dest,
+ copy_type, value_type, count);
+
+ Node* backward_mem = array_copy_backward(phase, can_reshape, backward_ctl,
+ start_mem_src, start_mem_dest,
+ atp_src, atp_dest,
+ adr_src, base_src, adr_dest, base_dest,
+ copy_type, value_type, count);
+
+ Node* ctl = NULL;
+ if (!forward_ctl->is_top() && !backward_ctl->is_top()) {
+ ctl = new RegionNode(3);
+ mem = new PhiNode(ctl, Type::MEMORY, atp_dest);
+ ctl->init_req(1, forward_ctl);
+ mem->init_req(1, forward_mem);
+ ctl->init_req(2, backward_ctl);
+ mem->init_req(2, backward_mem);
+ ctl = phase->transform(ctl);
+ mem = phase->transform(mem);
+ } else if (!forward_ctl->is_top()) {
+ ctl = forward_ctl;
+ mem = forward_mem;
+ } else {
+ assert(!backward_ctl->is_top(), "no copy?");
+ ctl = backward_ctl;
+ mem = backward_mem;
+ }
+
+ if (can_reshape) {
+ assert(phase->is_IterGVN()->delay_transform(), "should be delaying transforms");
+ phase->is_IterGVN()->set_delay_transform(false);
+ }
+
+ MergeMemNode* out_mem = MergeMemNode::make(in_mem);
+ out_mem->set_memory_at(alias_idx_dest, mem);
+ mem = out_mem;
+
+ if (!finish_transform(phase, can_reshape, ctl, mem)) {
+ return NULL;
+ }
+
+ return mem;
+}
diff --git a/hotspot/src/share/vm/opto/arraycopynode.hpp b/hotspot/src/share/vm/opto/arraycopynode.hpp
new file mode 100644
index 00000000000..e61f1ba2c4b
--- /dev/null
+++ b/hotspot/src/share/vm/opto/arraycopynode.hpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
+#define SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
+
+#include "opto/callnode.hpp"
+
+class GraphKit;
+
+class ArrayCopyNode : public CallNode {
+private:
+
+ // What kind of arraycopy variant is this?
+ enum {
+ None, // not set yet
+ ArrayCopy, // System.arraycopy()
+ CloneBasic, // A clone that can be copied by 64 bit chunks
+ CloneOop, // An oop array clone
+ CopyOf, // Arrays.copyOf()
+ CopyOfRange // Arrays.copyOfRange()
+ } _kind;
+
+#ifndef PRODUCT
+ static const char* _kind_names[CopyOfRange+1];
+#endif
+ // Is the alloc obtained with
+ // AllocateArrayNode::Ideal_array_allocation() tighly coupled
+ // (arraycopy follows immediately the allocation)?
+ // We cache the result of LibraryCallKit::tightly_coupled_allocation
+ // here because it's much easier to find whether there's a tightly
+ // couple allocation at parse time than at macro expansion time. At
+ // macro expansion time, for every use of the allocation node we
+ // would need to figure out whether it happens after the arraycopy (and
+ // can be ignored) or between the allocation and the arraycopy. At
+ // parse time, it's straightforward because whatever happens after
+ // the arraycopy is not parsed yet so doesn't exist when
+ // LibraryCallKit::tightly_coupled_allocation() is called.
+ bool _alloc_tightly_coupled;
+
+ bool _arguments_validated;
+
+ static const TypeFunc* arraycopy_type() {
+ const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
+ fields[Src] = TypeInstPtr::BOTTOM;
+ fields[SrcPos] = TypeInt::INT;
+ fields[Dest] = TypeInstPtr::BOTTOM;
+ fields[DestPos] = TypeInt::INT;
+ fields[Length] = TypeInt::INT;
+ fields[SrcLen] = TypeInt::INT;
+ fields[DestLen] = TypeInt::INT;
+ fields[SrcKlass] = TypeKlassPtr::BOTTOM;
+ fields[DestKlass] = TypeKlassPtr::BOTTOM;
+ const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
+
+ // create result type (range)
+ fields = TypeTuple::fields(0);
+
+ const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
+
+ return TypeFunc::make(domain, range);
+ }
+
+ ArrayCopyNode(Compile* C, bool alloc_tightly_coupled);
+
+ intptr_t get_length_if_constant(PhaseGVN *phase) const;
+ int get_count(PhaseGVN *phase) const;
+ static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
+
+ Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
+ Node* conv_I2X_offset(PhaseGVN *phase, Node* offset, const TypeAryPtr* ary_t);
+ bool prepare_array_copy(PhaseGVN *phase, bool can_reshape,
+ Node*& adr_src, Node*& base_src, Node*& adr_dest, Node*& base_dest,
+ BasicType& copy_type, const Type*& value_type, bool& disjoint_bases);
+ void array_copy_test_overlap(PhaseGVN *phase, bool can_reshape,
+ bool disjoint_bases, int count,
+ Node*& forward_ctl, Node*& backward_ctl);
+ Node* array_copy_forward(PhaseGVN *phase, bool can_reshape, Node* ctl,
+ Node* start_mem_src, Node* start_mem_dest,
+ const TypePtr* atp_src, const TypePtr* atp_dest,
+ Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
+ BasicType copy_type, const Type* value_type, int count);
+ Node* array_copy_backward(PhaseGVN *phase, bool can_reshape, Node* ctl,
+ Node *start_mem_src, Node* start_mem_dest,
+ const TypePtr* atp_src, const TypePtr* atp_dest,
+ Node* adr_src, Node* base_src, Node* adr_dest, Node* base_dest,
+ BasicType copy_type, const Type* value_type, int count);
+ bool finish_transform(PhaseGVN *phase, bool can_reshape,
+ Node* ctl, Node *mem);
+
+public:
+
+ enum {
+ Src = TypeFunc::Parms,
+ SrcPos,
+ Dest,
+ DestPos,
+ Length,
+ SrcLen,
+ DestLen,
+ SrcKlass,
+ DestKlass,
+ ParmLimit
+ };
+
+ static ArrayCopyNode* make(GraphKit* kit, bool may_throw,
+ Node* src, Node* src_offset,
+ Node* dest, Node* dest_offset,
+ Node* length,
+ bool alloc_tightly_coupled,
+ Node* src_klass = NULL, Node* dest_klass = NULL,
+ Node* src_length = NULL, Node* dest_length = NULL);
+
+ void connect_outputs(GraphKit* kit);
+
+ bool is_arraycopy() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
+ bool is_arraycopy_validated() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
+ bool is_clonebasic() const { assert(_kind != None, "should bet set"); return _kind == CloneBasic; }
+ bool is_cloneoop() const { assert(_kind != None, "should bet set"); return _kind == CloneOop; }
+ bool is_copyof() const { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
+ bool is_copyof_validated() const { assert(_kind != None, "should bet set"); return _kind == CopyOf && _arguments_validated; }
+ bool is_copyofrange() const { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
+ bool is_copyofrange_validated() const { assert(_kind != None, "should bet set"); return _kind == CopyOfRange && _arguments_validated; }
+
+ void set_arraycopy(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
+ void set_clonebasic() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; }
+ void set_cloneoop() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; }
+ void set_copyof(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = validated; }
+ void set_copyofrange(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = validated; }
+
+ virtual int Opcode() const;
+ virtual uint size_of() const; // Size is bigger
+ virtual bool guaranteed_safepoint() { return false; }
+ virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
+
+ bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
+
+#ifndef PRODUCT
+ virtual void dump_spec(outputStream *st) const;
+#endif
+};
+
+#endif // SHARE_VM_OPTO_ARRAYCOPYNODE_HPP
diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp
index a5f173e0327..46975b51e10 100644
--- a/hotspot/src/share/vm/opto/callnode.cpp
+++ b/hotspot/src/share/vm/opto/callnode.cpp
@@ -1875,194 +1875,3 @@ void AbstractLockNode::log_lock_optimization(Compile *C, const char * tag) cons
log->tail(tag);
}
}
-
-ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
- : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM),
- _alloc_tightly_coupled(alloc_tightly_coupled),
- _kind(None),
- _arguments_validated(false) {
- init_class_id(Class_ArrayCopy);
- init_flags(Flag_is_macro);
- C->add_macro_node(this);
-}
-
-uint ArrayCopyNode::size_of() const { return sizeof(*this); }
-
-ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
- Node* src, Node* src_offset,
- Node* dest, Node* dest_offset,
- Node* length,
- bool alloc_tightly_coupled,
- Node* src_klass, Node* dest_klass,
- Node* src_length, Node* dest_length) {
-
- ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled);
- Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
-
- ac->init_req(ArrayCopyNode::Src, src);
- ac->init_req(ArrayCopyNode::SrcPos, src_offset);
- ac->init_req(ArrayCopyNode::Dest, dest);
- ac->init_req(ArrayCopyNode::DestPos, dest_offset);
- ac->init_req(ArrayCopyNode::Length, length);
- ac->init_req(ArrayCopyNode::SrcLen, src_length);
- ac->init_req(ArrayCopyNode::DestLen, dest_length);
- ac->init_req(ArrayCopyNode::SrcKlass, src_klass);
- ac->init_req(ArrayCopyNode::DestKlass, dest_klass);
-
- if (may_throw) {
- ac->set_req(TypeFunc::I_O , kit->i_o());
- kit->add_safepoint_edges(ac, false);
- }
-
- return ac;
-}
-
-void ArrayCopyNode::connect_outputs(GraphKit* kit) {
- kit->set_all_memory_call(this, true);
- kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control)));
- kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O)));
- kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
- kit->set_all_memory_call(this);
-}
-
-#ifndef PRODUCT
-const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"};
-void ArrayCopyNode::dump_spec(outputStream *st) const {
- CallNode::dump_spec(st);
- st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : "");
-}
-#endif
-
-int ArrayCopyNode::get_count(PhaseGVN *phase) const {
- Node* src = in(ArrayCopyNode::Src);
- const Type* src_type = phase->type(src);
-
- assert(is_clonebasic(), "unexpected arraycopy type");
- if (src_type->isa_instptr()) {
- const TypeInstPtr* inst_src = src_type->is_instptr();
- ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
- // ciInstanceKlass::nof_nonstatic_fields() doesn't take injected
- // fields into account. They are rare anyway so easier to simply
- // skip instances with injected fields.
- if ((!inst_src->klass_is_exact() && (ik->is_interface() || ik->has_subklass())) || ik->has_injected_fields()) {
- return -1;
- }
- int nb_fields = ik->nof_nonstatic_fields();
- return nb_fields;
- }
- return -1;
-}
-
-Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) {
- assert(is_clonebasic(), "unexpected arraycopy type");
-
- Node* src = in(ArrayCopyNode::Src);
- Node* dest = in(ArrayCopyNode::Dest);
- Node* ctl = in(TypeFunc::Control);
- Node* in_mem = in(TypeFunc::Memory);
-
- const Type* src_type = phase->type(src);
- const Type* dest_type = phase->type(dest);
-
- assert(src->is_AddP(), "should be base + off");
- assert(dest->is_AddP(), "should be base + off");
- Node* base_src = src->in(AddPNode::Base);
- Node* base_dest = dest->in(AddPNode::Base);
-
- MergeMemNode* mem = MergeMemNode::make(in_mem);
-
- const TypeInstPtr* inst_src = src_type->is_instptr();
-
- if (!inst_src->klass_is_exact()) {
- ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
- assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy");
- phase->C->dependencies()->assert_leaf_type(ik);
- }
-
- ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
- assert(ik->nof_nonstatic_fields() <= ArrayCopyLoadStoreMaxElem, "too many fields");
-
- for (int i = 0; i < count; i++) {
- ciField* field = ik->nonstatic_field_at(i);
- int fieldidx = phase->C->alias_type(field)->index();
- const TypePtr* adr_type = phase->C->alias_type(field)->adr_type();
- Node* off = phase->MakeConX(field->offset());
- Node* next_src = phase->transform(new AddPNode(base_src,base_src,off));
- Node* next_dest = phase->transform(new AddPNode(base_dest,base_dest,off));
- BasicType bt = field->layout_type();
-
- const Type *type;
- if (bt == T_OBJECT) {
- if (!field->type()->is_loaded()) {
- type = TypeInstPtr::BOTTOM;
- } else {
- ciType* field_klass = field->type();
- type = TypeOopPtr::make_from_klass(field_klass->as_klass());
- }
- } else {
- type = Type::get_const_basic_type(bt);
- }
-
- Node* v = LoadNode::make(*phase, ctl, mem->memory_at(fieldidx), next_src, adr_type, type, bt, MemNode::unordered);
- v = phase->transform(v);
- Node* s = StoreNode::make(*phase, ctl, mem->memory_at(fieldidx), next_dest, adr_type, v, bt, MemNode::unordered);
- s = phase->transform(s);
- mem->set_memory_at(fieldidx, s);
- }
-
- if (!finish_transform(phase, can_reshape, ctl, mem)) {
- return NULL;
- }
-
- return mem;
-}
-
-bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
- Node* ctl, Node *mem) {
- if (can_reshape) {
- PhaseIterGVN* igvn = phase->is_IterGVN();
- assert(is_clonebasic(), "unexpected arraycopy type");
- Node* out_mem = proj_out(TypeFunc::Memory);
-
- if (out_mem->outcnt() != 1 || !out_mem->raw_out(0)->is_MergeMem() ||
- out_mem->raw_out(0)->outcnt() != 1 || !out_mem->raw_out(0)->raw_out(0)->is_MemBar()) {
- assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking");
- return false;
- }
-
- igvn->replace_node(out_mem->raw_out(0), mem);
-
- Node* out_ctl = proj_out(TypeFunc::Control);
- igvn->replace_node(out_ctl, ctl);
- }
- return true;
-}
-
-
-Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
- if (remove_dead_region(phase, can_reshape)) return this;
-
- if (StressArrayCopyMacroNode && !can_reshape) return NULL;
-
- // See if it's a small array copy and we can inline it as
- // loads/stores
- // Here we can only do:
- // - clone for which we don't need to do card marking
-
- if (!is_clonebasic()) {
- return NULL;
- }
-
- if (in(TypeFunc::Control)->is_top() || in(TypeFunc::Memory)->is_top()) {
- return NULL;
- }
-
- int count = get_count(phase);
-
- if (count < 0 || count > ArrayCopyLoadStoreMaxElem) {
- return NULL;
- }
-
- Node* mem = try_clone_instance(phase, can_reshape, count);
- return mem;
-}
diff --git a/hotspot/src/share/vm/opto/callnode.hpp b/hotspot/src/share/vm/opto/callnode.hpp
index 66ea270320f..26f5c6ba705 100644
--- a/hotspot/src/share/vm/opto/callnode.hpp
+++ b/hotspot/src/share/vm/opto/callnode.hpp
@@ -1083,117 +1083,4 @@ public:
#endif
};
-class GraphKit;
-
-class ArrayCopyNode : public CallNode {
-private:
-
- // What kind of arraycopy variant is this?
- enum {
- None, // not set yet
- ArrayCopy, // System.arraycopy()
- CloneBasic, // A clone that can be copied by 64 bit chunks
- CloneOop, // An oop array clone
- CopyOf, // Arrays.copyOf()
- CopyOfRange // Arrays.copyOfRange()
- } _kind;
-
-#ifndef PRODUCT
- static const char* _kind_names[CopyOfRange+1];
-#endif
- // Is the alloc obtained with
- // AllocateArrayNode::Ideal_array_allocation() tighly coupled
- // (arraycopy follows immediately the allocation)?
- // We cache the result of LibraryCallKit::tightly_coupled_allocation
- // here because it's much easier to find whether there's a tightly
- // couple allocation at parse time than at macro expansion time. At
- // macro expansion time, for every use of the allocation node we
- // would need to figure out whether it happens after the arraycopy (and
- // can be ignored) or between the allocation and the arraycopy. At
- // parse time, it's straightforward because whatever happens after
- // the arraycopy is not parsed yet so doesn't exist when
- // LibraryCallKit::tightly_coupled_allocation() is called.
- bool _alloc_tightly_coupled;
-
- bool _arguments_validated;
-
- static const TypeFunc* arraycopy_type() {
- const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
- fields[Src] = TypeInstPtr::BOTTOM;
- fields[SrcPos] = TypeInt::INT;
- fields[Dest] = TypeInstPtr::BOTTOM;
- fields[DestPos] = TypeInt::INT;
- fields[Length] = TypeInt::INT;
- fields[SrcLen] = TypeInt::INT;
- fields[DestLen] = TypeInt::INT;
- fields[SrcKlass] = TypeKlassPtr::BOTTOM;
- fields[DestKlass] = TypeKlassPtr::BOTTOM;
- const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
-
- // create result type (range)
- fields = TypeTuple::fields(0);
-
- const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
-
- return TypeFunc::make(domain, range);
- }
-
- ArrayCopyNode(Compile* C, bool alloc_tightly_coupled);
-
- int get_count(PhaseGVN *phase) const;
- static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
-
- Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
- bool finish_transform(PhaseGVN *phase, bool can_reshape,
- Node* ctl, Node *mem);
-
-public:
-
- enum {
- Src = TypeFunc::Parms,
- SrcPos,
- Dest,
- DestPos,
- Length,
- SrcLen,
- DestLen,
- SrcKlass,
- DestKlass,
- ParmLimit
- };
-
- static ArrayCopyNode* make(GraphKit* kit, bool may_throw,
- Node* src, Node* src_offset,
- Node* dest, Node* dest_offset,
- Node* length,
- bool alloc_tightly_coupled,
- Node* src_klass = NULL, Node* dest_klass = NULL,
- Node* src_length = NULL, Node* dest_length = NULL);
-
- void connect_outputs(GraphKit* kit);
-
- bool is_arraycopy() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
- bool is_arraycopy_validated() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
- bool is_clonebasic() const { assert(_kind != None, "should bet set"); return _kind == CloneBasic; }
- bool is_cloneoop() const { assert(_kind != None, "should bet set"); return _kind == CloneOop; }
- bool is_copyof() const { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
- bool is_copyofrange() const { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
-
- void set_arraycopy(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
- void set_clonebasic() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; }
- void set_cloneoop() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; }
- void set_copyof() { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = false; }
- void set_copyofrange() { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = false; }
-
- virtual int Opcode() const;
- virtual uint size_of() const; // Size is bigger
- virtual bool guaranteed_safepoint() { return false; }
- virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
-
- bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
-
-#ifndef PRODUCT
- virtual void dump_spec(outputStream *st) const;
-#endif
-};
#endif // SHARE_VM_OPTO_CALLNODE_HPP
diff --git a/hotspot/src/share/vm/opto/classes.cpp b/hotspot/src/share/vm/opto/classes.cpp
index a3113922209..cf63ea1db1f 100644
--- a/hotspot/src/share/vm/opto/classes.cpp
+++ b/hotspot/src/share/vm/opto/classes.cpp
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "opto/addnode.hpp"
+#include "opto/arraycopynode.hpp"
#include "opto/callnode.hpp"
#include "opto/castnode.hpp"
#include "opto/cfgnode.hpp"
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index 62fb82b773d..bbdb43e72a1 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -42,6 +42,7 @@
#include "opto/chaitin.hpp"
#include "opto/compile.hpp"
#include "opto/connode.hpp"
+#include "opto/convertnode.hpp"
#include "opto/divnode.hpp"
#include "opto/escape.hpp"
#include "opto/idealGraphPrinter.hpp"
@@ -3867,6 +3868,26 @@ int Compile::static_subtype_check(ciKlass* superk, ciKlass* subk) {
return SSC_full_test;
}
+Node* Compile::conv_I2X_index(PhaseGVN *phase, Node* idx, const TypeInt* sizetype) {
+#ifdef _LP64
+ // The scaled index operand to AddP must be a clean 64-bit value.
+ // Java allows a 32-bit int to be incremented to a negative
+ // value, which appears in a 64-bit register as a large
+ // positive number. Using that large positive number as an
+ // operand in pointer arithmetic has bad consequences.
+ // On the other hand, 32-bit overflow is rare, and the possibility
+ // can often be excluded, if we annotate the ConvI2L node with
+ // a type assertion that its value is known to be a small positive
+ // number. (The prior range check has ensured this.)
+ // This assertion is used by ConvI2LNode::Ideal.
+ int index_max = max_jint - 1; // array size is max_jint, index is one less
+ if (sizetype != NULL) index_max = sizetype->_hi - 1;
+ const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
+ idx = phase->transform(new ConvI2LNode(idx, lidxtype));
+#endif
+ return idx;
+}
+
// The message about the current inlining is accumulated in
// _print_inlining_stream and transfered into the _print_inlining_list
// once we know whether inlining succeeds or not. For regular
diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp
index c901da09405..2b9c3346997 100644
--- a/hotspot/src/share/vm/opto/compile.hpp
+++ b/hotspot/src/share/vm/opto/compile.hpp
@@ -74,6 +74,7 @@ class SafePointNode;
class JVMState;
class Type;
class TypeData;
+class TypeInt;
class TypePtr;
class TypeOopPtr;
class TypeFunc;
@@ -1221,6 +1222,8 @@ class Compile : public Phase {
enum { SSC_always_false, SSC_always_true, SSC_easy_test, SSC_full_test };
int static_subtype_check(ciKlass* superk, ciKlass* subk);
+ static Node* conv_I2X_index(PhaseGVN *phase, Node* offset, const TypeInt* sizetype);
+
// Auxiliary method for randomized fuzzing/stressing
static bool randomized_select(int count);
};
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index 7865ccca4c3..5a90b50f71b 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -1660,22 +1660,7 @@ Node* GraphKit::array_element_address(Node* ary, Node* idx, BasicType elembt,
// must be correct type for alignment purposes
Node* base = basic_plus_adr(ary, header);
-#ifdef _LP64
- // The scaled index operand to AddP must be a clean 64-bit value.
- // Java allows a 32-bit int to be incremented to a negative
- // value, which appears in a 64-bit register as a large
- // positive number. Using that large positive number as an
- // operand in pointer arithmetic has bad consequences.
- // On the other hand, 32-bit overflow is rare, and the possibility
- // can often be excluded, if we annotate the ConvI2L node with
- // a type assertion that its value is known to be a small positive
- // number. (The prior range check has ensured this.)
- // This assertion is used by ConvI2LNode::Ideal.
- int index_max = max_jint - 1; // array size is max_jint, index is one less
- if (sizetype != NULL) index_max = sizetype->_hi - 1;
- const TypeLong* lidxtype = TypeLong::make(CONST64(0), index_max, Type::WidenMax);
- idx = _gvn.transform( new ConvI2LNode(idx, lidxtype) );
-#endif
+ idx = Compile::conv_I2X_index(&_gvn, idx, sizetype);
Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) );
return basic_plus_adr(ary, base, scale);
}
@@ -3759,7 +3744,8 @@ void GraphKit::final_sync(IdealKit& ideal) {
Node* GraphKit::byte_map_base_node() {
// Get base of card map
- CardTableModRefBS* ct = (CardTableModRefBS*)(Universe::heap()->barrier_set());
+ CardTableModRefBS* ct =
+ barrier_set_cast(Universe::heap()->barrier_set());
assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust users of this code");
if (ct->byte_map_base != NULL) {
return makecon(TypeRawPtr::make((address)ct->byte_map_base));
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index 3c909e7bfd4..e1fc843af61 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -30,6 +30,7 @@
#include "compiler/compileLog.hpp"
#include "oops/objArrayKlass.hpp"
#include "opto/addnode.hpp"
+#include "opto/arraycopynode.hpp"
#include "opto/callGenerator.hpp"
#include "opto/castnode.hpp"
#include "opto/cfgnode.hpp"
@@ -3867,26 +3868,65 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
- newcopy = new_array(klass_node, length, 0); // no arguments to push
-
// Generate a direct call to the right arraycopy function(s).
// We know the copy is disjoint but we might not know if the
// oop stores need checking.
// Extreme case: Arrays.copyOf((Integer[])x, 10, String[].class).
// This will fail a store-check if x contains any non-nulls.
- Node* alloc = tightly_coupled_allocation(newcopy, NULL);
+ // ArrayCopyNode:Ideal may transform the ArrayCopyNode to
+ // loads/stores but it is legal only if we're sure the
+ // Arrays.copyOf would succeed. So we need all input arguments
+ // to the copyOf to be validated, including that the copy to the
+ // new array won't trigger an ArrayStoreException. That subtype
+ // check can be optimized if we know something on the type of
+ // the input array from type speculation.
+ if (_gvn.type(klass_node)->singleton()) {
+ ciKlass* subk = _gvn.type(load_object_klass(original))->is_klassptr()->klass();
+ ciKlass* superk = _gvn.type(klass_node)->is_klassptr()->klass();
- ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, alloc != NULL,
+ int test = C->static_subtype_check(superk, subk);
+ if (test != Compile::SSC_always_true && test != Compile::SSC_always_false) {
+ const TypeOopPtr* t_original = _gvn.type(original)->is_oopptr();
+ if (t_original->speculative_type() != NULL) {
+ original = maybe_cast_profiled_obj(original, t_original->speculative_type(), true);
+ }
+ }
+ }
+
+ bool validated = false;
+ // Reason_class_check rather than Reason_intrinsic because we
+ // want to intrinsify even if this traps.
+ if (!too_many_traps(Deoptimization::Reason_class_check)) {
+ Node* not_subtype_ctrl = gen_subtype_check(load_object_klass(original),
+ klass_node);
+
+ if (not_subtype_ctrl != top()) {
+ PreserveJVMState pjvms(this);
+ set_control(not_subtype_ctrl);
+ uncommon_trap(Deoptimization::Reason_class_check,
+ Deoptimization::Action_make_not_entrant);
+ assert(stopped(), "Should be stopped");
+ }
+ validated = true;
+ }
+
+ newcopy = new_array(klass_node, length, 0); // no arguments to push
+
+ ArrayCopyNode* ac = ArrayCopyNode::make(this, true, original, start, newcopy, intcon(0), moved, true,
load_object_klass(original), klass_node);
if (!is_copyOfRange) {
- ac->set_copyof();
+ ac->set_copyof(validated);
} else {
- ac->set_copyofrange();
+ ac->set_copyofrange(validated);
}
Node* n = _gvn.transform(ac);
- assert(n == ac, "cannot disappear");
- ac->connect_outputs(this);
+ if (n == ac) {
+ ac->connect_outputs(this);
+ } else {
+ assert(validated, "shouldn't transform if all arguments not validated");
+ set_all_memory(n);
+ }
}
} // original reexecute is set back here
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
index f61e335a5c4..d0e31cf142c 100644
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
@@ -2032,7 +2032,7 @@ void PhaseIdealLoop::do_range_check( IdealLoopTree *loop, Node_List &old_new ) {
// Hopefully, compiler will optimize for powers of 2.
Node *ctrl = get_ctrl(main_limit);
Node *stride = cl->stride();
- Node *init = cl->init_trip();
+ Node *init = cl->init_trip()->uncast();
Node *span = new SubINode(main_limit,init);
register_new_node(span,ctrl);
Node *rndup = _igvn.intcon(stride_con + ((stride_con>0)?-1:1));
diff --git a/hotspot/src/share/vm/opto/macroArrayCopy.cpp b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
index 503bd44bbb6..d6f0caeb955 100644
--- a/hotspot/src/share/vm/opto/macroArrayCopy.cpp
+++ b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "opto/arraycopynode.hpp"
#include "oops/objArrayKlass.hpp"
#include "opto/convertnode.hpp"
#include "opto/graphKit.hpp"
@@ -519,7 +520,7 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode*
// Test S[] against D[], not S against D, because (probably)
// the secondary supertype cache is less busy for S[] than S.
// This usually only matters when D is an interface.
- Node* not_subtype_ctrl = ac->is_arraycopy_validated() ? top() :
+ Node* not_subtype_ctrl = (ac->is_arraycopy_validated() || ac->is_copyof_validated() || ac->is_copyofrange_validated()) ? top() :
Phase::gen_subtype_check(src_klass, dest_klass, ctrl, mem, &_igvn);
// Plug failing path into checked_oop_disjoint_arraycopy
if (not_subtype_ctrl != top()) {
diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp
index aa28426eaad..a6e95fe92c7 100644
--- a/hotspot/src/share/vm/opto/type.cpp
+++ b/hotspot/src/share/vm/opto/type.cpp
@@ -974,21 +974,10 @@ const Type *TypeF::xdual() const {
//------------------------------eq---------------------------------------------
// Structural equality check for Type representations
-bool TypeF::eq( const Type *t ) const {
- if( g_isnan(_f) ||
- g_isnan(t->getf()) ) {
- // One or both are NANs. If both are NANs return true, else false.
- return (g_isnan(_f) && g_isnan(t->getf()));
- }
- if (_f == t->getf()) {
- // (NaN is impossible at this point, since it is not equal even to itself)
- if (_f == 0.0) {
- // difference between positive and negative zero
- if (jint_cast(_f) != jint_cast(t->getf())) return false;
- }
- return true;
- }
- return false;
+bool TypeF::eq(const Type *t) const {
+ // Bitwise comparison to distinguish between +/-0. These values must be treated
+ // as different to be consistent with C1 and the interpreter.
+ return (jint_cast(_f) == jint_cast(t->getf()));
}
//------------------------------hash-------------------------------------------
@@ -1089,21 +1078,10 @@ const Type *TypeD::xdual() const {
//------------------------------eq---------------------------------------------
// Structural equality check for Type representations
-bool TypeD::eq( const Type *t ) const {
- if( g_isnan(_d) ||
- g_isnan(t->getd()) ) {
- // One or both are NANs. If both are NANs return true, else false.
- return (g_isnan(_d) && g_isnan(t->getd()));
- }
- if (_d == t->getd()) {
- // (NaN is impossible at this point, since it is not equal even to itself)
- if (_d == 0.0) {
- // difference between positive and negative zero
- if (jlong_cast(_d) != jlong_cast(t->getd())) return false;
- }
- return true;
- }
- return false;
+bool TypeD::eq(const Type *t) const {
+ // Bitwise comparison to distinguish between +/-0. These values must be treated
+ // as different to be consistent with C1 and the interpreter.
+ return (jlong_cast(_d) == jlong_cast(t->getd()));
}
//------------------------------hash-------------------------------------------
diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
index 50c38069e1a..b5e5f64806f 100644
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
@@ -782,9 +782,13 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
Method* idnum_owner = scratch_class->method_with_idnum(old_num);
if (idnum_owner != NULL) {
// There is already a method assigned this idnum -- switch them
+ // Take current and original idnum from the new_method
idnum_owner->set_method_idnum(new_num);
+ idnum_owner->set_orig_method_idnum(k_new_method->orig_method_idnum());
}
+ // Take current and original idnum from the old_method
k_new_method->set_method_idnum(old_num);
+ k_new_method->set_orig_method_idnum(k_old_method->orig_method_idnum());
if (thread->has_pending_exception()) {
return JVMTI_ERROR_OUT_OF_MEMORY;
}
@@ -817,9 +821,12 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions(
Method* idnum_owner = scratch_class->method_with_idnum(num);
if (idnum_owner != NULL) {
// There is already a method assigned this idnum -- switch them
+ // Take current and original idnum from the new_method
idnum_owner->set_method_idnum(new_num);
+ idnum_owner->set_orig_method_idnum(k_new_method->orig_method_idnum());
}
k_new_method->set_method_idnum(num);
+ k_new_method->set_orig_method_idnum(num);
if (thread->has_pending_exception()) {
return JVMTI_ERROR_OUT_OF_MEMORY;
}
@@ -3327,6 +3334,7 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
// This is a very busy routine. We don't want too much tracing
// printed out.
bool trace_name_printed = false;
+ InstanceKlass *the_class = InstanceKlass::cast(_the_class_oop);
// Very noisy: only enable this call if you are trying to determine
// that a specific class gets found by this routine.
@@ -3338,10 +3346,8 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
// If the class being redefined is java.lang.Object, we need to fix all
// array class vtables also
if (k->oop_is_array() && _the_class_oop == SystemDictionary::Object_klass()) {
- k->vtable()->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+ k->vtable()->adjust_method_entries(the_class, &trace_name_printed);
+
} else if (k->oop_is_instance()) {
HandleMark hm(_thread);
InstanceKlass *ik = InstanceKlass::cast(k);
@@ -3383,14 +3389,9 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
|| ik->is_subtype_of(_the_class_oop))) {
// ik->vtable() creates a wrapper object; rm cleans it up
ResourceMark rm(_thread);
- ik->vtable()->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
- ik->adjust_default_methods(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+
+ ik->vtable()->adjust_method_entries(the_class, &trace_name_printed);
+ ik->adjust_default_methods(the_class, &trace_name_printed);
}
// If the current class has an itable and we are either redefining an
@@ -3405,10 +3406,8 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
|| ik->is_subclass_of(_the_class_oop))) {
// ik->itable() creates a wrapper object; rm cleans it up
ResourceMark rm(_thread);
- ik->itable()->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+
+ ik->itable()->adjust_method_entries(the_class, &trace_name_printed);
}
// The constant pools in other classes (other_cp) can refer to
@@ -3432,10 +3431,7 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) {
other_cp = constantPoolHandle(ik->constants());
cp_cache = other_cp->cache();
if (cp_cache != NULL) {
- cp_cache->adjust_method_entries(_matching_old_methods,
- _matching_new_methods,
- _matching_methods_length,
- &trace_name_printed);
+ cp_cache->adjust_method_entries(the_class, &trace_name_printed);
}
}
@@ -3578,6 +3574,7 @@ int VM_RedefineClasses::check_methods_and_mark_as_obsolete() {
// obsolete methods need a unique idnum so they become new entries in
// the jmethodID cache in InstanceKlass
+ assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
if (num != ConstMethod::UNSET_IDNUM) {
old_method->set_method_idnum(num);
diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
index eb83161ca43..5ac9413e8d0 100644
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
@@ -289,7 +289,12 @@ bool AdvancedThresholdPolicy::should_not_inline(ciEnv* env, ciMethod* callee) {
// Create MDO if necessary.
void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) {
- if (mh->is_native() || mh->is_abstract() || mh->is_accessor()) return;
+ if (mh->is_native() ||
+ mh->is_abstract() ||
+ mh->is_accessor() ||
+ mh->is_constant_getter()) {
+ return;
+ }
if (mh->method_data() == NULL) {
Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
}
diff --git a/hotspot/src/share/vm/runtime/java.cpp b/hotspot/src/share/vm/runtime/java.cpp
index 52018be409e..0263a501d12 100644
--- a/hotspot/src/share/vm/runtime/java.cpp
+++ b/hotspot/src/share/vm/runtime/java.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -421,9 +421,11 @@ void before_exit(JavaThread * thread) {
os::infinite_sleep();
}
- // Terminate watcher thread - must before disenrolling any periodic task
- if (PeriodicTask::num_tasks() > 0)
+ // Stop the WatcherThread. We do this before disenrolling various
+ // PeriodicTasks to reduce the likelihood of races.
+ if (PeriodicTask::num_tasks() > 0) {
WatcherThread::stop();
+ }
// Print statistics gathered (profiling ...)
if (Arguments::has_profile()) {
diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp
index d2a9ff91f96..c059be04e9c 100644
--- a/hotspot/src/share/vm/runtime/sweeper.cpp
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp
@@ -724,6 +724,7 @@ void NMethodSweeper::possibly_flush(nmethod* nm) {
// state of the code cache if it's requested.
void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
if (PrintMethodFlushing) {
+ ResourceMark rm;
stringStream s;
// Dump code cache state into a buffer before locking the tty,
// because log_state() will use locks causing lock conflicts.
@@ -741,6 +742,7 @@ void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
}
if (LogCompilation && (xtty != NULL)) {
+ ResourceMark rm;
stringStream s;
// Dump code cache state into a buffer before locking the tty,
// because log_state() will use locks causing lock conflicts.
diff --git a/hotspot/src/share/vm/runtime/task.cpp b/hotspot/src/share/vm/runtime/task.cpp
index 0e6378c5548..de12a94b9ae 100644
--- a/hotspot/src/share/vm/runtime/task.cpp
+++ b/hotspot/src/share/vm/runtime/task.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@ void PeriodicTask::print_intervals() {
#endif
void PeriodicTask::real_time_tick(int delay_time) {
+ assert(Thread::current()->is_Watcher_thread(), "must be WatcherThread");
+
#ifndef PRODUCT
if (ProfilerCheckIntervals) {
_ticks++;
@@ -60,6 +62,8 @@ void PeriodicTask::real_time_tick(int delay_time) {
#endif
{
+ // The WatcherThread does not participate in the safepoint protocol
+ // for the PeriodicTask_lock because it is not a JavaThread.
MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
int orig_num_tasks = _num_tasks;
@@ -74,8 +78,7 @@ void PeriodicTask::real_time_tick(int delay_time) {
}
int PeriodicTask::time_to_wait() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
- NULL : PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+ assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
if (_num_tasks == 0) {
return 0; // sleep until shutdown or a task is enrolled
@@ -98,14 +101,19 @@ PeriodicTask::PeriodicTask(size_t interval_time) :
}
PeriodicTask::~PeriodicTask() {
+ // This PeriodicTask may have already been disenrolled by a call
+ // to disenroll() before the PeriodicTask was deleted.
disenroll();
}
-/* enroll could be called from a JavaThread, so we have to check for
- * safepoint when taking the lock to avoid deadlocking */
+// enroll the current PeriodicTask
void PeriodicTask::enroll() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
- NULL : PeriodicTask_lock);
+ // Follow normal safepoint aware lock enter protocol if the caller does
+ // not already own the PeriodicTask_lock. Otherwise, we don't try to
+ // enter it again because VM internal Mutexes do not support recursion.
+ //
+ MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
+ : PeriodicTask_lock);
if (_num_tasks == PeriodicTask::max_tasks) {
fatal("Overflow in PeriodicTask table");
@@ -113,18 +121,21 @@ void PeriodicTask::enroll() {
_tasks[_num_tasks++] = this;
WatcherThread* thread = WatcherThread::watcher_thread();
- if (thread) {
+ if (thread != NULL) {
thread->unpark();
} else {
WatcherThread::start();
}
}
-/* disenroll could be called from a JavaThread, so we have to check for
- * safepoint when taking the lock to avoid deadlocking */
+// disenroll the current PeriodicTask
void PeriodicTask::disenroll() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ?
- NULL : PeriodicTask_lock);
+ // Follow normal safepoint aware lock enter protocol if the caller does
+ // not already own the PeriodicTask_lock. Otherwise, we don't try to
+ // enter it again because VM internal Mutexes do not support recursion.
+ //
+ MutexLockerEx ml(PeriodicTask_lock->owned_by_self() ? NULL
+ : PeriodicTask_lock);
int index;
for(index = 0; index < _num_tasks && _tasks[index] != this; index++)
diff --git a/hotspot/src/share/vm/runtime/task.hpp b/hotspot/src/share/vm/runtime/task.hpp
index 5fc8c16e2a4..c7181089ee2 100644
--- a/hotspot/src/share/vm/runtime/task.hpp
+++ b/hotspot/src/share/vm/runtime/task.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@ class PeriodicTask: public CHeapObj {
static int _num_tasks;
static PeriodicTask* _tasks[PeriodicTask::max_tasks];
+ // Can only be called by the WatcherThread
static void real_time_tick(int delay_time);
#ifndef PRODUCT
@@ -98,6 +99,7 @@ class PeriodicTask: public CHeapObj {
// Calculate when the next periodic task will fire.
// Called by the WatcherThread's run method.
+ // Requires the PeriodicTask_lock.
static int time_to_wait();
// The task to perform at each period
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 00e5f804588..63d00e06aa6 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -1161,6 +1161,10 @@ void NamedThread::set_name(const char* format, ...) {
va_end(ap);
}
+void NamedThread::initialize_named_thread() {
+ set_native_thread_name(name());
+}
+
void NamedThread::print_on(outputStream* st) const {
st->print("\"%s\" ", name());
Thread::print_on(st);
@@ -1197,8 +1201,15 @@ WatcherThread::WatcherThread() : Thread(), _crash_protection(NULL) {
}
int WatcherThread::sleep() const {
+ // The WatcherThread does not participate in the safepoint protocol
+ // for the PeriodicTask_lock because it is not a JavaThread.
MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+ if (_should_terminate) {
+ // check for termination before we do any housekeeping or wait
+ return 0; // we did not sleep.
+ }
+
// remaining will be zero if there are no tasks,
// causing the WatcherThread to sleep until a task is
// enrolled
@@ -1211,8 +1222,9 @@ int WatcherThread::sleep() const {
jlong time_before_loop = os::javaTimeNanos();
- for (;;) {
- bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag, remaining);
+ while (true) {
+ bool timedout = PeriodicTask_lock->wait(Mutex::_no_safepoint_check_flag,
+ remaining);
jlong now = os::javaTimeNanos();
if (remaining == 0) {
@@ -1253,7 +1265,7 @@ void WatcherThread::run() {
this->initialize_thread_local_storage();
this->set_native_thread_name(this->name());
this->set_active_handles(JNIHandleBlock::allocate_block());
- while (!_should_terminate) {
+ while (true) {
assert(watcher_thread() == Thread::current(), "thread consistency check");
assert(watcher_thread() == this, "thread consistency check");
@@ -1289,6 +1301,11 @@ void WatcherThread::run() {
}
}
+ if (_should_terminate) {
+ // check for termination before posting the next tick
+ break;
+ }
+
PeriodicTask::real_time_tick(time_waited);
}
@@ -1319,27 +1336,19 @@ void WatcherThread::make_startable() {
}
void WatcherThread::stop() {
- // Get the PeriodicTask_lock if we can. If we cannot, then the
- // WatcherThread is using it and we don't want to block on that lock
- // here because that might cause a safepoint deadlock depending on
- // what the current WatcherThread tasks are doing.
- bool have_lock = PeriodicTask_lock->try_lock();
+ {
+ // Follow normal safepoint aware lock enter protocol since the
+ // WatcherThread is stopped by another JavaThread.
+ MutexLocker ml(PeriodicTask_lock);
+ _should_terminate = true;
- _should_terminate = true;
- OrderAccess::fence(); // ensure WatcherThread sees update in main loop
-
- if (have_lock) {
WatcherThread* watcher = watcher_thread();
if (watcher != NULL) {
- // If we managed to get the lock, then we should unpark the
- // WatcherThread so that it can see we want it to stop.
+ // unpark the WatcherThread so it can see that it should terminate
watcher->unpark();
}
-
- PeriodicTask_lock->unlock();
}
- // it is ok to take late safepoints here, if needed
MutexLocker mu(Terminator_lock);
while (watcher_thread() != NULL) {
@@ -1359,9 +1368,7 @@ void WatcherThread::stop() {
}
void WatcherThread::unpark() {
- MutexLockerEx ml(PeriodicTask_lock->owned_by_self()
- ? NULL
- : PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+ assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
PeriodicTask_lock->notify();
}
@@ -3558,8 +3565,8 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
}
{
- MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
- // Make sure the watcher thread can be started by WatcherThread::start()
+ MutexLocker ml(PeriodicTask_lock);
+ // Make sure the WatcherThread can be started by WatcherThread::start()
// or by dynamic enrollment.
WatcherThread::make_startable();
// Start up the WatcherThread if there are any periodic tasks
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index d49fdffc7b9..e3c22d48803 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -667,6 +667,7 @@ class NamedThread: public Thread {
~NamedThread();
// May only be called once per thread.
void set_name(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+ void initialize_named_thread();
virtual bool is_Named_thread() const { return true; }
virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
JavaThread *processed_thread() { return _processed_thread; }
@@ -701,7 +702,8 @@ class WatcherThread: public Thread {
static WatcherThread* _watcher_thread;
static bool _startable;
- volatile static bool _should_terminate; // updated without holding lock
+ // volatile due to at least one lock-free read
+ volatile static bool _should_terminate;
os::WatcherThreadCrashProtection* _crash_protection;
public:
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 4576976bdae..631e5308a08 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -487,7 +487,6 @@ typedef CompactHashtable SymbolCompactHashTable;
\
unchecked_nonstatic_field(ageTable, sizes, sizeof(ageTable::sizes)) \
\
- nonstatic_field(BarrierSet, _kind, BarrierSet::Name) \
nonstatic_field(BlockOffsetTable, _bottom, HeapWord*) \
nonstatic_field(BlockOffsetTable, _end, HeapWord*) \
\
diff --git a/hotspot/src/share/vm/runtime/vmThread.cpp b/hotspot/src/share/vm/runtime/vmThread.cpp
index c349c06c962..8e34fa48525 100644
--- a/hotspot/src/share/vm/runtime/vmThread.cpp
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp
@@ -243,7 +243,7 @@ void VMThread::run() {
assert(this == vm_thread(), "check");
this->initialize_thread_local_storage();
- this->set_native_thread_name(this->name());
+ this->initialize_named_thread();
this->record_stack_base_and_size();
// Notify_lock wait checks on active_handles() to rewait in
// case of spurious wakeup, it should wait on the last
diff --git a/hotspot/src/share/vm/shark/sharkBuilder.cpp b/hotspot/src/share/vm/shark/sharkBuilder.cpp
index 329a94aa83c..f02a0e2020f 100644
--- a/hotspot/src/share/vm/shark/sharkBuilder.cpp
+++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -446,7 +446,7 @@ void SharkBuilder::CreateUpdateBarrierSet(BarrierSet* bs, Value* field) {
CreateIntToPtr(
CreateAdd(
LLVMValue::intptr_constant(
- (intptr_t) ((CardTableModRefBS *) bs)->byte_map_base),
+ (intptr_t) (barrier_set_cast(bs)->byte_map_base)),
CreateLShr(
CreatePtrToInt(field, SharkType::intptr_type()),
LLVMValue::intptr_constant(CardTableModRefBS::card_shift))),
diff --git a/hotspot/src/share/vm/utilities/fakeRttiSupport.hpp b/hotspot/src/share/vm/utilities/fakeRttiSupport.hpp
new file mode 100644
index 00000000000..8c564004a91
--- /dev/null
+++ b/hotspot/src/share/vm/utilities/fakeRttiSupport.hpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_UTILITIES_FAKERTTISUPPORT_HPP
+#define SHARE_VM_UTILITIES_FAKERTTISUPPORT_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/debug.hpp"
+
+// Provides support for checked downcasts in a hierarchy of classes.
+// The base class provides a member of this type, specialized on that
+// base class and an associated tag type. Tags are small non-negative
+// integer values uniquely associated with distinct classes in the
+// hierarchy. A tag type is often an enum type.
+//
+// The concrete class specifies the concrete tag.
+//
+// The tag set specifies the set of classes in the derivation
+// sequence. Classes in the derivation sequence add their associated
+// tag during construction. Given the tag associated with a class, an
+// object is an instance of that class if the tag is included in the
+// object's set of recorded tags.
+//
+// A tag T is present in a tag set if the T'th bit of the tag set is
+// one.
+//
+// Note: The representation of a tag set being uintx sets an upper
+// bound on the size of a class hierarchy this utility can be used
+// with.
+template
+class FakeRttiSupport VALUE_OBJ_CLASS_SPEC {
+public:
+ // Construct with the indicated concrete tag, and include the
+ // concrete tag in the associated tag set.
+ explicit FakeRttiSupport(TagType concrete_tag) :
+ _tag_set(tag_bit(concrete_tag)), _concrete_tag(concrete_tag) { }
+
+ // Construct with the indicated concrete tag and tag set.
+ // Note: This constructor is public only to allow clients to set up
+ // "unusual" (or perhaps buggy) fake RTTI configurations.
+ FakeRttiSupport(TagType concrete_tag, uintx tag_set) :
+ _tag_set(tag_set), _concrete_tag(validate_tag(concrete_tag)) { }
+
+ // Get the concrete tag.
+ TagType concrete_tag() const { return _concrete_tag; }
+
+ // Test whether tag is in the tag set.
+ bool has_tag(TagType tag) const {
+ return (_tag_set & tag_bit(tag)) != 0;
+ }
+
+ // Return a new support object which is the same as this, except tag
+ // has been added to the tag set. The tag must not already be
+ // present in the tag set.
+ FakeRttiSupport add_tag(TagType tag) const {
+ uintx tbit = tag_bit(tag);
+ assert((_tag_set & tbit) == 0,
+ err_msg("Tag " UINTX_FORMAT " is already present in tag set: " UINTX_FORMAT,
+ (uintx)tag, _tag_set));
+ return FakeRttiSupport(_concrete_tag, _tag_set | tbit);
+ }
+
+private:
+ uintx _tag_set;
+ TagType _concrete_tag;
+
+ static uintx tag_bit(TagType tag) {
+ return ((uintx)1) << validate_tag(tag);
+ }
+
+ static TagType validate_tag(uintx tag) {
+ // Type of tag is not TagType to dodge useless MacOSX compiler warning.
+ assert(tag < (sizeof(uintx) * BitsPerByte),
+ err_msg("Tag " UINTX_FORMAT " is too large", tag));
+ return static_cast(tag);
+ }
+};
+
+#endif // include guard
diff --git a/hotspot/src/share/vm/utilities/workgroup.cpp b/hotspot/src/share/vm/utilities/workgroup.cpp
index 8e9fa51e096..3f20f36ce7e 100644
--- a/hotspot/src/share/vm/utilities/workgroup.cpp
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -247,6 +247,7 @@ void GangWorker::run() {
void GangWorker::initialize() {
this->initialize_thread_local_storage();
this->record_stack_base_and_size();
+ this->initialize_named_thread();
assert(_gang != NULL, "No gang to run in");
os::set_priority(this, NearMaxPriority);
if (TraceWorkGang) {
diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index b87440f6eb9..db2196ac778 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -114,7 +114,9 @@ needs_jre = \
compiler/c2/7047069/Test7047069.java \
runtime/6294277/SourceDebugExtension.java \
runtime/ClassFile/JsrRewriting.java \
- runtime/ClassFile/OomWhileParsingRepeatedJsr.java
+ runtime/ClassFile/OomWhileParsingRepeatedJsr.java \
+ runtime/SharedArchiveFile/LimitSharedSizes.java \
+ runtime/SharedArchiveFile/SpaceUtilizationCheck.java
# Compact 3 adds further tests to compact2
#
@@ -387,35 +389,7 @@ hotspot_compiler_3 = \
-compiler/runtime/6826736
hotspot_compiler_closed = \
- closed/compiler/c1/ \
- closed/compiler/c2/ \
- closed/compiler/codegen/ \
- closed/compiler/escapeAnalysis/ \
- closed/compiler/interpreter/ \
- closed/compiler/jsr292/ \
- closed/compiler/loopopts/ \
- closed/compiler/oracle/ \
- closed/compiler/runtime/ \
- closed/compiler/symantec/ \
- -closed/compiler/c1/4477197 \
- -closed/compiler/c1/5040872 \
- -closed/compiler/c1/6507107 \
- -closed/compiler/c2/4344895 \
- -closed/compiler/c2/4485006 \
- -closed/compiler/c2/4523683 \
- -closed/compiler/c2/4620290 \
- -closed/compiler/c2/4998314 \
- -closed/compiler/c2/6329104 \
- -closed/compiler/c2/6434117 \
- -closed/compiler/c2/6547163 \
- -closed/compiler/c2/6563987 \
- -closed/compiler/c2/6595044 \
- -closed/compiler/codegen/6440479 \
- -closed/compiler/codegen/6603011 \
- -closed/compiler/interpreter/5034475 \
- -closed/compiler/jsr292/LongLambdaFormDynamicStackDepth.java \
- -closed/compiler/loopopts/4463485 \
- -closed/compiler/loopopts/8021898
+ sanity/ExecuteInternalVMTests.java
hotspot_gc = \
sanity/ExecuteInternalVMTests.java \
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
new file mode 100644
index 00000000000..a6033337885
--- /dev/null
+++ b/hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8073792
+ * @summary assert broken when array size becomes known during igvn
+ * @run main/othervm -Xcomp -XX:CompileOnly=TestArrayCloneBadAssert.m TestArrayCloneBadAssert
+ *
+ */
+
+public class TestArrayCloneBadAssert {
+
+ static final int[] array = new int[5];
+
+ static int[] m(int[] arr) {
+ int i = 0;
+ for (; i < 2; i++) {
+ }
+ if (i == 2) {
+ arr = array;
+ }
+ return arr.clone();
+ }
+
+ static public void main(String[] args) {
+ int[] arr = new int[5];
+ m(arr);
+ }
+}
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java
new file mode 100644
index 00000000000..05549106f0c
--- /dev/null
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyAsLoadsStores.java
@@ -0,0 +1,617 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6912521
+ * @summary small array copy as loads/stores
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
+ * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestArrayCopyAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode -XX:TypeProfileLevel=200 TestArrayCopyAsLoadsStores
+ *
+ */
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+public class TestArrayCopyAsLoadsStores {
+
+ public enum ArraySrc {
+ SMALL,
+ LARGE,
+ ZERO
+ }
+
+ public enum ArrayDst {
+ NONE,
+ NEW,
+ SRC
+ }
+
+ static class A {
+ }
+
+ static class B extends A {
+ }
+
+ static final A[] small_a_src = new A[5];
+ static final A[] large_a_src = new A[10];
+ static final A[] zero_a_src = new A[0];
+ static final int[] small_int_src = new int[5];
+ static final int[] large_int_src = new int[10];
+ static final int[] zero_int_src = new int[0];
+ static final Object[] small_object_src = new Object[5];
+ static Object src;
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface Args {
+ ArraySrc src();
+ ArrayDst dst() default ArrayDst.NONE;
+ int[] extra_args() default {};
+ }
+
+ // array clone should be compiled as loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m1() throws CloneNotSupportedException {
+ return (A[])small_a_src.clone();
+ }
+
+ @Args(src=ArraySrc.SMALL)
+ static int[] m2() throws CloneNotSupportedException {
+ return (int[])small_int_src.clone();
+ }
+
+ // new array allocation should be optimized out
+ @Args(src=ArraySrc.SMALL)
+ static int m3() throws CloneNotSupportedException {
+ int[] array_clone = (int[])small_int_src.clone();
+ return array_clone[0] + array_clone[1] + array_clone[2] +
+ array_clone[3] + array_clone[4];
+ }
+
+ // should not be compiled as loads/stores
+ @Args(src=ArraySrc.LARGE)
+ static int[] m4() throws CloneNotSupportedException {
+ return (int[])large_int_src.clone();
+ }
+
+ // check that array of length 0 is handled correctly
+ @Args(src=ArraySrc.ZERO)
+ static int[] m5() throws CloneNotSupportedException {
+ return (int[])zero_int_src.clone();
+ }
+
+ // array copy should be compiled as loads/stores
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW)
+ static void m6(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 0, 5);
+ }
+
+ // array copy should not be compiled as loads/stores
+ @Args(src=ArraySrc.LARGE, dst=ArrayDst.NEW)
+ static void m7(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 0, 10);
+ }
+
+ // array copy should be compiled as loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m8(A[] src) {
+ src[0] = src[0]; // force null check
+ A[] dest = new A[5];
+ System.arraycopy(src, 0, dest, 0, 5);
+ return dest;
+ }
+
+ // array copy should not be compiled as loads/stores: we would
+ // need to emit GC barriers
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW)
+ static void m9(A[] src, A[] dest) {
+ System.arraycopy(src, 0, dest, 0, 5);
+ }
+
+ // overlapping array regions: copy backward
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC)
+ static void m10(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 1, 4);
+ }
+
+ static boolean m10_check(int[] src, int[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 5; i++) {
+ int j = Math.max(i - 1, 0);
+ if (dest[i] != src[j]) {
+ System.out.println("Test m10 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // overlapping array regions: copy forward
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC)
+ static void m11(int[] src, int[] dest) {
+ System.arraycopy(src, 1, dest, 0, 4);
+ }
+
+ static boolean m11_check(int[] src, int[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 5; i++) {
+ int j = Math.min(i + 1, 4);
+ if (dest[i] != src[j]) {
+ System.out.println("Test m11 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // overlapping array region with unknown src/dest offsets: compiled code must include both forward and backward copies
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC, extra_args={0,1})
+ static void m12(int[] src, int[] dest, int srcPos, int destPos) {
+ System.arraycopy(src, srcPos, dest, destPos, 4);
+ }
+
+ static boolean m12_check(int[] src, int[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 5; i++) {
+ int j = Math.max(i - 1, 0);
+ if (dest[i] != src[j]) {
+ System.out.println("Test m10 failed for " + i + " src[" + j +"]=" + src[j] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // Array allocation and copy should optimize out
+ @Args(src=ArraySrc.SMALL)
+ static int m13(int[] src) {
+ int[] dest = new int[5];
+ System.arraycopy(src, 0, dest, 0, 5);
+ return dest[0] + dest[1] + dest[2] + dest[3] + dest[4];
+ }
+
+ // Check that copy of length 0 is handled correctly
+ @Args(src=ArraySrc.ZERO, dst=ArrayDst.NEW)
+ static void m14(int[] src, int[] dest) {
+ System.arraycopy(src, 0, dest, 0, 0);
+ }
+
+ // copyOf should compile to loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m15() {
+ return Arrays.copyOf(small_a_src, 5, A[].class);
+ }
+
+ static Object[] helper16(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ // CopyOf may need subtype check
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static A[] m16(A[] unused_src, int i) {
+ Object[] arr = helper16(i);
+ return Arrays.copyOf(arr, 5, A[].class);
+ }
+
+ static Object[] helper17_1(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ static A[] helper17_2(Object[] arr) {
+ return Arrays.copyOf(arr, 5, A[].class);
+ }
+
+ // CopyOf may leverage type speculation
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static A[] m17(A[] unused_src, int i) {
+ Object[] arr = helper17_1(i);
+ return helper17_2(arr);
+ }
+
+ static Object[] helper18_1(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ static Object[] helper18_2(Object[] arr) {
+ return Arrays.copyOf(arr, 5, Object[].class);
+ }
+
+ // CopyOf should not attempt to use type speculation if it's not needed
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static Object[] m18(A[] unused_src, int i) {
+ Object[] arr = helper18_1(i);
+ return helper18_2(arr);
+ }
+
+ static Object[] helper19(int i) {
+ Object[] arr = null;
+ if ((i%2) == 0) {
+ arr = small_a_src;
+ } else {
+ arr = small_object_src;
+ }
+ return arr;
+ }
+
+ // CopyOf may need subtype check. Test is run to make type check
+ // fail and cause deoptimization. Next compilation should not
+ // compile as loads/stores because the first compilation
+ // deoptimized.
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NONE, extra_args={0})
+ static A[] m19(A[] unused_src, int i) {
+ Object[] arr = helper19(i);
+ return Arrays.copyOf(arr, 5, A[].class);
+ }
+
+ // copyOf for large array should not compile to loads/stores
+ @Args(src=ArraySrc.LARGE)
+ static A[] m20() {
+ return Arrays.copyOf(large_a_src, 10, A[].class);
+ }
+
+ // check zero length copyOf is handled correctly
+ @Args(src=ArraySrc.ZERO)
+ static A[] m21() {
+ return Arrays.copyOf(zero_a_src, 0, A[].class);
+ }
+
+ // Run with srcPos=0 for a 1st compile, then with incorrect value
+ // of srcPos to cause deoptimization, then with srcPos=0 for a 2nd
+ // compile. The 2nd compile shouldn't turn arraycopy into
+ // loads/stores because input arguments are no longer known to be
+ // valid.
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.NEW, extra_args={0})
+ static void m22(int[] src, int[] dest, int srcPos) {
+ System.arraycopy(src, srcPos, dest, 0, 5);
+ }
+
+ // copyOfRange should compile to loads/stores
+ @Args(src=ArraySrc.SMALL)
+ static A[] m23() {
+ return Arrays.copyOfRange(small_a_src, 1, 4, A[].class);
+ }
+
+ static boolean m23_check(A[] src, A[] dest) {
+ boolean failure = false;
+ for (int i = 0; i < 3; i++) {
+ if (src[i+1] != dest[i]) {
+ System.out.println("Test m23 failed for " + i + " src[" + (i+1) +"]=" + dest[i] + ", dest[" + i + "]=" + dest[i]);
+ failure = true;
+ }
+ }
+ return failure;
+ }
+
+ // array copy should be compiled as loads/stores. Invoke then with
+ // incompatible array type to verify we don't allow a forbidden
+ // arraycopy to happen.
+ @Args(src=ArraySrc.SMALL)
+ static A[] m24(Object[] src) {
+ src[0] = src[0]; // force null check
+ A[] dest = new A[5];
+ System.arraycopy(src, 0, dest, 0, 5);
+ return dest;
+ }
+
+ // overlapping array region with unknown src/dest offsets but
+ // length 1: compiled code doesn't need both forward and backward
+ // copies
+ @Args(src=ArraySrc.SMALL, dst=ArrayDst.SRC, extra_args={0,1})
+ static void m25(int[] src, int[] dest, int srcPos, int destPos) {
+ System.arraycopy(src, srcPos, dest, destPos, 1);
+ }
+
+ static boolean m25_check(int[] src, int[] dest) {
+ boolean failure = false;
+ if (dest[1] != src[0]) {
+ System.out.println("Test m10 failed for src[0]=" + src[0] + ", dest[1]=" + dest[1]);
+ return true;
+ }
+ return false;
+ }
+
+ final HashMap tests = new HashMap<>();
+ {
+ for (Method m : this.getClass().getDeclaredMethods()) {
+ if (m.getName().matches("m[0-9]+(_check)?")) {
+ assert(Modifier.isStatic(m.getModifiers())) : m;
+ tests.put(m.getName(), m);
+ }
+ }
+ }
+
+ boolean success = true;
+
+ void doTest(String name) throws Exception {
+ Method m = tests.get(name);
+ Method m_check = tests.get(name + "_check");
+ Class[] paramTypes = m.getParameterTypes();
+ Object[] params = new Object[paramTypes.length];
+ Class retType = m.getReturnType();
+ boolean isIntArray = (retType.isPrimitive() && !retType.equals(Void.TYPE)) ||
+ (retType.equals(Void.TYPE) && paramTypes[0].getComponentType().isPrimitive()) ||
+ (retType.isArray() && retType.getComponentType().isPrimitive());
+
+ Args args = m.getAnnotation(Args.class);
+
+ Object src = null;
+ switch(args.src()) {
+ case SMALL: {
+ if (isIntArray) {
+ src = small_int_src;
+ } else {
+ src = small_a_src;
+ }
+ break;
+ }
+ case LARGE: {
+ if (isIntArray) {
+ src = large_int_src;
+ } else {
+ src = large_a_src;
+ }
+ break;
+ }
+ case ZERO: {
+ if (isIntArray) {
+ src = zero_int_src;
+ } else {
+ src = zero_a_src;
+ }
+ break;
+ }
+ }
+
+ for (int i = 0; i < 20000; i++) {
+ boolean failure = false;
+
+ int p = 0;
+
+ if (params.length > 0) {
+ if (isIntArray) {
+ params[0] = ((int[])src).clone();
+ } else {
+ params[0] = ((A[])src).clone();
+ }
+ p++;
+ }
+
+ if (params.length > 1) {
+ switch(args.dst()) {
+ case NEW: {
+ if (isIntArray) {
+ params[1] = new int[((int[])params[0]).length];
+ } else {
+ params[1] = new A[((A[])params[0]).length];
+ }
+ p++;
+ break;
+ }
+ case SRC: {
+ params[1] = params[0];
+ p++;
+ break;
+ }
+ case NONE: break;
+ }
+ }
+
+ for (int j = 0; j < args.extra_args().length; j++) {
+ params[p+j] = args.extra_args()[j];
+ }
+
+ Object res = m.invoke(null, params);
+
+ if (retType.isPrimitive() && !retType.equals(Void.TYPE)) {
+ int s = (int)res;
+ int sum = 0;
+ int[] int_res = (int[])src;
+ for (int j = 0; j < int_res.length; j++) {
+ sum += int_res[j];
+ }
+ failure = (s != sum);
+ if (failure) {
+ System.out.println("Test " + name + " failed: result = " + s + " != " + sum);
+ }
+ } else {
+ Object dest = null;
+ if (!retType.equals(Void.TYPE)) {
+ dest = res;
+ } else {
+ dest = params[1];
+ }
+
+ if (m_check != null) {
+ failure = (boolean)m_check.invoke(null, new Object[] { src, dest });
+ } else {
+ if (isIntArray) {
+ int[] int_res = (int[])src;
+ int[] int_dest = (int[])dest;
+ for (int j = 0; j < int_res.length; j++) {
+ if (int_res[j] != int_dest[j]) {
+ System.out.println("Test " + name + " failed for " + j + " src[" + j +"]=" + int_res[j] + ", dest[" + j + "]=" + int_dest[j]);
+ failure = true;
+ }
+ }
+ } else {
+ Object[] object_res = (Object[])src;
+ Object[] object_dest = (Object[])dest;
+ for (int j = 0; j < object_res.length; j++) {
+ if (object_res[j] != object_dest[j]) {
+ System.out.println("Test " + name + " failed for " + j + " src[" + j +"]=" + object_res[j] + ", dest[" + j + "]=" + object_dest[j]);
+ failure = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (failure) {
+ success = false;
+ break;
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ for (int i = 0; i < small_a_src.length; i++) {
+ small_a_src[i] = new A();
+ }
+
+ for (int i = 0; i < small_int_src.length; i++) {
+ small_int_src[i] = i;
+ }
+
+ for (int i = 0; i < large_int_src.length; i++) {
+ large_int_src[i] = i;
+ }
+
+ for (int i = 0; i < 5; i++) {
+ small_object_src[i] = new Object();
+ }
+
+ TestArrayCopyAsLoadsStores test = new TestArrayCopyAsLoadsStores();
+
+ test.doTest("m1");
+ test.doTest("m2");
+ test.doTest("m3");
+ test.doTest("m4");
+ test.doTest("m5");
+ test.doTest("m6");
+ test.doTest("m7");
+ test.doTest("m8");
+ test.doTest("m9");
+ test.doTest("m10");
+ test.doTest("m11");
+ test.doTest("m12");
+ test.doTest("m13");
+ test.doTest("m14");
+ test.doTest("m15");
+
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper16(i);
+ }
+
+ test.doTest("m16");
+
+ // load class B so type check in m17 would not be simple comparison
+ B b = new B();
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper17_1(i);
+ }
+
+ test.doTest("m17");
+
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper18_1(i);
+ }
+ test.doTest("m18");
+
+ // make both branches of the If appear taken
+ for (int i = 0; i < 20000; i++) {
+ helper19(i);
+ }
+
+ // Compile
+ for (int i = 0; i < 20000; i++) {
+ m19(null, 0);
+ }
+
+ // force deopt
+ boolean m19_exception = false;
+ for (int i = 0; i < 10; i++) {
+ try {
+ m19(null, 1);
+ } catch(ArrayStoreException ase) {
+ m19_exception = true;
+ }
+ }
+
+ if (!m19_exception) {
+ System.out.println("Test m19: exception wasn't thrown");
+ test.success = false;
+ }
+
+ test.doTest("m19");
+
+ test.doTest("m20");
+ test.doTest("m21");
+
+ // Compile
+ int[] dst = new int[small_int_src.length];
+ for (int i = 0; i < 20000; i++) {
+ m22(small_int_src, dst, 0);
+ }
+
+ // force deopt
+ for (int i = 0; i < 10; i++) {
+ try {
+ m22(small_int_src, dst, 5);
+ } catch(ArrayIndexOutOfBoundsException aioobe) {}
+ }
+
+ test.doTest("m22");
+ test.doTest("m23");
+
+ test.doTest("m24");
+ boolean m24_exception = false;
+ try {
+ m24(small_object_src);
+ } catch(ArrayStoreException ase) {
+ m24_exception = true;
+ }
+
+ if (!m24_exception) {
+ System.out.println("Test m24: exception wasn't thrown");
+ test.success = false;
+ }
+
+ test.doTest("m25");
+
+ if (!test.success) {
+ throw new RuntimeException("some tests failed");
+ }
+ }
+}
diff --git a/hotspot/test/compiler/c2/FloatingPointFoldingTest.java b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
new file mode 100644
index 00000000000..cb3ce01c96b
--- /dev/null
+++ b/hotspot/test/compiler/c2/FloatingPointFoldingTest.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8073670
+ * @summary Test that causes C2 to fold two NaNs with different values into a single NaN.
+ * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_nan -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_nan FloatingPointFoldingTest
+ */
+
+public class FloatingPointFoldingTest {
+ // Double values.
+ public static final long MINUS_INF_LONGBITS = 0xfff0000000000000L;
+ public static final double DOUBLE_MINUS_INF = Double.longBitsToDouble(MINUS_INF_LONGBITS);
+
+ public static final long PLUS_INF_LONGBITS = 0x7ff0000000000000L;
+ public static final double DOUBLE_PLUS_INF = Double.longBitsToDouble(PLUS_INF_LONGBITS);
+
+ public static final long MINUS_ZERO_LONGBITS = 0x8000000000000000L;
+ public static final double DOUBLE_MINUS_ZERO = Double.longBitsToDouble(MINUS_ZERO_LONGBITS);
+
+ // We need two different NaN values. A floating point number is
+ // considered to be NaN is the sign bit is 0, all exponent bits
+ // are set to 1, and at least one bit of the exponent is not zero.
+ //
+ // As java.lang.Double.NaN is 0x7ff8000000000000L, we use
+ // 0x7ffc000000000000L as a second NaN double value.
+ public static final long NAN_LONGBITS = 0x7ffc000000000000L;
+ public static final double DOUBLE_NAN = Double.longBitsToDouble(NAN_LONGBITS);
+
+ // Float values.
+ public static final int MINUS_INF_INTBITS = 0xff800000;
+ public static final float FLOAT_MINUS_INF = Float.intBitsToFloat(MINUS_INF_INTBITS);
+
+ public static final int PLUS_INF_INTBITS = 0x7f800000;
+ public static final float FLOAT_PLUS_INF = Float.intBitsToFloat(PLUS_INF_INTBITS);
+
+ public static final int MINUS_ZERO_INTBITS = 0x80000000;
+ public static final float FLOAT_MINUS_ZERO = Float.intBitsToFloat(MINUS_ZERO_INTBITS);
+
+ // As java.lang.Float.NaN is 0x7fc00000, we use 0x7fe00000
+ // as a second NaN float value.
+ public static final int NAN_INTBITS = 0x7fe00000;
+ public static final float FLOAT_NAN = Float.intBitsToFloat(NAN_INTBITS);
+
+
+ // Double tests.
+ static void test_double_inf(long[] result) {
+ double d1 = DOUBLE_MINUS_INF;
+ double d2 = DOUBLE_PLUS_INF;
+ result[0] = Double.doubleToRawLongBits(d1);
+ result[1] = Double.doubleToRawLongBits(d2);
+ }
+
+ static void test_double_zero(long[] result) {
+ double d1 = DOUBLE_MINUS_ZERO;
+ double d2 = 0;
+ result[0] = Double.doubleToRawLongBits(d1);
+ result[1] = Double.doubleToRawLongBits(d2);
+ }
+
+ static void test_double_nan(long[] result) {
+ double d1 = DOUBLE_NAN;
+ double d2 = Double.NaN;
+ result[0] = Double.doubleToRawLongBits(d1);
+ result[1] = Double.doubleToRawLongBits(d2);
+ }
+
+ // Float tests.
+ static void test_float_inf(int[] result) {
+ float f1 = FLOAT_MINUS_INF;
+ float f2 = FLOAT_PLUS_INF;
+ result[0] = Float.floatToRawIntBits(f1);
+ result[1] = Float.floatToRawIntBits(f2);
+ }
+
+ static void test_float_zero(int[] result) {
+ float f1 = FLOAT_MINUS_ZERO;
+ float f2 = 0;
+ result[0] = Float.floatToRawIntBits(f1);
+ result[1] = Float.floatToRawIntBits(f2);
+ }
+
+ static void test_float_nan(int[] result) {
+ float f1 = FLOAT_NAN;
+ float f2 = Float.NaN;
+ result[0] = Float.floatToRawIntBits(f1);
+ result[1] = Float.floatToRawIntBits(f2);
+ }
+
+ // Check doubles.
+ static void check_double(long[] result, double d1, double d2) {
+ if (result[0] == result[1]) {
+ throw new RuntimeException("ERROR: Two different double values are considered equal. \n"
+ + String.format("\toriginal values: 0x%x 0x%x\n", Double.doubleToRawLongBits(d1), Double.doubleToRawLongBits(d2))
+ + String.format("\tvalues after execution of method test(): 0x%x 0x%x", result[0], result[1]));
+ }
+ }
+
+ // Check floats.
+ static void check_float(int[] result, float f1, float f2) {
+ if (result[0] == result[1]) {
+ throw new RuntimeException("ERROR: Two different float values are considered equal. \n"
+ + String.format("\toriginal values: 0x%x 0x%x\n", Float.floatToRawIntBits(f1), Float.floatToRawIntBits(f2))
+ + String.format("\tvalues after execution of method test(): 0x%x 0x%x", result[0], result[1]));
+ }
+ }
+
+ public static void main(String[] args) {
+ // Float tests.
+
+ int[] iresult = new int[2];
+
+ // -Inf and +Inf.
+ test_float_inf(iresult);
+ check_float(iresult, FLOAT_MINUS_INF, FLOAT_PLUS_INF);
+
+ // 0 and -0.
+ test_float_zero(iresult);
+ check_float(iresult, FLOAT_MINUS_ZERO, 0);
+
+ // Diferrent NaNs.
+ test_float_nan(iresult);
+ check_float(iresult, FLOAT_NAN, Float.NaN);
+
+ // Double tests.
+
+ long[] lresult = new long[2];
+
+ // -Inf and +Inf.
+ test_double_inf(lresult);
+ check_double(lresult, DOUBLE_MINUS_INF, DOUBLE_PLUS_INF);
+
+ // 0 and -0.
+ test_double_zero(lresult);
+ check_double(lresult, DOUBLE_MINUS_ZERO, 0);
+
+ // Diferrent NaNs.
+ test_double_nan(lresult);
+ check_double(lresult, DOUBLE_NAN, Double.NaN);
+ }
+}
diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
index e70f62aa4dd..276ba90bd63 100644
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java
@@ -51,7 +51,9 @@ public class UsageThresholdIncreasedTest {
public static void main(String[] args) {
for (BlobType btype : BlobType.getAvailable()) {
- new UsageThresholdIncreasedTest(btype).runTest();
+ if (CodeCacheUtils.isCodeHeapPredictable(btype)) {
+ new UsageThresholdIncreasedTest(btype).runTest();
+ }
}
}
diff --git a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
new file mode 100644
index 00000000000..7eac5e00660
--- /dev/null
+++ b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8073956
+ * @summary Tests C2 EA with allocated object escaping through a call.
+ * @run main/othervm -XX:CompileCommand=dontinline,TestEscapeThroughInvoke::create TestEscapeThroughInvoke
+ */
+public class TestEscapeThroughInvoke {
+ private A a;
+
+ public static void main(String[] args) {
+ TestEscapeThroughInvoke test = new TestEscapeThroughInvoke();
+ test.a = new A(42);
+ // Make sure run gets compiled by C2
+ for (int i = 0; i < 100_000; ++i) {
+ test.run();
+ }
+ }
+
+ private void run() {
+ // Allocate something to trigger EA
+ new Object();
+ // Create a new escaping instance of A and
+ // verify that it is always equal to 'a.saved'.
+ A escapingA = create(42);
+ a.check(escapingA);
+ }
+
+ // Create and return a new instance of A that escaped through 'A::saveInto'.
+ // The 'dummy' parameters are needed to avoid EA skipping the methods.
+ private A create(Integer dummy) {
+ A result = new A(dummy);
+ result.saveInto(a, dummy); // result escapes into 'a' here
+ return result;
+ }
+}
+
+class A {
+ private A saved;
+
+ public A(Integer dummy) { }
+
+ public void saveInto(A other, Integer dummy) {
+ other.saved = this;
+ }
+
+ public void check(A other) {
+ if (this.saved != other) {
+ throw new RuntimeException("TEST FAILED: Objects not equal.");
+ }
+ }
+}
diff --git a/hotspot/test/compiler/loopopts/CountedLoopProblem.java b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
index da206cb86d3..23cc0bb39e6 100644
--- a/hotspot/test/compiler/loopopts/CountedLoopProblem.java
+++ b/hotspot/test/compiler/loopopts/CountedLoopProblem.java
@@ -36,18 +36,22 @@ public class CountedLoopProblem {
public static void main(String[] args) throws Exception {
Random r = new Random(42);
int x = 0;
- StringBuilder sb = new StringBuilder();
- for(int i = 0; i < 1000000; ++i) {
- int v = Math.abs(r.nextInt());
- sb.append('+').append(v).append('\n');
- x += v;
- // To trigger the problem we must OSR in the following loop
- // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
- while(x < 0) x += 1000000000;
- sb.append('=').append(x).append('\n');
- }
- if (sb.toString().hashCode() != 0xaba94591) {
- throw new Exception("Unexpected result");
+ try {
+ StringBuilder sb = new StringBuilder();
+ for(int i = 0; i < 1000000; ++i) {
+ int v = Math.abs(r.nextInt());
+ sb.append('+').append(v).append('\n');
+ x += v;
+ // To trigger the problem we must OSR in the following loop
+ // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
+ while(x < 0) x += 1000000000;
+ sb.append('=').append(x).append('\n');
+ }
+ if (sb.toString().hashCode() != 0xaba94591) {
+ throw new Exception("Unexpected result");
+ }
+ } catch(OutOfMemoryError e) {
+ // small heap, ignore
}
}
}
diff --git a/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
new file mode 100644
index 00000000000..c9c985ab4ac
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8073184
+ * @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-LoopLimitCheck -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp TestCastIINoLoopLimitCheck
+ *
+ */
+
+public class TestCastIINoLoopLimitCheck {
+
+ static void m(int i, int index, char[] buf) {
+ while (i >= 65536) {
+ i = i / 100;
+ buf [--index] = 0;
+ buf [--index] = 1;
+ }
+ }
+
+ static public void main(String[] args) {
+ m(0, 0, null);
+ }
+}
diff --git a/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java
new file mode 100644
index 00000000000..ca57139c3a2
--- /dev/null
+++ b/hotspot/test/compiler/print/TestProfileReturnTypePrinting.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8073154
+ * @build TestProfileReturnTypePrinting
+ * @run main/othervm -XX:TypeProfileLevel=020
+ * -XX:CompileOnly=TestProfileReturnTypePrinting.testMethod
+ * -XX:+IgnoreUnrecognizedVMOptions -XX:+PrintLIR
+ * TestProfileReturnTypePrinting
+ * @summary Verify that c1's LIR that contains ProfileType node could be dumped
+ * without a crash disregard to an exact class knowledge.
+ */
+public class TestProfileReturnTypePrinting {
+ private static final int ITERATIONS = 1_000_000;
+
+ public static void main(String args[]) {
+ for (int i = 0; i < ITERATIONS; i++) {
+ TestProfileReturnTypePrinting.testMethod(i);
+ }
+ }
+
+ private static int testMethod(int i) {
+ return TestProfileReturnTypePrinting.foo().hashCode()
+ + TestProfileReturnTypePrinting.bar(i).hashCode();
+ }
+
+ /* Exact class of returned value is known statically. */
+ private static B foo() {
+ return new B();
+ }
+
+ /* Exact class of returned value is not known statically. */
+ private static Object bar(int i) {
+ if (i % 2 == 0) {
+ return new A();
+ } else {
+ return new B();
+ }
+ }
+
+ private static class A {
+ }
+
+ private static class B extends A {
+ }
+}
diff --git a/hotspot/test/compiler/tiered/LevelTransitionTest.java b/hotspot/test/compiler/tiered/LevelTransitionTest.java
index 79d3626b9de..852060975b1 100644
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java
@@ -29,6 +29,7 @@ import java.util.concurrent.Callable;
/**
* @test LevelTransitionTest
* @library /testlibrary /../../test/lib /compiler/whitebox
+ * @ignore 8067651
* @build TransitionsTestExecutor LevelTransitionTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java
index abe6ed37f98..3b05574ac0d 100644
--- a/hotspot/test/gc/TestSmallHeap.java
+++ b/hotspot/test/gc/TestSmallHeap.java
@@ -26,6 +26,7 @@
* @bug 8067438
* @requires vm.gc=="null"
* @requires (vm.opt.AggressiveOpts=="null") | (vm.opt.AggressiveOpts=="false")
+ * @requires vm.compMode != "Xcomp"
* @summary Verify that starting the VM with a small heap works
* @library /testlibrary /../../test/lib
* @build TestSmallHeap
diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
index 3232b27a450..abf6f80e369 100644
--- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
* @key gc
* @summary Tests that all SoftReferences has been cleared at time of OOM.
* @library /testlibrary
+ * @ignore 8073669
* @build TestSoftReferencesBehaviorOnOOME
* @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
* @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java
index 01efb5f1119..f9f6434d143 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java
@@ -47,6 +47,7 @@ public class AssertSafepointCheckConsistency1 {
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency1",
"test");
@@ -55,5 +56,3 @@ public class AssertSafepointCheckConsistency1 {
}
}
}
-
-
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java
index 16f776f737f..c6df9d7045e 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java
@@ -47,6 +47,7 @@ public class AssertSafepointCheckConsistency2 {
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency2",
"test");
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java
index aa89c09edc3..a3c79e2f4cf 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java
@@ -47,6 +47,7 @@ public class AssertSafepointCheckConsistency3 {
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency3",
"test");
diff --git a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java
index f6b89143001..79096ebe2f9 100644
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java
@@ -47,6 +47,7 @@ public class AssertSafepointCheckConsistency4 {
"-XX:+UnlockDiagnosticVMOptions",
"-XX:+WhiteBoxAPI",
"-XX:-TransmitErrorReport",
+ "-XX:-CreateMinidumpOnCrash",
"-Xmx32m",
"AssertSafepointCheckConsistency4",
"test");
diff --git a/hotspot/test/runtime/Thread/Fibonacci.java b/hotspot/test/runtime/Thread/Fibonacci.java
new file mode 100644
index 00000000000..94d38bea147
--- /dev/null
+++ b/hotspot/test/runtime/Thread/Fibonacci.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Calculates Fibonacci numbers "recursively" via threads and compares
+ * the result with the classical calculation.
+ * This test is skipped on 32-bit Windows: limited virtual space on Win-32
+ * make this test inherently unstable on Windows with 32-bit VM data model.
+ * @requires !(os.family == "windows" & sun.arch.data.model == "32")
+ * @library /testlibrary
+ * @run main Fibonacci 15
+ */
+
+import com.oracle.java.testlibrary.Asserts;
+
+public class Fibonacci extends Thread {
+ private int index;
+ private int value;
+ private Fibonacci left;
+ private Fibonacci right;
+
+ public Fibonacci(int i) {
+ index = i;
+ }
+
+ private int getValue() {
+ return value;
+ }
+
+ @Override
+ public void run() {
+ if (index == 0 || index == 1) {
+ // base cases, 0 Fibonacci number = 0, 1 Fibonacci number = 1
+ value = index;
+ } else {
+ // inductive cases
+ left = new Fibonacci(index - 2);
+ right = new Fibonacci(index - 1);
+ left.start();
+ right.start();
+ try {
+ left.join();
+ right.join();
+ } catch (InterruptedException e) {
+ throw new Error("InterruptedException for index " + index, e);
+ }
+ // compute and terminate
+ value = left.getValue() + right.getValue();
+ }
+ }
+
+ public static int traditionalFibonacci(int n) {
+ int n1 = 0, n2 = 1, nn = 0;
+
+ if (n == 0 || n == 1) {
+ nn = n;
+ }
+
+ for (int i = 1; i < n; ++i) {
+ nn = n2 + n1;
+ n1 = n2;
+ n2 = nn;
+ }
+ return nn;
+ }
+
+ public static void main(String[] args) throws Error,AssertionError {
+ int expected;
+ int number;
+ Fibonacci recursiveFibonacci;
+
+ if (args.length != 1) {
+ throw new Error("Error: args.length must be 1");
+ }
+
+ number = Integer.parseInt(args[0]);
+ recursiveFibonacci = new Fibonacci(number);
+
+ recursiveFibonacci.start();
+ try {
+ recursiveFibonacci.join();
+ } catch (InterruptedException e) {
+ throw new Error("InterruptedException in main thread", e);
+ }
+
+ expected = traditionalFibonacci(number);
+
+ System.out.println("Fibonacci[" + number + "] = " + expected);
+
+ Asserts.assertEQ(recursiveFibonacci.getValue(), expected,
+ "Unexpected calculated value: " + recursiveFibonacci.getValue() + " expected " + expected );
+ }
+}
diff --git a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java
index eb90bc0ee8f..ec135bbc352 100644
--- a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java
+++ b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java
@@ -39,7 +39,7 @@ import com.oracle.java.testlibrary.dcmd.JMXExecutor;
* @library /testlibrary
* @build com.oracle.java.testlibrary.*
* @build com.oracle.java.testlibrary.dcmd.*
- * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog RunGCTest
+ * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog -XX:-ExplicitGCInvokesConcurrent RunGCTest
*/
public class RunGCTest {
public void run(CommandExecutor executor) {
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
index 12d09434d7b..b398ea1cbc8 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
package sun.hotspot.tools.ctw;
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
import java.io.*;
import java.nio.file.Files;
@@ -55,7 +55,7 @@ public class CompileTheWorld {
try {
try {
- if (ManagementFactoryHelper.getCompilationMXBean() == null) {
+ if (ManagementFactory.getCompilationMXBean() == null) {
throw new RuntimeException(
"CTW can not work in interpreted mode");
}
diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
index ea621cb7b39..4e98bd8582e 100644
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
package sun.hotspot.tools.ctw;
import com.sun.management.HotSpotDiagnosticMXBean;
-import sun.management.ManagementFactoryHelper;
+import java.lang.management.ManagementFactory;
import java.io.File;
import java.util.regex.Pattern;
@@ -160,7 +160,7 @@ public class Utils {
public static String getVMOption(String name) {
String result;
HotSpotDiagnosticMXBean diagnostic
- = ManagementFactoryHelper.getDiagnosticMXBean();
+ = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
result = diagnostic.getVMOption(name).getValue();
return result;
}
diff --git a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java
index ff00999e9b9..84103c301f0 100644
--- a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java
+++ b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java
@@ -58,7 +58,7 @@ public class RandomGeneratorTest {
}
jvmArgs.add(RandomRunner.class.getName());
String[] cmdLineArgs = jvmArgs.toArray(new String[jvmArgs.size()]);
- String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getOutput().trim();
+ String etalon = ProcessTools.executeTestJvm(cmdLineArgs).getStdout().trim();
seedOpt.verify(etalon, cmdLineArgs);
}
@@ -122,7 +122,7 @@ public class RandomGeneratorTest {
String lastLineOrig = getLastLine(orig);
String lastLine;
try {
- lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getOutput().trim());
+ lastLine = getLastLine(ProcessTools.executeTestJvm(cmdLine).getStdout().trim());
} catch (Throwable t) {
throw new Error("TESTBUG: Unexpedted exception during jvm execution.", t);
}
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 601dfcb142a..c4ae975ef76 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -296,3 +296,4 @@ e391de88e69b59d7c618387e3cf91032f6991ce9 jdk9-b47
7cb3674cbd8c06222851444285bb66b2952a2a5c jdk9-b51
57b26c883d54f45912bc3885ccad3c6b80960b1f jdk9-b52
d5b5a010a16688f188f5a9247ed873f5100b530c jdk9-b53
+542c0c855ad467624cbedf11bff08e44b86b068d jdk9-b54
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
index 4cb5800200d..cca303c5d66 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -247,9 +247,11 @@ public final class XMLConstants {
*
*
*
- * ${JAVA_HOME}/conf/jaxp.properties: This configuration file is in standard
- * {@link java.util.Properties} format. If the file exists and the system property is specified,
- * its value will be used to override the default of the property.
+ * jaxp.properties: This configuration file is in standard
+ * {@link java.util.Properties} format and typically located in the {@code conf}
+ * directory of the Java installation. If the file exists and the system
+ * property is specified, its value will be used to override the default
+ * of the property.
*
*
*
@@ -314,9 +316,11 @@ public final class XMLConstants {
*
*
*
- * ${JAVA_HOME}/conf/jaxp.properties: This configuration file is in standard
- * java.util.Properties format. If the file exists and the system property is specified,
- * its value will be used to override the default of the property.
+ * jaxp.properties: This configuration file is in standard
+ * {@link java.util.Properties} format and typically located in the {@code conf}
+ * directory of the Java installation. If the file exists and the system
+ * property is specified, its value will be used to override the default
+ * of the property.
*
* @since 1.7
*
@@ -380,9 +384,11 @@ public final class XMLConstants {
*
*
*
- * ${JAVA_HOME}/conf/jaxp.properties: This configuration file is in standard
- * java.util.Properties format. If the file exists and the system property is specified,
- * its value will be used to override the default of the property.
+ * jaxp.properties: This configuration file is in standard
+ * {@link java.util.Properties} format and typically located in the {@code conf}
+ * directory of the Java installation. If the file exists and the system
+ * property is specified, its value will be used to override the default
+ * of the property.
*
* @since 1.7
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
index de6050ac4e8..d3afb25888e 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,23 +32,34 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- *
Factory that creates new javax.xml.datatype Objects that map XML to/from Java Objects.
- *
- * A new instance of the DatatypeFactory is created through the {@link #newInstance()} method
- * that uses the following implementation resolution mechanisms to determine an implementation:
+ * Factory that creates new javax.xml.datatype Objects that map XML to/from Java Objects.
+ *
+ * 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:
+ *
*
* -
- * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "
javax.xml.datatype.DatatypeFactory",
+ * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "{@code javax.xml.datatype.DatatypeFactory}",
* exists, a class with the name of the property value is instantiated.
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*
* -
- * If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties}
Object.
- * The Properties Object is then queried for the property as documented in the prior step
- * and processed as documented in the prior step.
+ *
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
*
* -
- * Uses the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class, to attempt
+ *
+ * Use the service-provider loading facility, defined by the {@link java.util.ServiceLoader} class, to attempt
* to locate and load an implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
* the service-provider loading facility will use the {@linkplain
@@ -56,13 +67,14 @@ import java.util.regex.Pattern;
* to attempt to load the service. If the context class
* loader is null, the {@linkplain
* ClassLoader#getSystemClassLoader() system class loader} will be used.
- *
+ *
* In case of {@link java.util.ServiceConfigurationError service
- * configuration error} a {@link javax.xml.datatype.DatatypeConfigurationException}
+ * configuration error}, a {@link javax.xml.datatype.DatatypeConfigurationException}
* will be thrown.
*
* -
- * The final mechanism is to attempt to instantiate the
Class specified by
+ *
+ * The final mechanism is to attempt to instantiate the {@code Class} specified by
* {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}.
* Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*
@@ -79,7 +91,7 @@ public abstract class DatatypeFactory {
/**
* Default property name as defined in JSR 206: Java(TM) API for XML Processing (JAXP) 1.3.
*
- * Default value is javax.xml.datatype.DatatypeFactory.
+ * Default value is {@code javax.xml.datatype.DatatypeFactory}.
*/
public static final String DATATYPEFACTORY_PROPERTY =
// We use a String constant here, rather than calling
@@ -120,18 +132,18 @@ public abstract class DatatypeFactory {
/**
* Protected constructor to prevent instantiation outside of package.
*
- * Use {@link #newInstance()} to create a DatatypeFactory.
+ * Use {@link #newInstance()} to create a {@code DatatypeFactory}.
*/
protected DatatypeFactory() {
}
/**
- * Obtain a new instance of a DatatypeFactory.
+ * Obtain a new instance of a {@code DatatypeFactory}.
*
* The implementation resolution mechanisms are defined in this
* Class's documentation.
*
- * @return New instance of a DatatypeFactory
+ * @return New instance of a {@code DatatypeFactory}
*
* @throws DatatypeConfigurationException If the implementation is not
* available or cannot be instantiated.
@@ -149,12 +161,12 @@ public abstract class DatatypeFactory {
}
/**
- * Obtain a new instance of a DatatypeFactory from class name.
+ *
Obtain a new instance of a {@code DatatypeFactory} from class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
* should be loaded.
*
- * Once an application has obtained a reference to a DatatypeFactory
+ *
Once an application has obtained a reference to a {@code DatatypeFactory}
* it can use the factory to configure and obtain datatype instances.
*
*
@@ -168,12 +180,12 @@ public abstract class DatatypeFactory {
* java -Djaxp.debug=1 YourProgram ....
*
*
- * @param factoryClassName fully qualified factory class name that provides implementation of javax.xml.datatype.DatatypeFactory.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.datatype.DatatypeFactory}.
*
* @param classLoader ClassLoader used to load the factory class. If null
* current Thread's context classLoader is used to load the factory class.
*
- * @return New instance of a DatatypeFactory
+ * @return New instance of a {@code DatatypeFactory}
*
* @throws DatatypeConfigurationException if factoryClassName is null, or
* the factory class cannot be loaded, instantiated.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
index 62bd3bd27c0..c500869cd7f 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,31 +55,34 @@ public abstract class DocumentBuilderFactory {
/**
* Obtain a new instance of a
- * DocumentBuilderFactory. This static method creates
+ * {@code DocumentBuilderFactory}. This static method creates
* a new factory instance.
* This method uses the following ordered lookup procedure to determine
- * the DocumentBuilderFactory implementation class to
+ * the {@code DocumentBuilderFactory} implementation class to
* load:
+ *
*
* -
- * Use the
javax.xml.parsers.DocumentBuilderFactory system
+ * Use the {@code javax.xml.parsers.DocumentBuilderFactory} system
* property.
*
* -
- * Use the properties file "conf/jaxp.properties" in the JRE directory.
- * This configuration file is in standard
java.util.Properties
- * format and contains the fully qualified name of the
- * implementation class with the key being the system property defined
- * above.
- *
+ *
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
* The jaxp.properties file is read only once by the JAXP implementation
- * and it's values are then cached for future use. If the file does not exist
+ * and its values are then cached for future use. If the file does not exist
* when the first attempt is made to read from it, no further attempts are
* made to check for its existence. It is not possible to change the value
* of any property in jaxp.properties after it has been read for the first time.
*
* -
- * Uses the service-provider loading facilities, defined by the
+ *
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -90,26 +93,30 @@ public abstract class DocumentBuilderFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise, the system-default implementation is returned.
*
*
*
+ *
* Once an application has obtained a reference to a
- * DocumentBuilderFactory it can use the factory to
+ * {@code DocumentBuilderFactory} it can use the factory to
* configure and obtain parser instances.
*
*
*
Tip for Trouble-shooting
- * Setting the jaxp.debug system property will cause
+ *
+ * Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to System.err about what it is doing and where it is looking at.
+ * to {@code System.err} about what it is doing and where it is looking at.
*
- * If you have problems loading {@link DocumentBuilder}s, try:
+ *
+ * If you have problems loading {@link DocumentBuilder}s, try:
*
* java -Djaxp.debug=1 YourProgram ....
*
*
- * @return New instance of a DocumentBuilderFactory
+ * @return New instance of a {@code DocumentBuilderFactory}
*
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
@@ -124,31 +131,31 @@ public abstract class DocumentBuilderFactory {
}
/**
- * Obtain a new instance of a DocumentBuilderFactory from class name.
+ *
Obtain a new instance of a {@code DocumentBuilderFactory} from class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
- * should be loaded.
+ * should be loaded.
*
- * Once an application has obtained a reference to a DocumentBuilderFactory
- * it can use the factory to configure and obtain parser instances.
+ * Once an application has obtained a reference to a {@code DocumentBuilderFactory}
+ * it can use the factory to configure and obtain parser instances.
*
*
*
Tip for Trouble-shooting
- * Setting the jaxp.debug system property will cause
+ *
Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to System.err about what it is doing and where it is looking at.
+ * to {@code System.err} about what it is doing and where it is looking at.
*
* If you have problems try:
*
* java -Djaxp.debug=1 YourProgram ....
*
*
- * @param factoryClassName fully qualified factory class name that provides implementation of javax.xml.parsers.DocumentBuilderFactory.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.parsers.DocumentBuilderFactory}.
*
* @param classLoader ClassLoader used to load the factory class. If null
* current Thread's context classLoader is used to load the factory class.
*
- * @return New instance of a DocumentBuilderFactory
+ * @return New instance of a {@code DocumentBuilderFactory}
*
* @throws FactoryConfigurationError if factoryClassName is null, or
* the factory class cannot be loaded, instantiated.
@@ -406,14 +413,14 @@ public abstract class DocumentBuilderFactory {
throws IllegalArgumentException;
/**
- * Set a feature for this DocumentBuilderFactory and DocumentBuilders created by this factory.
+ * Set a feature for this {@code DocumentBuilderFactory} and DocumentBuilders created by this factory.
*
*
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * A {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory or the
+ * A {@link ParserConfigurationException} is thrown if this {@code DocumentBuilderFactory} or the
* DocumentBuilders it creates cannot support the feature.
- * It is possible for a DocumentBuilderFactory to expose a feature value but be unable to change its state.
+ * It is possible for a {@code DocumentBuilderFactory} to expose a feature value but be unable to change its state.
*
*
*
@@ -436,7 +443,7 @@ public abstract class DocumentBuilderFactory {
* @param name Feature name.
* @param value Is feature state true or false.
*
- * @throws ParserConfigurationException if this DocumentBuilderFactory or the DocumentBuilders
+ * @throws ParserConfigurationException if this {@code DocumentBuilderFactory} or the DocumentBuilders
* it creates cannot support this feature.
* @throws NullPointerException If the name parameter is null.
* @since 1.5
@@ -450,16 +457,16 @@ public abstract class DocumentBuilderFactory {
*
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * An {@link ParserConfigurationException} is thrown if this DocumentBuilderFactory or the
+ * An {@link ParserConfigurationException} is thrown if this {@code DocumentBuilderFactory} or the
* DocumentBuilders it creates cannot support the feature.
- * It is possible for an DocumentBuilderFactory to expose a feature value but be unable to change its state.
+ * It is possible for an {@code DocumentBuilderFactory} to expose a feature value but be unable to change its state.
*
*
* @param name Feature name.
*
* @return State of the named feature.
*
- * @throws ParserConfigurationException if this DocumentBuilderFactory
+ * @throws ParserConfigurationException if this {@code DocumentBuilderFactory}
* or the DocumentBuilders it creates cannot support this feature.
* @since 1.5
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
index f2e9120a02f..1160a62edf4 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,31 +59,34 @@ public abstract class SAXParserFactory {
}
/**
- * Obtain a new instance of a SAXParserFactory. This
+ * Obtain a new instance of a {@code SAXParserFactory}. This
* static method creates a new factory instance
* This method uses the following ordered lookup procedure to determine
- * the SAXParserFactory implementation class to
+ * the {@code SAXParserFactory} implementation class to
* load:
+ *
*
* -
- * Use the
javax.xml.parsers.SAXParserFactory system
+ * Use the {@code javax.xml.parsers.SAXParserFactory} system
* property.
*
* -
- * Use the properties file "conf/jaxp.properties" in the JRE directory.
- * This configuration file is in standard
java.util.Properties
- * format and contains the fully qualified name of the
- * implementation class with the key being the system property defined
- * above.
- *
+ *
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
* The jaxp.properties file is read only once by the JAXP implementation
- * and it's values are then cached for future use. If the file does not exist
+ * and its values are then cached for future use. If the file does not exist
* when the first attempt is made to read from it, no further attempts are
* made to check for its existence. It is not possible to change the value
* of any property in jaxp.properties after it has been read for the first time.
*
* -
- * Use the service-provider loading facilities, defined by the
+ *
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -94,22 +97,26 @@ public abstract class SAXParserFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise the system-default implementation is returned.
*
*
*
+ *
* Once an application has obtained a reference to a
- * SAXParserFactory it can use the factory to
+ * {@code SAXParserFactory} it can use the factory to
* configure and obtain parser instances.
*
*
*
*
Tip for Trouble-shooting
- * Setting the jaxp.debug system property will cause
+ *
+ * Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to System.err about what it is doing and where it is looking at.
+ * to {@code System.err} about what it is doing and where it is looking at.
*
- * If you have problems loading {@link SAXParser}s, try:
+ *
+ * If you have problems loading {@link SAXParser}s, try:
*
* java -Djaxp.debug=1 YourProgram ....
*
@@ -131,31 +138,32 @@ public abstract class SAXParserFactory {
}
/**
- * Obtain a new instance of a SAXParserFactory from class name.
+ *
Obtain a new instance of a {@code SAXParserFactory} from class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
* should be loaded.
*
- * Once an application has obtained a reference to a SAXParserFactory
+ *
Once an application has obtained a reference to a {@code SAXParserFactory}
* it can use the factory to configure and obtain parser instances.
*
*
* Tip for Trouble-shooting
- * Setting the jaxp.debug system property will cause
+ *
Setting the {@code jaxp.debug} system property will cause
* this method to print a lot of debug messages
- * to System.err about what it is doing and where it is looking at.
+ * to {@code System.err} about what it is doing and where it is looking at.
*
- * If you have problems, try:
+ *
+ * If you have problems, try:
*
* java -Djaxp.debug=1 YourProgram ....
*
*
- * @param factoryClassName fully qualified factory class name that provides implementation of javax.xml.parsers.SAXParserFactory.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.parsers.SAXParserFactory}.
*
* @param classLoader ClassLoader used to load the factory class. If null
* current Thread's context classLoader is used to load the factory class.
*
- * @return New instance of a SAXParserFactory
+ * @return New instance of a {@code SAXParserFactory}
*
* @throws FactoryConfigurationError if factoryClassName is null, or
* the factory class cannot be loaded, instantiated.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
index 548feeb272a..fc14bc620bc 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
@@ -23,7 +23,7 @@
*/
/*
- * Copyright (c) 2009, 2013, by Oracle Corporation. All Rights Reserved.
+ * Copyright (c) 2009, 2015, by Oracle Corporation. All Rights Reserved.
*/
package javax.xml.stream;
@@ -70,19 +70,34 @@ public abstract class XMLEventFactory {
* This static method creates a new factory instance.
* This method uses the following ordered lookup procedure to determine
* the XMLEventFactory implementation class to load:
- *
+ *
*
* -
* Use the javax.xml.stream.XMLEventFactory system property.
*
* -
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the system property defined above.
+ *
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ *
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ *
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
*
* -
- * Use the service-provider loading facilities, defined by the
+ *
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -93,18 +108,18 @@ public abstract class XMLEventFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise, the system-default implementation is returned.
*
*
*
* Once an application has obtained a reference to a XMLEventFactory it
* can use the factory to configure and obtain stream instances.
- *
*
* Note that this is a new method that replaces the deprecated newInstance() method.
* No changes in behavior are defined by this replacement method relative to
* the deprecated method.
- *
+ *
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
* the implementation is not available or cannot be instantiated.
@@ -143,20 +158,35 @@ public abstract class XMLEventFactory {
*
* This method uses the following ordered lookup procedure to determine
* the XMLEventFactory implementation class to load:
- *
+ *
*
* -
* Use the value of the system property identified by {@code factoryId}.
*
* -
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the given {@code factoryId}.
+ *
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * conf directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ *
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ *
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
*
* -
+ *
* If {@code factoryId} is "javax.xml.stream.XMLEventFactory",
- * use the service-provider loading facilities, defined by the
+ * use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to {@linkplain
* java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load}
* an implementation of the service using the specified {@code ClassLoader}.
@@ -169,6 +199,7 @@ public abstract class XMLEventFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise, throws a {@link FactoryConfigurationError}.
*
*
@@ -179,7 +210,6 @@ public abstract class XMLEventFactory {
* newInstance(String factoryId, ClassLoader classLoader)} method.
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
- *
*
* @apiNote The parameter factoryId defined here is inconsistent with that
* of other JAXP factories where the first parameter is fully qualified
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
index 20af7a052b2..90030378467 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
@@ -68,7 +68,7 @@ import javax.xml.transform.Source;
*
*
* @version 1.2
- * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+ * @author Copyright (c) 2009, 2015 by Oracle Corporation. All Rights Reserved.
* @see XMLOutputFactory
* @see XMLEventReader
* @see XMLStreamReader
@@ -163,16 +163,28 @@ public abstract class XMLInputFactory {
*
*
* -
- * Use the javax.xml.stream.XMLInputFactory system property.
+ *
Use the javax.xml.stream.XMLInputFactory system property.
*
* -
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the system property defined above.
+ *
Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ *
The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ *
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
*
* -
- * Use the service-provider loading facilities, defined by the
+ *
Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -183,7 +195,7 @@ public abstract class XMLInputFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
- * Otherwise, the system-default implementation is returned.
+ *
Otherwise, the system-default implementation is returned.
*
*
*
@@ -233,20 +245,36 @@ public abstract class XMLInputFactory {
*
* This method uses the following ordered lookup procedure to determine
* the XMLInputFactory implementation class to load:
- *
+ *
*
* -
+ *
* Use the value of the system property identified by {@code factoryId}.
*
* -
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the given {@code factoryId}.
+ *
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ *
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ *
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
*
* -
+ *
* If {@code factoryId} is "javax.xml.stream.XMLInputFactory",
- * use the service-provider loading facilities, defined by the
+ * use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to {@linkplain
* java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load}
* an implementation of the service using the specified {@code ClassLoader}.
@@ -259,6 +287,7 @@ public abstract class XMLInputFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise, throws a {@link FactoryConfigurationError}.
*
*
@@ -269,7 +298,7 @@ public abstract class XMLInputFactory {
* newInstance(String factoryId, ClassLoader classLoader)} method.
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
- *
+ *
*
* @apiNote The parameter factoryId defined here is inconsistent with that
* of other JAXP factories where the first parameter is fully qualified
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
index e875ac2c277..4524a4e8315 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
@@ -102,7 +102,7 @@ import javax.xml.transform.Result;
* namespace URI of the element or attribute using that prefix.
*
* @version 1.2
- * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
+ * @author Copyright (c) 2009, 2015 by Oracle Corporation. All Rights Reserved.
* @see XMLInputFactory
* @see XMLEventWriter
* @see XMLStreamWriter
@@ -136,19 +136,34 @@ public abstract class XMLOutputFactory {
* This static method creates a new factory instance. This method uses the
* following ordered lookup procedure to determine the XMLOutputFactory
* implementation class to load:
- *
+ *
*
* -
* Use the javax.xml.stream.XMLOutputFactory system property.
*
* -
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the system property defined above.
+ *
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ *
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ *
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
*
* -
- * Use the service-provider loading facilities, defined by the
+ *
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -159,17 +174,17 @@ public abstract class XMLOutputFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise, the system-default implementation is returned.
*
*
* Once an application has obtained a reference to a XMLOutputFactory it
* can use the factory to configure and obtain stream instances.
- *
*
* Note that this is a new method that replaces the deprecated newInstance() method.
* No changes in behavior are defined by this replacement method relative to the
* deprecated method.
- *
+ *
* @throws FactoryConfigurationError in case of {@linkplain
* java.util.ServiceConfigurationError service configuration error} or if
* the implementation is not available or cannot be instantiated.
@@ -207,20 +222,35 @@ public abstract class XMLOutputFactory {
*
* This method uses the following ordered lookup procedure to determine
* the XMLOutputFactory implementation class to load:
- *
+ *
*
* -
* Use the value of the system property identified by {@code factoryId}.
*
* -
- * Use the properties file "lib/stax.properties" in the JRE directory.
- * This configuration file is in standard java.util.Properties format
- * and contains the fully qualified name of the implementation class
- * with the key being the given {@code factoryId}.
+ *
+ * Use the configuration file "stax.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ *
+ * The stax.properties file is read only once by the implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in stax.properties after it has been read for the first time.
+ *
+ *
+ * Use the jaxp configuration file "jaxp.properties". The file is in the same
+ * format as stax.properties and will only be read if stax.properties does
+ * not exist.
*
* -
+ *
* If {@code factoryId} is "javax.xml.stream.XMLOutputFactory",
- * use the service-provider loading facilities, defined by the
+ * use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to {@linkplain
* java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader) locate and load}
* an implementation of the service using the specified {@code ClassLoader}.
@@ -233,6 +263,7 @@ public abstract class XMLOutputFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise, throws a {@link FactoryConfigurationError}.
*
*
@@ -246,7 +277,7 @@ public abstract class XMLOutputFactory {
* {@link #newInstance(java.lang.String, java.lang.ClassLoader)
* newInstance(String factoryId, ClassLoader classLoader)} method.
* The original method was incorrectly defined to return XMLInputFactory.
- *
+ *
*
* @param factoryId Name of the factory to find, same as
* a property name
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
index 846cda11048..2fd931df891 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@ package javax.xml.transform;
* The system property that determines which Factory implementation
* to create is named "javax.xml.transform.TransformerFactory".
* This property names a concrete subclass of the
- * TransformerFactory abstract class. If the property is not
+ * {@code TransformerFactory} abstract class. If the property is not
* defined, a platform default is be used.
*
* @author Jeff Suttor
@@ -51,31 +51,36 @@ public abstract class TransformerFactory {
/**
- * Obtain a new instance of a TransformerFactory.
- * This static method creates a new factory instance.
- * This method uses the following ordered lookup procedure to determine
- * the TransformerFactory implementation class to
- * load:
+ *
+ * Obtain a new instance of a {@code TransformerFactory}.
+ * This static method creates a new factory instance.
+ *
+ * This method uses the following ordered lookup procedure to determine
+ * the {@code TransformerFactory} implementation class to
+ * load:
+ *
*
* -
- * Use the
javax.xml.transform.TransformerFactory system
+ * Use the {@code javax.xml.transform.TransformerFactory} system
* property.
*
* -
- * Use the properties file "conf/jaxp.properties" in the JRE directory.
- * This configuration file is in standard
java.util.Properties
- * format and contains the fully qualified name of the
- * implementation class with the key being the system property defined
- * above.
- *
+ *
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * {@code conf} directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
* The jaxp.properties file is read only once by the JAXP implementation
- * and it's values are then cached for future use. If the file does not exist
+ * and its values are then cached for future use. If the file does not exist
* when the first attempt is made to read from it, no further attempts are
* made to check for its existence. It is not possible to change the value
* of any property in jaxp.properties after it has been read for the first time.
*
* -
- * Use the service-provider loading facilities, defined by the
+ *
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -86,13 +91,15 @@ public abstract class TransformerFactory {
* ClassLoader#getSystemClassLoader() system class loader} will be used.
*
* -
+ *
* Otherwise, the system-default implementation is returned.
*
*
*
- * Once an application has obtained a reference to a
- * TransformerFactory it can use the factory to configure
- * and obtain transformer instances.
+ *
+ * Once an application has obtained a reference to a
+ * {@code TransformerFactory} it can use the factory to configure
+ * and obtain transformer instances.
*
* @return new TransformerFactory instance, never null.
*
@@ -111,13 +118,13 @@ public abstract class TransformerFactory {
}
/**
- *
Obtain a new instance of a TransformerFactory from factory class name.
+ *
Obtain a new instance of a {@code TransformerFactory} from factory class name.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
* should be loaded.
*
- * Once an application has obtained a reference to a
- * TransformerFactory it can use the factory to configure
+ *
Once an application has obtained a reference to a
+ * {@code TransformerFactory} it can use the factory to configure
* and obtain transformer instances.
*
* Tip for Trouble-shooting
@@ -130,7 +137,7 @@ public abstract class TransformerFactory {
* java -Djaxp.debug=1 YourProgram ....
*
*
- * @param factoryClassName fully qualified factory class name that provides implementation of javax.xml.transform.TransformerFactory.
+ * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.transform.TransformerFactory}.
*
* @param classLoader ClassLoader used to load the factory class. If null
* current Thread's context classLoader is used to load the factory class.
@@ -232,7 +239,7 @@ public abstract class TransformerFactory {
* @param charset The value of the charset attribute to match. May be null.
*
* @return A Source Object suitable for passing
- * to the TransformerFactory.
+ * to the {@code TransformerFactory}.
*
* @throws TransformerConfigurationException An Exception
* is thrown if an error occurings during parsing of the
@@ -268,15 +275,15 @@ public abstract class TransformerFactory {
//======= CONFIGURATION METHODS =======
/**
- * Set a feature for this TransformerFactory and Transformers
+ *
Set a feature for this {@code TransformerFactory} and Transformers
* or Templates created by this factory.
*
*
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * An {@link TransformerConfigurationException} is thrown if this TransformerFactory or the
+ * An {@link TransformerConfigurationException} is thrown if this {@code TransformerFactory} or the
* Transformers or Templates it creates cannot support the feature.
- * It is possible for an TransformerFactory to expose a feature value but be unable to change its state.
+ * It is possible for an {@code TransformerFactory} to expose a feature value but be unable to change its state.
*
*
* All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
@@ -299,7 +306,7 @@ public abstract class TransformerFactory {
* @param name Feature name.
* @param value Is feature state true or false.
*
- * @throws TransformerConfigurationException if this TransformerFactory
+ * @throws TransformerConfigurationException if this {@code TransformerFactory}
* or the Transformers or Templates it creates cannot support this feature.
* @throws NullPointerException If the name parameter is null.
*/
@@ -312,9 +319,9 @@ public abstract class TransformerFactory {
*
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
- * false is returned if this TransformerFactory or the
+ * false is returned if this {@code TransformerFactory} or the
* Transformers or Templates it creates cannot support the feature.
- * It is possible for an TransformerFactory to expose a feature value but be unable to change its state.
+ * It is possible for an {@code TransformerFactory} to expose a feature value but be unable to change its state.
*
*
* @param name Feature name.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
index 527c6c73a02..ad7e61f9a7f 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -132,8 +132,9 @@ public abstract class SchemaFactory {
* where "the class loader" refers to the context class loader:
*
* -
+ *
* If the system property
- * "javax.xml.validation.SchemaFactory:schemaLanguage"
+ * {@code "javax.xml.validation.SchemaFactory:schemaLanguage"}
* is present (where schemaLanguage is the parameter
* to this method), then its value is read
* as a class name. The method will try to
@@ -141,12 +142,22 @@ public abstract class SchemaFactory {
* and returns it if it is successfully created.
*
* -
- *
$java.home/conf/jaxp.properties is read and
- * the value associated with the key being the system property above
- * is looked for. If present, the value is processed just like above.
+ *
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * conf directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
*
* -
- * Use the service-provider loading facilities, defined by the
+ *
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -166,19 +177,20 @@ public abstract class SchemaFactory {
* {@link SchemaFactoryConfigurationError} will be thrown.
*
* -
+ *
* Platform default SchemaFactory is located
* in a implementation specific way. There must be a platform default
* SchemaFactory for W3C XML Schema.
*
*
*
- * If everything fails, {@link IllegalArgumentException} will be thrown.
+ * If everything fails, {@link IllegalArgumentException} will be thrown.
*
- *
Tip for Trouble-shooting:
+ * Tip for Trouble-shooting:
*
See {@link java.util.Properties#load(java.io.InputStream)} for
* exactly how a property file is parsed. In particular, colons ':'
* need to be escaped in a property file, so make sure schema language
- * URIs are properly escaped in it. For example:
+ * URIs are properly escaped in it. For example:
*
* http\://www.w3.org/2001/XMLSchema=org.acme.foo.XSSchemaFactory
*
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
index ea7370e06e7..05f7a4e52c0 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package javax.xml.xpath;
/**
- * An XPathFactory instance can be used to create
+ *
An {@code XPathFactory} instance can be used to create
* {@link javax.xml.xpath.XPath} objects.
*
*See {@link #newInstance(String uri)} for lookup mechanism.
@@ -68,13 +68,13 @@ public abstract class XPathFactory {
/**
* Protected constructor as {@link #newInstance()} or {@link #newInstance(String uri)}
* or {@link #newInstance(String uri, String factoryClassName, ClassLoader classLoader)}
- * should be used to create a new instance of an XPathFactory.
+ * should be used to create a new instance of an {@code XPathFactory}.
*/
protected XPathFactory() {
}
/**
- * Get a new XPathFactory instance using the default object model,
+ *
Get a new {@code XPathFactory} instance using the default object model,
* {@link #DEFAULT_OBJECT_MODEL_URI},
* the W3C DOM.
*
@@ -85,10 +85,10 @@ public abstract class XPathFactory {
*
* Since the implementation for the W3C DOM is always available, this method will never fail.
*
- * @return Instance of an XPathFactory.
+ * @return Instance of an {@code XPathFactory}.
*
* @throws RuntimeException When there is a failure in creating an
- * XPathFactory for the default object model.
+ * {@code XPathFactory} for the default object model.
*/
public static XPathFactory newInstance() {
@@ -105,23 +105,35 @@ public abstract class XPathFactory {
}
/**
- * Get a new XPathFactory instance using the specified object model.
+ * Get a new {@code XPathFactory} instance using the specified object model.
*
- * To find a XPathFactory object,
+ *
To find a {@code XPathFactory} object,
* this method looks the following places in the following order where "the class loader" refers to the context class loader:
*
* -
+ *
* If the system property {@link #DEFAULT_PROPERTY_NAME} + ":uri" is present,
* where uri is the parameter to this method, then its value is read as a class name.
* The method will try to create a new instance of this class by using the class loader,
* and returns it if it is successfully created.
*
* -
- * ${java.home}/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for.
- * If present, the value is processed just like above.
+ *
+ * Use the configuration file "jaxp.properties". The file is in standard
+ * {@link java.util.Properties} format and typically located in the
+ * conf directory of the Java installation. It contains the fully qualified
+ * name of the implementation class with the key being the system property
+ * defined above.
+ *
+ * The jaxp.properties file is read only once by the JAXP implementation
+ * and its values are then cached for future use. If the file does not exist
+ * when the first attempt is made to read from it, no further attempts are
+ * made to check for its existence. It is not possible to change the value
+ * of any property in jaxp.properties after it has been read for the first time.
*
* -
- * Use the service-provider loading facilities, defined by the
+ *
+ * Use the service-provider loading facility, defined by the
* {@link java.util.ServiceLoader} class, to attempt to locate and load an
* implementation of the service using the {@linkplain
* java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
@@ -140,16 +152,17 @@ public abstract class XPathFactory {
* {@link XPathFactoryConfigurationException} will be thrown.
*
* -
- * Platform default
XPathFactory is located in a platform specific way.
+ *
+ * Platform default {@code XPathFactory} is located in a platform specific way.
* There must be a platform default XPathFactory for the W3C DOM, i.e. {@link #DEFAULT_OBJECT_MODEL_URI}.
*
*
- * If everything fails, an XPathFactoryConfigurationException will be thrown.
+ * If everything fails, an {@code XPathFactoryConfigurationException} will be thrown.
*
- *
Tip for Trouble-shooting:
+ * Tip for Trouble-shooting:
*
See {@link java.util.Properties#load(java.io.InputStream)} for exactly how a property file is parsed.
* In particular, colons ':' need to be escaped in a property file, so make sure the URIs are properly escaped in it.
- * For example:
+ * For example:
*
* http\://java.sun.com/jaxp/xpath/dom=org.acme.DomXPathFactory
*
@@ -159,7 +172,7 @@ public abstract class XPathFactory {
* http://java.sun.com/jaxp/xpath/dom for the W3C DOM,
* the org.w3c.dom package, and implementations are free to introduce other URIs for other object models.
*
- * @return Instance of an XPathFactory.
+ * @return Instance of an {@code XPathFactory}.
*
* @throws XPathFactoryConfigurationException If the specified object model
* is unavailable, or if there is a configuration error.
@@ -199,7 +212,7 @@ public abstract class XPathFactory {
}
/**
- * Obtain a new instance of a XPathFactory from a factory class name. XPathFactory
+ *
Obtain a new instance of a {@code XPathFactory} from a factory class name. {@code XPathFactory}
* is returned if specified factory class supports the specified object model.
* This function is useful when there are multiple providers in the classpath.
* It gives more control to the application as it can specify which provider
@@ -227,7 +240,7 @@ public abstract class XPathFactory {
* current Thread's context classLoader is used to load the factory class.
*
*
- * @return New instance of a XPathFactory
+ * @return New instance of a {@code XPathFactory}
*
* @throws XPathFactoryConfigurationException
* if factoryClassName is null, or
@@ -281,11 +294,11 @@ public abstract class XPathFactory {
}
/**
- *
Is specified object model supported by this XPathFactory?
+ * Is specified object model supported by this {@code XPathFactory}?
*
- * @param objectModel Specifies the object model which the returned XPathFactory will understand.
+ * @param objectModel Specifies the object model which the returned {@code XPathFactory} will understand.
*
- * @return true if XPathFactory supports objectModel, else false.
+ * @return true if {@code XPathFactory} supports objectModel, else false.
*
* @throws NullPointerException If objectModel is null.
* @throws IllegalArgumentException If objectModel.length() == 0.
@@ -293,16 +306,16 @@ public abstract class XPathFactory {
public abstract boolean isObjectModelSupported(String objectModel);
/**
- * Set a feature for this XPathFactory and
+ *
Set a feature for this {@code XPathFactory} and
* XPaths created by this factory.
*
*
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
* An {@link XPathFactoryConfigurationException} is thrown if this
- * XPathFactory or the XPaths
+ * {@code XPathFactory} or the XPaths
* it creates cannot support the feature.
- * It is possible for an XPathFactory to expose a feature value
+ * It is possible for an {@code XPathFactory} to expose a feature value
* but be unable to change its state.
*
*
@@ -316,7 +329,7 @@ public abstract class XPathFactory {
* @param name Feature name.
* @param value Is feature state true or false.
*
- * @throws XPathFactoryConfigurationException if this XPathFactory or the XPaths
+ * @throws XPathFactoryConfigurationException if this {@code XPathFactory} or the XPaths
* it creates cannot support this feature.
* @throws NullPointerException if name is null.
*/
@@ -330,9 +343,9 @@ public abstract class XPathFactory {
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
* An {@link XPathFactoryConfigurationException} is thrown if this
- * XPathFactory or the XPaths
+ * {@code XPathFactory} or the XPaths
* it creates cannot support the feature.
- * It is possible for an XPathFactory to expose a feature value
+ * It is possible for an {@code XPathFactory} to expose a feature value
* but be unable to change its state.
*
*
@@ -341,7 +354,7 @@ public abstract class XPathFactory {
* @return State of the named feature.
*
* @throws XPathFactoryConfigurationException if this
- * XPathFactory or the XPaths
+ * {@code XPathFactory} or the XPaths
* it creates cannot support this feature.
* @throws NullPointerException if name is null.
*/
@@ -382,7 +395,7 @@ public abstract class XPathFactory {
/**
* Return a new XPath using the underlying object
- * model determined when the XPathFactory was instantiated.
+ * model determined when the {@code XPathFactory} was instantiated.
*
* @return New instance of an XPath.
*/
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index cb0c2af704c..4d619c61980 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -299,3 +299,4 @@ e529374fbe526dbd668e5e98fc047b42b3bc6d33 jdk9-b45
bb9cf97a5ac6aa1aa2a1034676d64413071f58ea jdk9-b51
1d1e7704eca9c77ebe6a8705d17ac568801f7a3b jdk9-b52
b8fbe40efa97fe0753076ccc6dfc50747c7877d0 jdk9-b53
+83a0cf0e08788c33872e1fe3e87bf9a0d1e59eaa jdk9-b54
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 7b8fe32ac14..6c1c4c33d69 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -296,3 +296,4 @@ f6b8edd397ee463be208fee27517c99101293267 jdk9-b50
a0dad230aeb3b0d5cfd5b0715029e48d50573f8c jdk9-b51
607ea68032cd4a4cf2c7a7a41fcb39602d6a75e2 jdk9-b52
6cb5f5c34009630749a40cefe116d143f0b2583e jdk9-b53
+568a62ab7d764d7c74ac1d87387dbe500662b551 jdk9-b54
diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk
index ed7ba13082c..2d10867948f 100644
--- a/jdk/make/CompileDemos.gmk
+++ b/jdk/make/CompileDemos.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -219,6 +219,9 @@ define SetupJVMTIDemo
# Param 7 = libs for solaris
# Param 8 = libs for linux
# Param 9 = extra directories with required sources
+ # Param 10 = DISABLED_WARNINGS_gcc
+ # Param 11 = DISABLED_WARNINGS_microsoft
+ # Param 12 = DISABLED_WARNINGS_clang
BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
$$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \
$$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
@@ -254,6 +257,9 @@ define SetupJVMTIDemo
LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
OPTIMIZATION := LOW, \
CXXFLAGS := $$($1_CXXFLAGS), \
+ DISABLED_WARNINGS_gcc := $(10), \
+ DISABLED_WARNINGS_clang := $(12), \
+ DISABLED_WARNINGS_microsoft := $(11), \
LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
diff --git a/jdk/make/gendata/GendataPolicyJars.gmk b/jdk/make/gendata/GendataPolicyJars.gmk
index 9364159f129..256b32e2b58 100644
--- a/jdk/make/gendata/GendataPolicyJars.gmk
+++ b/jdk/make/gendata/GendataPolicyJars.gmk
@@ -77,7 +77,7 @@ US_EXPORT_POLICY_JAR_DEPS := \
$(US_EXPORT_POLICY_JAR_TMP)/default_US_export.policy
$(eval $(call SetupArchive,BUILD_US_EXPORT_POLICY_JAR, \
- $(US_EXPORT_POLICY_JAR_DEPS), \
+ DEPENDENCIES := $(US_EXPORT_POLICY_JAR_DEPS), \
SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
SUFFIXES := .policy, \
JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED), \
@@ -139,8 +139,8 @@ $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/%: \
$(install-file)
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
- $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
- $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
+ DEPENDENCIES := $(LOCAL_POLICY_JAR_LIMITED_TMP)/exempt_local.policy \
+ $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
SUFFIXES := .policy, \
JAR := $(LOCAL_POLICY_JAR_LIMITED), \
@@ -148,7 +148,7 @@ $(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_LIMITED, \
SKIP_METAINF := true))
$(eval $(call SetupArchive,BUILD_LOCAL_POLICY_JAR_UNLIMITED, \
- $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
+ DEPENDENCIES := $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
SUFFIXES := .policy, \
JAR := $(LOCAL_POLICY_JAR_UNLIMITED), \
diff --git a/jdk/make/gensrc/Gensrc-jdk.dev.gmk b/jdk/make/gensrc/Gensrc-jdk.dev.gmk
index 0c956abbc12..b8f57aa529e 100644
--- a/jdk/make/gensrc/Gensrc-jdk.dev.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.dev.gmk
@@ -32,8 +32,7 @@ include GensrcProperties.gmk
$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
$(filter %.properties, \
$(call CacheFind, \
- $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources \
- $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
+ $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources)), \
ListResourceBundle))
TARGETS += $(COMPILE_PROPERTIES)
diff --git a/jdk/make/gensrc/Gensrc-jdk.jartool.gmk b/jdk/make/gensrc/Gensrc-jdk.jartool.gmk
new file mode 100644
index 00000000000..0fb8eabc621
--- /dev/null
+++ b/jdk/make/gensrc/Gensrc-jdk.jartool.gmk
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include GensrcCommon.gmk
+
+################################################################################
+
+include GensrcProperties.gmk
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
+ $(filter %.properties, \
+ $(call CacheFind, \
+ $(JDK_TOPDIR)/src/jdk.jartool/share/classes/sun/tools/jar/resources)), \
+ ListResourceBundle))
+
+TARGETS += $(COMPILE_PROPERTIES)
+
+################################################################################
+
+all: $(TARGETS)
+
+.PHONY: all
diff --git a/jdk/make/launcher/Launcher-jdk.dev.gmk b/jdk/make/launcher/Launcher-jdk.dev.gmk
index 92b6d1bacb9..b58545e5418 100644
--- a/jdk/make/launcher/Launcher-jdk.dev.gmk
+++ b/jdk/make/launcher/Launcher-jdk.dev.gmk
@@ -25,18 +25,6 @@
include LauncherCommon.gmk
-$(eval $(call SetupLauncher,jar, \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
-
-$(eval $(call SetupLauncher,jarsigner, \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
-
-ifndef BUILD_HEADLESS_ONLY
- $(eval $(call SetupLauncher,policytool, \
- -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
- $(XLIBS)))
-endif
-
$(eval $(call SetupLauncher,jdeps, \
-DEXPAND_CLASSPATH_WILDCARDS \
-DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
diff --git a/jdk/make/launcher/Launcher-jdk.jartool.gmk b/jdk/make/launcher/Launcher-jdk.jartool.gmk
new file mode 100644
index 00000000000..b6d44e315ff
--- /dev/null
+++ b/jdk/make/launcher/Launcher-jdk.jartool.gmk
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include LauncherCommon.gmk
+
+$(eval $(call SetupLauncher,jar, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jar.Main"$(COMMA) }'))
+
+$(eval $(call SetupLauncher,jarsigner, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.jarsigner.Main"$(COMMA) }'))
diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.pack200.gmk
similarity index 90%
rename from jdk/make/launcher/Launcher-jdk.runtime.gmk
rename to jdk/make/launcher/Launcher-jdk.pack200.gmk
index 366dc5cc9a2..6ee00f7ccd0 100644
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,9 @@ $(eval $(call SetupLauncher,pack200, \
# The order of the object files on the link command line affects the size of the resulting
# binary (at least on linux) which causes the size to differ between old and new build.
-UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
- $(JDK_TOPDIR)/src/jdk.runtime/share/native/unpack200
-UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
+UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
+ $(JDK_TOPDIR)/src/jdk.pack200/share/native/unpack200
+UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
-I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
@@ -79,6 +79,9 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
CFLAGS_linux := -fPIC, \
CFLAGS_solaris := -KPIC, \
CFLAGS_macosx := -fPIC, \
+ DISABLED_WARNINGS_gcc := sign-compare unused-result format-nonliteral \
+ format-security parentheses, \
+ DISABLED_WARNINGS_microsoft := 4267 4018, \
MAPFILE := $(UNPACK_MAPFILE),\
LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
@@ -96,7 +99,7 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
-D "JDK_INTERNAL_NAME=unpack200" \
-D "JDK_FTYPE=0x1L", \
DEBUG_SYMBOLS := true, \
- MANIFEST := $(JDK_TOPDIR)/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest))
+ MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest))
ifneq ($(USE_EXTERNAL_LIBZ), true)
diff --git a/jdk/make/launcher/Launcher-jdk.policytool.gmk b/jdk/make/launcher/Launcher-jdk.policytool.gmk
new file mode 100644
index 00000000000..133e3f612d8
--- /dev/null
+++ b/jdk/make/launcher/Launcher-jdk.policytool.gmk
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include LauncherCommon.gmk
+
+ifndef BUILD_HEADLESS_ONLY
+ $(eval $(call SetupLauncher,policytool, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.tools.policytool.PolicyTool"$(COMMA) }',, \
+ $(XLIBS)))
+endif
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index d7e50779625..549068675fd 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE, \
OPTIMIZATION := HIGHEST, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(BUILD_LIBMLIB_CFLAGS), \
+ DISABLED_WARNINGS_gcc := parentheses, \
+ DISABLED_WARNINGS_clang := parentheses, \
+ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -127,6 +130,7 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
CFLAGS := -xarch=sparcvis \
$(LIBMLIB_IMAGE_V_CFLAGS) \
$(CFLAGS_JDKLIB), \
+ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
@@ -175,9 +179,6 @@ LIBAWT_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-endif
-
ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
LIBAWT_CFLAGS += -xarch=sparcvis
@@ -253,6 +254,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
LANG := $(LIBAWT_LANG), \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
+ DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
+ format-nonliteral parentheses, \
+ DISABLED_WARNINGS_clang := logical-op-parentheses, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+ DISABLED_WARNINGS_microsoft := 4297 4244 4267, \
ASFLAGS := $(LIBAWT_ASFLAGS), \
MAPFILE := $(LIBAWT_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -361,6 +367,11 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
$(X_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
+ deprecated-declarations unused-result maybe-uninitialized format \
+ format-security int-to-pointer-cast parentheses, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
+ E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
@@ -417,6 +428,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
$(LCMS_CFLAGS), \
CFLAGS_solaris := -xc99=no_lib, \
CFLAGS_windows := -DCMS_IS_WINDOWS_, \
+ DISABLED_WARNINGS_gcc := format-nonliteral, \
+ DISABLED_WARNINGS_clang := tautological-compare, \
+ DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -495,6 +509,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+ DISABLED_WARNINGS_gcc := clobbered parentheses, \
+ DISABLED_WARNINGS_clang := logical-op-parentheses, \
+ DISABLED_WARNINGS_microsoft := 4267, \
MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -563,6 +580,9 @@ ifeq ($(BUILD_HEADLESS), true)
$(CUPS_CFLAGS) \
$(X_CFLAGS) \
$(LIBAWT_HEADLESS_CFLAGS), \
+ DISABLED_WARNINGS_gcc := maybe-uninitialized int-to-pointer-cast, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
+ E_EMPTY_TRANSLATION_UNIT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -644,6 +664,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
+ DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast reorder \
+ delete-non-virtual-dtor, \
+ DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types, \
+ DISABLED_WARNINGS_solstudio := truncwarn, \
+ DISABLED_WARNINGS_microsoft := 4267 4244 4018 4090, \
MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -876,6 +901,10 @@ ifndef BUILD_HEADLESS_ONLY
OPTIMIZATION := LOW, \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
$(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits unused-result maybe-uninitialized, \
+ DISABLED_WARNINGS_clang := incompatible-pointer-types, \
+ DISABLED_WARNINGS_solstudio := E_NEWLINE_NOT_LAST, \
+ DISABLED_WARNINGS_microsoft := 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -946,6 +975,9 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
$(X_CFLAGS) \
$(X_LIBS) \
$(LIBAWT_LWAWT_CFLAGS), \
+ DISABLED_WARNINGS_clang := incomplete-implementation \
+ deprecated-declarations objc-method-access bitwise-op-parentheses \
+ incompatible-pointer-types parentheses-equality extra-tokens, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN) \
-L$(INSTALL_LIBRARIES_HERE), \
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index 7046e35b785..678af20a830 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
##########################################################################################
-# libfdlibm is statically linked with libjava below and not delivered into the
+# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
@@ -48,6 +48,8 @@ ifneq ($(OPENJDK_TARGET_OS), macosx)
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
CFLAGS_windows_debug := -DLOGGING, \
CFLAGS_aix := -qfloat=nomaf, \
+ DISABLED_WARNINGS_gcc := sign-compare, \
+ DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -94,6 +96,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
LANG := C, \
OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
CFLAGS := $(CFLAGS_JDKLIB), \
+ DISABLED_WARNINGS_microsoft := 4244 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -147,6 +150,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits format-nonliteral, \
+ DISABLED_WARNINGS_clang := int-conversion, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+ DISABLED_WARNINGS_microsoft := 4022 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -209,6 +216,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
-I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
+ DISABLED_WARNINGS_gcc := parentheses, \
+ DISABLED_WARNINGS_clang := dangling-else, \
+ DISABLED_WARNINGS_microsoft := 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
REORDER := $(BUILD_LIBZIP_REORDER), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -307,6 +317,12 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(LIBJLI_CFLAGS), \
+ DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \
+ parentheses, \
+ DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
+ int-conversion, \
+ DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION E_NEWLINE_NOT_LAST, \
+ DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -355,6 +371,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
+ DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -375,6 +392,8 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
LANG := C, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
+ DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
+ int-conversion, \
LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -401,4 +420,3 @@ else ifeq ($(OPENJDK_TARGET_OS), aix)
TARGETS += $(BUILD_LIBJLI_STATIC)
endif
-
diff --git a/jdk/make/lib/Lib-java.security.jgss.gmk b/jdk/make/lib/Lib-java.security.jgss.gmk
index ba78eb4cc39..a92212f4b0e 100644
--- a/jdk/make/lib/Lib-java.security.jgss.gmk
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+ DISABLED_WARNINGS_gcc := pointer-to-int-cast, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2gss/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -82,6 +83,7 @@ ifneq ($(BUILD_CRYPTO), no)
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(BUILD_LIBKRB5_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+ DISABLED_WARNINGS_clang := implicit-function-declaration, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
diff --git a/jdk/make/lib/Lib-jdk.crypto.ec.gmk b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
index db75429ab6a..564eb402ae0 100644
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,8 @@ ifeq ($(ENABLE_INTREE_EC), yes)
-DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
CXXFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
$(BUILD_LIBSUNEC_FLAGS), \
+ DISABLED_WARNINGS_gcc := sign-compare, \
+ DISABLED_WARNINGS_microsoft := 4101 4244 4146 4018, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsunec/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
index bbd6bc37c88..0672aa3a359 100644
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
$(LIBJAVA_HEADER_FLAGS) \
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.pkcs11, \
+ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE, \
+ DISABLED_WARNINGS_microsoft := 4013 4267, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/Lib-jdk.deploy.osx.gmk b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
index 628c17fbced..f68b9c065e3 100644
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
CFLAGS := $(CFLAGS_JDKLIB) \
-I$(LIBAPPLESCRIPTENGINE_SRC) \
-I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx, \
+ DISABLED_WARNINGS_clang := implicit-function-declaration format, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := -framework Cocoa \
@@ -71,6 +72,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBOSX_CFLAGS), \
+ DISABLED_WARNINGS_clang := deprecated-declarations, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/Lib-jdk.runtime.gmk b/jdk/make/lib/Lib-jdk.pack200.gmk
similarity index 83%
rename from jdk/make/lib/Lib-jdk.runtime.gmk
rename to jdk/make/lib/Lib-jdk.pack200.gmk
index 4bf9b026cc1..b8bab611310 100644
--- a/jdk/make/lib/Lib-jdk.runtime.gmk
+++ b/jdk/make/lib/Lib-jdk.pack200.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -30,16 +30,20 @@ include LibCommon.gmk
$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
LIBRARY := unpack, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libunpack \
- $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack, \
+ SRC := $(JDK_TOPDIR)/src/jdk.pack200/share/native/libunpack \
+ $(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack, \
LANG := C++, \
OPTIMIZATION := LOW, \
CFLAGS := $(CXXFLAGS_JDKLIB) \
-DNO_ZLIB -DUNPACK_JNI -DFULL \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
- -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
+ -I$(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack \
$(LIBJAVA_HEADER_FLAGS), \
CFLAGS_release := -DPRODUCT, \
+ DISABLED_WARNINGS_gcc := conversion-null sign-compare format-security \
+ format-nonliteral parentheses, \
+ DISABLED_WARNINGS_solstudio := truncwarn, \
+ DISABLED_WARNINGS_microsoft := 4267 4018, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/NetworkingLibraries.gmk b/jdk/make/lib/NetworkingLibraries.gmk
index 57d86eabfb5..4231121123e 100644
--- a/jdk/make/lib/NetworkingLibraries.gmk
+++ b/jdk/make/lib/NetworkingLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
$(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
+ DISABLED_WARNINGS_gcc := format-nonliteral, \
+ DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
+ DISABLED_WARNINGS_microsoft := 4244 4047 4133, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libnet/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/make/lib/NioLibraries.gmk b/jdk/make/lib/NioLibraries.gmk
index 9a6e3e07ced..fd973ccc535 100644
--- a/jdk/make/lib/NioLibraries.gmk
+++ b/jdk/make/lib/NioLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(BUILD_LIBNIO_CFLAGS), \
+ DISABLED_WARNINGS_gcc := type-limits, \
+ DISABLED_WARNINGS_clang := tautological-compare, \
+ DISABLED_WARNINGS_microsoft := 4244, \
MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -92,4 +95,3 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
TARGETS += $(BUILD_LIBNIO)
$(BUILD_LIBNIO): $(BUILD_LIBNET)
-
diff --git a/jdk/make/lib/PlatformLibraries.gmk b/jdk/make/lib/PlatformLibraries.gmk
index 14592213e40..0035b1dfbbb 100644
--- a/jdk/make/lib/PlatformLibraries.gmk
+++ b/jdk/make/lib/PlatformLibraries.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
CFLAGS := $(CFLAGS_JDKLIB) \
$(addprefix -I, $(LIBOSXAPP_SRC)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+ DISABLED_WARNINGS_clang := objc-method-access objc-root-class, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX_macosx := \
@@ -59,4 +60,3 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
TARGETS += $(BUILD_LIBOSXAPP)
endif
-
diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk
index ec3b99d8447..f123d179d7a 100644
--- a/jdk/make/lib/SoundLibraries.gmk
+++ b/jdk/make/lib/SoundLibraries.gmk
@@ -129,6 +129,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJSOUND_CFLAGS), \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+ DISABLED_WARNINGS_clang := implicit-function-declaration \
+ deprecated-writable-strings, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsound/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -175,6 +177,7 @@ ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
-DUSE_PORTS=TRUE \
-DUSE_PLATFORM_MIDI_OUT=TRUE \
-DUSE_PLATFORM_MIDI_IN=TRUE, \
+ DISABLED_WARNINGS_gcc := parentheses, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsoundalsa/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c b/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c
index 0f78bc953f7..72c9717a5cb 100644
--- a/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c
+++ b/jdk/src/demo/share/jvmti/compiledMethodLoad/compiledMethodLoad.c
@@ -143,7 +143,7 @@ print_inline_info_record(jvmtiCompiledMethodLoadInlineRecord* record,
for (i = 0; i < numpcs; i++) {
PCStackInfo pcrecord = (record->pcinfo[i]);
- fprintf(fp, "PcDescriptor(pc=0x%lx):\n", (jint)(pcrecord.pc));
+ fprintf(fp, "PcDescriptor(pc=%p):\n", pcrecord.pc);
print_stack_frames(&pcrecord, jvmti, fp);
}
}
diff --git a/jdk/src/demo/share/jvmti/waiters/Agent.cpp b/jdk/src/demo/share/jvmti/waiters/Agent.cpp
index cf2285c6ca6..8f67f5480a5 100644
--- a/jdk/src/demo/share/jvmti/waiters/Agent.cpp
+++ b/jdk/src/demo/share/jvmti/waiters/Agent.cpp
@@ -111,8 +111,6 @@ Agent::get_monitor(jvmtiEnv *jvmti, JNIEnv *env, jobject object)
/* VM initialization and VM death calls to Agent */
Agent::Agent(jvmtiEnv *jvmti, JNIEnv *env, jthread thread)
{
- jvmtiError err;
-
stdout_message("Agent created..\n");
stdout_message("VMInit...\n");
/* Start monitor list */
@@ -129,8 +127,6 @@ Agent::~Agent()
void Agent::vm_death(jvmtiEnv *jvmti, JNIEnv *env)
{
- jvmtiError err;
-
/* Delete all Monitors we allocated */
for ( int i = 0; i < (int)monitor_count; i++ ) {
delete monitor_list[i];
diff --git a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
index 07a31a0ef34..b9ffb200a81 100644
--- a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
+++ b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,8 +45,13 @@ import java.util.Vector;
* The X509V1CertImpl class is used as a conversion wrapper around
* sun.security.x509.X509Cert certificates when running under JDK1.1.x.
*
+ * @deprecated This is the implementation class for the deprecated
+ * {@code javax.security.cert.X509Certificate} class. The classes in the
+ * {@code java.security.cert} package should be used instead.
+ *
* @author Jeff Nisewanger
*/
+@Deprecated
public class X509V1CertImpl extends X509Certificate implements Serializable {
static final long serialVersionUID = -2048442350420423405L;
private java.security.cert.X509Certificate wrappedCert;
diff --git a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
index 72b260309d6..940084cfbc6 100644
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java
@@ -171,6 +171,11 @@ import java.util.Map;
* variables, first call {@link java.util.Map#clear() Map.clear()}
* before adding environment variables.
*
+ *
+ * Unless otherwise noted, passing a {@code null} argument to a constructor
+ * or method in this class will cause a {@link NullPointerException} to be
+ * thrown.
+ *
* @author Martin Buchholz
* @since 1.5
*/
@@ -193,7 +198,6 @@ public final class ProcessBuilder
* command.
*
* @param command the list containing the program and its arguments
- * @throws NullPointerException if the argument is null
*/
public ProcessBuilder(List command) {
if (command == null)
@@ -228,8 +232,6 @@ public final class ProcessBuilder
*
* @param command the list containing the program and its arguments
* @return this process builder
- *
- * @throws NullPointerException if the argument is null
*/
public ProcessBuilder command(List command) {
if (command == null)
@@ -554,7 +556,6 @@ public final class ProcessBuilder
* }
*
* @param file The {@code File} for the {@code Redirect}.
- * @throws NullPointerException if the specified file is null
* @return a redirect to read from the specified file
*/
public static Redirect from(final File file) {
@@ -581,7 +582,6 @@ public final class ProcessBuilder
* }
*
* @param file The {@code File} for the {@code Redirect}.
- * @throws NullPointerException if the specified file is null
* @return a redirect to write to the specified file
*/
public static Redirect to(final File file) {
@@ -612,7 +612,6 @@ public final class ProcessBuilder
* }
*
* @param file The {@code File} for the {@code Redirect}.
- * @throws NullPointerException if the specified file is null
* @return a redirect to append to the specified file
*/
public static Redirect appendTo(final File file) {
diff --git a/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template b/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template
index f5e50a51c85..faa51bb45d4 100644
--- a/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template
@@ -266,16 +266,15 @@ public abstract class Charset$Coder$ {
* method, passing the new replacement, after checking that the new
* replacement is acceptable.
*
- * @param newReplacement The replacement value
- *
+ * @param newReplacement The new replacement; must not be
+ * null, must have non-zero length,
#if[decoder]
- * The new replacement; must not be null
- * and must have non-zero length
+ * and must not be longer than the value returned by the
+ * {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method
#end[decoder]
#if[encoder]
- * The new replacement; must not be null, must have
- * non-zero length, must not be longer than the value returned by
- * the {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and
+ * must not be longer than the value returned by the
+ * {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and
* must be {@link #isLegalReplacement legal}
#end[encoder]
*
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Acl.java b/jdk/src/java.base/share/classes/java/security/acl/Acl.java
index cffb48e46a7..9131966a08e 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Acl.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Acl.java
@@ -82,8 +82,12 @@ import java.security.Principal;
* @see java.security.acl.Acl#getPermissions
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Acl extends Owner {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java b/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java
index cd9675f34a1..dd4e548ab47 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,11 @@ import java.security.Principal;
* @see java.security.acl.Acl
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface AclEntry extends Cloneable {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java b/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java
index 6f08e178e71..0a153e25665 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/AclNotFoundException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,11 @@ package java.security.acl;
* non-existent ACL (Access Control List).
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public class AclNotFoundException extends Exception {
private static final long serialVersionUID = 5684295034092681791L;
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Group.java b/jdk/src/java.base/share/classes/java/security/acl/Group.java
index ebd9c445282..9ff69f563cb 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Group.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Group.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,11 @@ import java.security.Principal;
* Principal or Group.
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Group extends Principal {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java b/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java
index 196c8f1bd86..b25bf84d46c 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/LastOwnerException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,11 @@ package java.security.acl;
* @see java.security.acl.Owner#deleteOwner
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public class LastOwnerException extends Exception {
private static final long serialVersionUID = -5141997548211140359L;
diff --git a/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java b/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java
index 0a4b04b22d5..68d214d7185 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/NotOwnerException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,11 @@ package java.security.acl;
* the object, but the Principal attempting the modification is not an owner.
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public class NotOwnerException extends Exception {
private static final long serialVersionUID = -5555597911163362399L;
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Owner.java b/jdk/src/java.base/share/classes/java/security/acl/Owner.java
index 2f649d40b33..2a4999b277d 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Owner.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Owner.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,10 @@ import java.security.Principal;
*
* @see java.security.acl.Acl
*
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Owner {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/Permission.java b/jdk/src/java.base/share/classes/java/security/acl/Permission.java
index 380a0102cd0..236f10795f0 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/Permission.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/Permission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,11 @@ package java.security.acl;
* a particular type of access to a resource.
*
* @author Satish Dharmaraj
+ *
+ * @deprecated This package has been replaced by {@code java.security.Policy}
+ * and related classes since 1.2.
*/
+@Deprecated
public interface Permission {
/**
diff --git a/jdk/src/java.base/share/classes/java/security/acl/package-info.java b/jdk/src/java.base/share/classes/java/security/acl/package-info.java
index fbe5a8de6b9..f0362fdf0b6 100644
--- a/jdk/src/java.base/share/classes/java/security/acl/package-info.java
+++ b/jdk/src/java.base/share/classes/java/security/acl/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,12 @@
*/
/**
- * The classes and interfaces in this package have been
- * superseded by classes in the java.security package.
- * See that package and, for example, java.security.Permission for details.
+ * The classes and interfaces in this package have been deprecated.
+ * The {@code java.security} package contains suitable replacements.
+ * See that package and, for example, {@code java.security.Permission}
+ * for details.
*
* @since 1.1
*/
+@Deprecated
package java.security.acl;
diff --git a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
index 90a94ed3436..89bf11d94ae 100644
--- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
+++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec {
* Java Cryptography Architecture Standard Algorithm Name Documentation
* for information about standard algorithm names.
* @throws NullPointerException if {@code encodedKey}
- * or {@algorithm} is null.
+ * or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
* @since 1.9
diff --git a/jdk/src/java.base/share/classes/java/time/format/Parsed.java b/jdk/src/java.base/share/classes/java/time/format/Parsed.java
index 1eb88454414..58cbfaffbef 100644
--- a/jdk/src/java.base/share/classes/java/time/format/Parsed.java
+++ b/jdk/src/java.base/share/classes/java/time/format/Parsed.java
@@ -216,7 +216,16 @@ final class Parsed implements TemporalAccessor {
return (R) (date != null ? LocalDate.from(date) : null);
} else if (query == TemporalQueries.localTime()) {
return (R) time;
- } else if (query == TemporalQueries.zone() || query == TemporalQueries.offset()) {
+ } else if (query == TemporalQueries.offset()) {
+ Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
+ if (offsetSecs != null) {
+ return (R) ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
+ }
+ if (zone instanceof ZoneOffset) {
+ return (R)zone;
+ }
+ return query.queryFrom(this);
+ } else if (query == TemporalQueries.zone()) {
return query.queryFrom(this);
} else if (query == TemporalQueries.precision()) {
return null; // not a complete date/time
diff --git a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
index 0fcd3eac11f..96cf39a6338 100644
--- a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
@@ -1183,7 +1183,7 @@ public final class Matcher implements MatchResult {
*
* Given the regular expression dog, the input
* "zzzdogzzzdogzzz", and the function
- * mr -> mr.group().toUpperCase(), an invocation of this method on
+ * {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
* a matcher for that expression would yield the string
* "zzzDOGzzzDOGzzz".
*
@@ -1405,7 +1405,7 @@ public final class Matcher implements MatchResult {
*
*
Given the regular expression dog, the input
* "zzzdogzzzdogzzz", and the function
- * mr -> mr.group().toUpperCase(), an invocation of this method on
+ * {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
* a matcher for that expression would yield the string
* "zzzDOGzzzdogzzz".
*
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
index f6abafaea85..fb5b8ed704d 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/HandshakeCompletedEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -152,7 +152,11 @@ public class HandshakeCompletedEvent extends EventObject
* {@link javax.security.cert.X509Certificate} format).
* @exception SSLPeerUnverifiedException if the peer is not verified.
* @see #getPeerPrincipal()
+ * @deprecated The {@link #getPeerCertificates()} method that returns an
+ * array of {@code java.security.cert.Certificate} should
+ * be used instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate [] getPeerCertificateChain()
throws SSLPeerUnverifiedException
{
diff --git a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java
index d98edf0b365..5f6317dd295 100644
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -272,7 +272,11 @@ public interface SSLSession {
* @exception SSLPeerUnverifiedException if the peer's identity
* has not been verified
* @see #getPeerPrincipal()
+ * @deprecated The {@link #getPeerCertificates()} method that returns an
+ * array of {@code java.security.cert.Certificate} should
+ * be used instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate [] getPeerCertificateChain()
throws SSLPeerUnverifiedException;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java b/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java
index 10fd767c157..84fdefde609 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/Certificate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,9 +57,11 @@ import java.security.SignatureException;
*
* @since 1.4
* @see X509Certificate
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*
* @author Hemma Prafullchandra
*/
+@Deprecated
public abstract class Certificate {
/**
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java
index 1496c754181..95fbcfbeb1e 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateEncodingException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,9 @@ package javax.security.cert;
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateEncodingException extends CertificateException {
private static final long serialVersionUID = -8187642723048403470L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java
index 68ee6798b8c..144bb97fe6a 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,9 @@ package javax.security.cert;
* @author Hemma Prafullchandra
* @since 1.4
* @see Certificate
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateException extends Exception {
private static final long serialVersionUID = -5757213374030785290L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java
index 7e4579f2ebe..9f4eb7d4aed 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateExpiredException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,9 @@ package javax.security.cert;
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateExpiredException extends CertificateException {
private static final long serialVersionUID = 5091601212177261883L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java
index 9a53daa661d..c5c67c7f61e 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateNotYetValidException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,9 @@ package javax.security.cert;
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateNotYetValidException extends CertificateException {
private static final long serialVersionUID = -8976172474266822818L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java b/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java
index 4378587bb70..cd1f6ac507c 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/CertificateParsingException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,9 @@ package javax.security.cert;
*
* @since 1.4
* @author Hemma Prafullchandra
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public class CertificateParsingException extends CertificateException {
private static final long serialVersionUID = -8449352422951136229L;
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java b/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java
index 1ef7ddcb56a..666524a084c 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,9 @@ import java.util.Date;
* @see Certificate
* @see java.security.cert.X509Extension
* @see java.security.Security security properties
+ * @deprecated Use the classes in {@code java.security.cert} instead.
*/
+@Deprecated
public abstract class X509Certificate extends Certificate {
/*
diff --git a/jdk/src/java.base/share/classes/javax/security/cert/package-info.java b/jdk/src/java.base/share/classes/javax/security/cert/package-info.java
index c09a0eafabc..a1d7a34fae1 100644
--- a/jdk/src/java.base/share/classes/javax/security/cert/package-info.java
+++ b/jdk/src/java.base/share/classes/javax/security/cert/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,16 @@
/**
* Provides classes for public key certificates.
*
- * These classes include a simplified version of the
- * java.security.cert package. These classes were developed
- * as part of the Java Secure Socket
+ * This package has been deprecated. These classes include a simplified
+ * version of the {@code java.security.cert} package. These classes were
+ * developed as part of the Java Secure Socket
* Extension (JSSE). When JSSE was added to the J2SE version 1.4, this
* package was added for backward-compatibility reasons only.
*
* New applications should not use this package, but rather
- * java.security.cert.
+ * {@code java.security.cert}.
*
* @since 1.4
*/
+@Deprecated
package javax.security.cert;
diff --git a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
index 15402d168cd..ef25c517f03 100644
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java
@@ -57,31 +57,29 @@ public final class Unsafe {
* Provides the caller with the capability of performing unsafe
* operations.
*
- *
The returned Unsafe object should be carefully guarded
+ *
The returned {@code Unsafe} object should be carefully guarded
* by the caller, since it can be used to read and write data at arbitrary
* memory addresses. It must never be passed to untrusted code.
*
- *
Most methods in this class are very low-level, and correspond to a
+ *
Most methods in this class are very low-level, and correspond to a
* small number of hardware instructions (on typical machines). Compilers
* are encouraged to optimize these methods accordingly.
*
- *
Here is a suggested idiom for using unsafe operations:
+ *
Here is a suggested idiom for using unsafe operations:
*
- *
+ * {@code
* class MyTrustedClass {
* private static final Unsafe unsafe = Unsafe.getUnsafe();
* ...
* private long myCountAddress = ...;
* public int getCount() { return unsafe.getByte(myCountAddress); }
- * }
- *
+ * }}
*
- * (It may assist compilers to make the local variable be
- * final.)
+ * (It may assist compilers to make the local variable {@code final}.)
*
- * @exception SecurityException if a security manager exists and its
- * checkPropertiesAccess method doesn't allow
- * access to the system properties.
+ * @throws SecurityException if a security manager exists and its
+ * {@code checkPropertiesAccess} method doesn't allow
+ * access to the system properties.
*/
@CallerSensitive
public static Unsafe getUnsafe() {
@@ -100,28 +98,27 @@ public final class Unsafe {
/**
* Fetches a value from a given Java variable.
* More specifically, fetches a field or array element within the given
- * object o at the given offset, or (if o is
- * null) from the memory address whose numerical value is the given
- * offset.
+ * object {@code o} at the given offset, or (if {@code o} is null)
+ * from the memory address whose numerical value is the given offset.
*
* The results are undefined unless one of the following cases is true:
*
* - The offset was obtained from {@link #objectFieldOffset} on
* the {@link java.lang.reflect.Field} of some Java field and the object
- * referred to by
o is of a class compatible with that
+ * referred to by {@code o} is of a class compatible with that
* field's class.
*
- * - The offset and object reference
o (either null or
+ * - The offset and object reference {@code o} (either null or
* non-null) were both obtained via {@link #staticFieldOffset}
* and {@link #staticFieldBase} (respectively) from the
* reflective {@link Field} representation of some Java field.
*
- *
- The object referred to by
o is an array, and the offset
- * is an integer of the form B+N*S, where N is
- * a valid index into the array, and B and S are
+ * - The object referred to by {@code o} is an array, and the offset
+ * is an integer of the form {@code B+N*S}, where {@code N} is
+ * a valid index into the array, and {@code B} and {@code S} are
* the values obtained by {@link #arrayBaseOffset} and {@link
* #arrayIndexScale} (respectively) from the array's class. The value
- * referred to is the
Nth element of the array.
+ * referred to is the {@code N}th element of the array.
*
*
*
@@ -162,7 +159,7 @@ public final class Unsafe {
* is stored into that variable.
*
* The variable must be of the same type as the method
- * parameter x.
+ * parameter {@code x}.
*
* @param o Java heap object in which the variable resides, if any, else
* null
@@ -184,9 +181,9 @@ public final class Unsafe {
/**
* Stores a reference value into a given Java variable.
*
- * Unless the reference x being stored is either null
+ * Unless the reference {@code x} being stored is either null
* or matches the field type, the results are undefined.
- * If the reference o is non-null, car marks or
+ * If the reference {@code o} is non-null, car marks or
* other store barriers for that object (if the VM requires them)
* are updated.
* @see #putInt(Object, long, int)
@@ -272,11 +269,11 @@ public final class Unsafe {
* zero, or does not point into a block obtained from {@link
* #allocateMemory}, the results are undefined.
*
- *
If the native pointer is less than 64 bits wide, it is extended as
+ *
If the native pointer is less than 64 bits wide, it is extended as
* an unsigned number to a Java long. The pointer may be indexed by any
* given byte offset, simply by adding that offset (as a simple integer) to
* the long representing the pointer. The number of bytes actually read
- * from the target address maybe determined by consulting {@link
+ * from the target address may be determined by consulting {@link
* #addressSize}.
*
* @see #allocateMemory
@@ -288,7 +285,7 @@ public final class Unsafe {
* zero, or does not point into a block obtained from {@link
* #allocateMemory}, the results are undefined.
*
- *
The number of bytes actually written at the target address maybe
+ *
The number of bytes actually written at the target address may be
* determined by consulting {@link #addressSize}.
*
* @see #getAddress(long)
@@ -357,7 +354,7 @@ public final class Unsafe {
* (usually zero). This provides a single-register addressing mode,
* as discussed in {@link #getInt(Object,long)}.
*
- *
Equivalent to setMemory(null, address, bytes, value).
+ *
Equivalent to {@code setMemory(null, address, bytes, value)}.
*/
public void setMemory(long address, long bytes, byte value) {
setMemory(null, address, bytes, value);
@@ -388,7 +385,7 @@ public final class Unsafe {
* block. This provides a single-register addressing mode,
* as discussed in {@link #getInt(Object,long)}.
*
- * Equivalent to copyMemory(null, srcAddress, null, destAddress, bytes).
+ * Equivalent to {@code copyMemory(null, srcAddress, null, destAddress, bytes)}.
*/
public void copyMemory(long srcAddress, long destAddress, long bytes) {
copyMemory(null, srcAddress, null, destAddress, bytes);
@@ -413,7 +410,7 @@ public final class Unsafe {
public static final int INVALID_FIELD_OFFSET = -1;
/**
- * Report the location of a given field in the storage allocation of its
+ * Reports the location of a given field in the storage allocation of its
* class. Do not expect to perform any sort of arithmetic on this offset;
* it is just a cookie which is passed to the unsafe heap memory accessors.
*
@@ -433,7 +430,7 @@ public final class Unsafe {
public native long objectFieldOffset(Field f);
/**
- * Report the location of a given static field, in conjunction with {@link
+ * Reports the location of a given static field, in conjunction with {@link
* #staticFieldBase}.
*
Do not expect to perform any sort of arithmetic on this offset;
* it is just a cookie which is passed to the unsafe heap memory accessors.
@@ -452,7 +449,7 @@ public final class Unsafe {
public native long staticFieldOffset(Field f);
/**
- * Report the location of a given static field, in conjunction with {@link
+ * Reports the location of a given static field, in conjunction with {@link
* #staticFieldOffset}.
*
Fetch the base "Object", if any, with which static fields of the
* given class can be accessed via methods like {@link #getInt(Object,
@@ -464,7 +461,7 @@ public final class Unsafe {
public native Object staticFieldBase(Field f);
/**
- * Detect if the given class may need to be initialized. This is often
+ * Detects if the given class may need to be initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
* @return false only if a call to {@code ensureClassInitialized} would have no effect
@@ -472,14 +469,14 @@ public final class Unsafe {
public native boolean shouldBeInitialized(Class> c);
/**
- * Ensure the given class has been initialized. This is often
+ * Ensures the given class has been initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
*/
public native void ensureClassInitialized(Class> c);
/**
- * Report the offset of the first element in the storage allocation of a
+ * Reports the offset of the first element in the storage allocation of a
* given array class. If {@link #arrayIndexScale} returns a non-zero value
* for the same class, you may use that scale factor, together with this
* base offset, to form new offsets to access elements of arrays of the
@@ -527,7 +524,7 @@ public final class Unsafe {
= theUnsafe.arrayBaseOffset(Object[].class);
/**
- * Report the scale factor for addressing elements in the storage
+ * Reports the scale factor for addressing elements in the storage
* allocation of a given array class. However, arrays of "narrow" types
* will generally not work properly with accessors like {@link
* #getByte(Object, long)}, so the scale factor for such classes is reported
@@ -576,7 +573,7 @@ public final class Unsafe {
= theUnsafe.arrayIndexScale(Object[].class);
/**
- * Report the size in bytes of a native pointer, as stored via {@link
+ * Reports the size in bytes of a native pointer, as stored via {@link
* #putAddress}. This value will be either 4 or 8. Note that the sizes of
* other primitive types (as stored in native memory blocks) is determined
* fully by their information content.
@@ -587,7 +584,7 @@ public final class Unsafe {
public static final int ADDRESS_SIZE = theUnsafe.addressSize();
/**
- * Report the size in bytes of a native memory page (whatever that is).
+ * Reports the size in bytes of a native memory page (whatever that is).
* This value will always be a power of two.
*/
public native int pageSize();
@@ -596,7 +593,7 @@ public final class Unsafe {
/// random trusted operations from JNI:
/**
- * Tell the VM to define a class, without security checks. By default, the
+ * Tells the VM to define a class, without security checks. By default, the
* class loader and protection domain come from the caller's class.
*/
public native Class> defineClass(String name, byte[] b, int off, int len,
@@ -604,7 +601,7 @@ public final class Unsafe {
ProtectionDomain protectionDomain);
/**
- * Define a class but do not make it known to the class loader or system dictionary.
+ * Defines a class but does not make it known to the class loader or system dictionary.
*
* For each CP entry, the corresponding CP patch must either be null or have
* the a format that matches its tag:
@@ -621,38 +618,38 @@ public final class Unsafe {
*/
public native Class> defineAnonymousClass(Class> hostClass, byte[] data, Object[] cpPatches);
-
- /** Allocate an instance but do not run any constructor.
- Initializes the class if it has not yet been. */
+ /**
+ * Allocates an instance but does not run any constructor.
+ * Initializes the class if it has not yet been.
+ */
public native Object allocateInstance(Class> cls)
throws InstantiationException;
- /** Throw the exception without telling the verifier. */
+ /** Throws the exception without telling the verifier. */
public native void throwException(Throwable ee);
-
/**
- * Atomically update Java variable to x if it is currently
- * holding expected.
- * @return true if successful
+ * Atomically updates Java variable to {@code x} if it is currently
+ * holding {@code expected}.
+ * @return {@code true} if successful
*/
public final native boolean compareAndSwapObject(Object o, long offset,
Object expected,
Object x);
/**
- * Atomically update Java variable to x if it is currently
- * holding expected.
- * @return true if successful
+ * Atomically updates Java variable to {@code x} if it is currently
+ * holding {@code expected}.
+ * @return {@code true} if successful
*/
public final native boolean compareAndSwapInt(Object o, long offset,
int expected,
int x);
/**
- * Atomically update Java variable to x if it is currently
- * holding expected.
- * @return true if successful
+ * Atomically updates Java variable to {@code x} if it is currently
+ * holding {@code expected}.
+ * @return {@code true} if successful
*/
public final native boolean compareAndSwapLong(Object o, long offset,
long expected,
@@ -736,28 +733,28 @@ public final class Unsafe {
public native void putOrderedLong(Object o, long offset, long x);
/**
- * Unblock the given thread blocked on park, or, if it is
- * not blocked, cause the subsequent call to park not to
+ * Unblocks the given thread blocked on {@code park}, or, if it is
+ * not blocked, causes the subsequent call to {@code park} not to
* block. Note: this operation is "unsafe" solely because the
* caller must somehow ensure that the thread has not been
* destroyed. Nothing special is usually required to ensure this
* when called from Java (in which there will ordinarily be a live
* reference to the thread) but this is not nearly-automatically
* so when calling from native code.
- * @param thread the thread to unpark.
*
+ * @param thread the thread to unpark.
*/
public native void unpark(Object thread);
/**
- * Block current thread, returning when a balancing
- * unpark occurs, or a balancing unpark has
+ * Blocks current thread, returning when a balancing
+ * {@code unpark} occurs, or a balancing {@code unpark} has
* already occurred, or the thread is interrupted, or, if not
* absolute and time is not zero, the given time nanoseconds have
* elapsed, or if absolute, the given deadline in milliseconds
* since Epoch has passed, or spuriously (i.e., returning for no
* "reason"). Note: This operation is in the Unsafe class only
- * because unpark is, so it would be strange to place it
+ * because {@code unpark} is, so it would be strange to place it
* elsewhere.
*/
public native void park(boolean isAbsolute, long time);
@@ -765,8 +762,8 @@ public final class Unsafe {
/**
* Gets the load average in the system run queue assigned
* to the available processors averaged over various periods of time.
- * This method retrieves the given nelem samples and
- * assigns to the elements of the given loadavg array.
+ * This method retrieves the given {@code nelem} samples and
+ * assigns to the elements of the given {@code loadavg} array.
* The system imposes a maximum of 3 samples, representing
* averages over the last 1, 5, and 15 minutes, respectively.
*
@@ -784,8 +781,8 @@ public final class Unsafe {
/**
* Atomically adds the given value to the current value of a field
- * or array element within the given object o
- * at the given offset.
+ * or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -803,8 +800,8 @@ public final class Unsafe {
/**
* Atomically adds the given value to the current value of a field
- * or array element within the given object o
- * at the given offset.
+ * or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -822,8 +819,8 @@ public final class Unsafe {
/**
* Atomically exchanges the given value with the current value of
- * a field or array element within the given object o
- * at the given offset.
+ * a field or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -841,8 +838,8 @@ public final class Unsafe {
/**
* Atomically exchanges the given value with the current value of
- * a field or array element within the given object o
- * at the given offset.
+ * a field or array element within the given object {@code o}
+ * at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
@@ -861,7 +858,7 @@ public final class Unsafe {
/**
* Atomically exchanges the given reference value with the current
* reference value of a field or array element within the given
- * object o at the given offset.
+ * object {@code o} at the given {@code offset}.
*
* @param o object/array to update the field/element in
* @param offset field/element offset
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
index 3b8ff0c09af..9d70053d35f 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -244,7 +244,9 @@ public abstract class AbstractDelegateHttpsURLConnection extends
public java.security.cert.Certificate[] getServerCertificates()
throws SSLPeerUnverifiedException {
if (cachedResponse != null) {
- List l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
+ List l =
+ ((SecureCacheResponse)cachedResponse)
+ .getServerCertificateChain();
if (l == null) {
return null;
} else {
@@ -262,7 +264,12 @@ public abstract class AbstractDelegateHttpsURLConnection extends
/**
* Returns the server's X.509 certificate chain, or null if
* the server did not authenticate.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getServerCertificates()} instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate[] getServerCertificateChain()
throws SSLPeerUnverifiedException {
if (cachedResponse != null) {
@@ -271,7 +278,7 @@ public abstract class AbstractDelegateHttpsURLConnection extends
if (http == null) {
throw new IllegalStateException("connection not yet open");
} else {
- return ((HttpsClient)http).getServerCertificateChain ();
+ return ((HttpsClient)http).getServerCertificateChain();
}
}
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java
index 30e9fb0840a..5bc55ed9e50 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -699,7 +699,12 @@ final class HttpsClient extends HttpClient
/**
* Returns the X.509 certificate chain with which the server
* authenticated itself, or null if the server did not authenticate.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getServerCertificates()} instead.
*/
+ @Deprecated
javax.security.cert.X509Certificate [] getServerCertificateChain()
throws SSLPeerUnverifiedException
{
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
index c3067c044e0..5477b2cab80 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -204,7 +204,12 @@ public class HttpsURLConnectionImpl
* NOTE: This method is not necessary for the version of this class
* implementing javax.net.ssl.HttpsURLConnection, but provided for
* compatibility with the com.sun.net.ssl.HttpsURLConnection version.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getServerCertificates()} instead.
*/
+ @Deprecated
public javax.security.cert.X509Certificate[] getServerCertificateChain() {
try {
return delegate.getServerCertificateChain();
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java
index 7f1577beb83..cb4f54eb125 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java
@@ -1569,6 +1569,9 @@ final class ClientHandshaker extends Handshaker {
/*
* Returns the subject alternative name of the specified type in the
* subjectAltNames extension of a certificate.
+ *
+ * Note that only those subjectAltName types that use String data
+ * should be passed into this function.
*/
private static Collection getSubjectAltNames(
Collection> subjectAltNames, int type) {
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java
index b5f304b6b97..881c4bf82fb 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -464,8 +464,13 @@ final class SSLSessionImpl extends ExtendedSSLSession {
*
* @return array of peer X.509 certs, with the peer's own cert
* first in the chain, and with the "root" CA last.
+ *
+ * @deprecated This method returns the deprecated
+ * {@code javax.security.cert.X509Certificate} type.
+ * Use {@code getPeerCertificates()} instead.
*/
@Override
+ @Deprecated
public javax.security.cert.X509Certificate[] getPeerCertificateChain()
throws SSLPeerUnverifiedException {
//
diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c
index 27e828fd60a..846e6835855 100644
--- a/jdk/src/java.base/share/native/libjli/java.c
+++ b/jdk/src/java.base/share/native/libjli/java.c
@@ -661,15 +661,24 @@ SetJvmEnvironment(int argc, char **argv) {
* arguments are for the application (i.e. the main class name, or
* the -jar argument).
*/
- if ((i > 0 && *arg != '-')
- || JLI_StrCmp(arg, "-version") == 0
- || JLI_StrCmp(arg, "-fullversion") == 0
- || JLI_StrCmp(arg, "-help") == 0
- || JLI_StrCmp(arg, "-?") == 0
- || JLI_StrCmp(arg, "-jar") == 0
- || JLI_StrCmp(arg, "-X") == 0
- ) {
- return;
+ if (i > 0) {
+ char *prev = argv[i - 1];
+ // skip non-dash arg preceded by class path specifiers
+ if (*arg != '-' &&
+ ((JLI_StrCmp(prev, "-cp") == 0
+ || JLI_StrCmp(prev, "-classpath") == 0))) {
+ continue;
+ }
+
+ if (*arg != '-'
+ || JLI_StrCmp(arg, "-version") == 0
+ || JLI_StrCmp(arg, "-fullversion") == 0
+ || JLI_StrCmp(arg, "-help") == 0
+ || JLI_StrCmp(arg, "-?") == 0
+ || JLI_StrCmp(arg, "-jar") == 0
+ || JLI_StrCmp(arg, "-X") == 0) {
+ return;
+ }
}
/*
* The following case checks for "-XX:NativeMemoryTracking=value".
diff --git a/jdk/src/java.base/share/native/libjli/manifest_info.h b/jdk/src/java.base/share/native/libjli/manifest_info.h
index cd951d5cb9f..5f9773e0bca 100644
--- a/jdk/src/java.base/share/native/libjli/manifest_info.h
+++ b/jdk/src/java.base/share/native/libjli/manifest_info.h
@@ -32,13 +32,16 @@
* Zip file header signatures
*/
#define SIGSIZ 4 /* size of all header signatures */
-#define LOCSIG 0x04034b50L /* "PK\003\004" */
-#define EXTSIG 0x08074b50L /* "PK\007\008" */
-#define CENSIG 0x02014b50L /* "PK\001\002" */
-#define ENDSIG 0x06054b50L /* "PK\005\006" */
-#define ZIP64_ENDSIG 0x06064b50L /* "PK\006\006" */
-#define ZIP64_LOCSIG 0x07064b50L /* "PK\006\007" */
+#define PKZIP_SIGNATURE_AT(p, b2, b3) \
+ (((p)[0] == 'P') & ((p)[1] == 'K') & ((p)[2] == b2) & ((p)[3] == b3))
+#define CENSIG_AT(p) PKZIP_SIGNATURE_AT(p, 1, 2)
+#define LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 3, 4)
+#define ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 5, 6)
+#define EXTSIG_AT(p) PKZIP_SIGNATURE_AT(p, 7, 8)
+#define ZIP64_ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 6)
+#define ZIP64_LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 7)
+
/*
* Header sizes including signatures
*/
diff --git a/jdk/src/java.base/share/native/libjli/parse_manifest.c b/jdk/src/java.base/share/native/libjli/parse_manifest.c
index a8e17b89b25..9ce82c1a1d6 100644
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c
@@ -138,7 +138,7 @@ find_end64(int fd, Byte *ep, jlong pos)
return -1;
if ((bytes = read(fd, ep, ZIP64_LOCHDR)) < 0)
return -1;
- if (GETSIG(ep) == ZIP64_LOCSIG)
+ if (ZIP64_LOCSIG_AT(ep))
return end64pos;
return -1;
}
@@ -176,7 +176,7 @@ find_end(int fd, Byte *eb)
return (-1);
if ((bytes = read(fd, eb, ENDHDR)) < 0)
return (-1);
- if (GETSIG(eb) == ENDSIG) {
+ if (ENDSIG_AT(eb)) {
return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
}
@@ -200,14 +200,11 @@ find_end(int fd, Byte *eb)
/*
* Search backwards from the end of file stopping when the END header
- * signature is found. (The first condition of the "if" is just a
- * fast fail, because the GETSIG macro isn't always cheap. The
- * final condition protects against false positives.)
+ * signature is found.
*/
endpos = &buffer[bytes];
for (cp = &buffer[bytes - ENDHDR]; cp >= &buffer[0]; cp--)
- if ((*cp == (ENDSIG & 0xFF)) && (GETSIG(cp) == ENDSIG) &&
- (cp + ENDHDR + ENDCOM(cp) == endpos)) {
+ if (ENDSIG_AT(cp) && (cp + ENDHDR + ENDCOM(cp) == endpos)) {
(void) memcpy(eb, cp, ENDHDR);
free(buffer);
pos = flen - (endpos - cp);
@@ -267,7 +264,7 @@ compute_cen(int fd, Byte *bp)
if ((bytes = read(fd, buffer, MINREAD)) < 0) {
return (-1);
}
- if (GETSIG(buffer) != ZIP64_ENDSIG) {
+ if (!ZIP64_ENDSIG_AT(buffer)) {
return -1;
}
if ((offset = ZIP64_ENDOFF(buffer)) < (jlong)0) {
@@ -356,7 +353,7 @@ find_file(int fd, zentry *entry, const char *file_name)
* Loop through the Central Directory Headers. Note that a valid zip/jar
* must have an ENDHDR (with ENDSIG) after the Central Directory.
*/
- while (GETSIG(p) == CENSIG) {
+ while (CENSIG_AT(p)) {
/*
* If a complete header isn't in the buffer, shift the contents
@@ -403,7 +400,7 @@ find_file(int fd, zentry *entry, const char *file_name)
free(buffer);
return (-1);
}
- if (GETSIG(locbuf) != LOCSIG) {
+ if (!LOCSIG_AT(locbuf)) {
free(buffer);
return (-1);
}
diff --git a/jdk/src/java.base/share/native/libzip/zip_util.c b/jdk/src/java.base/share/native/libzip/zip_util.c
index 51ee1d5276f..d99a5cd66a7 100644
--- a/jdk/src/java.base/share/native/libzip/zip_util.c
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c
@@ -281,9 +281,9 @@ static jboolean verifyEND(jzfile *zip, jlong endpos, char *endbuf) {
return (cenpos >= 0 &&
locpos >= 0 &&
readFullyAt(zip->zfd, buf, sizeof(buf), cenpos) != -1 &&
- GETSIG(buf) == CENSIG &&
+ CENSIG_AT(buf) &&
readFullyAt(zip->zfd, buf, sizeof(buf), locpos) != -1 &&
- GETSIG(buf) == LOCSIG);
+ LOCSIG_AT(buf));
}
/*
@@ -674,7 +674,7 @@ readCEN(jzfile *zip, jint knownTotal)
method = CENHOW(cp);
nlen = CENNAM(cp);
- if (GETSIG(cp) != CENSIG)
+ if (!CENSIG_AT(cp))
ZIP_FORMAT_ERROR("invalid CEN header (bad signature)");
if (CENFLG(cp) & 1)
ZIP_FORMAT_ERROR("invalid CEN header (encrypted entry)");
@@ -827,10 +827,7 @@ ZIP_Put_In_Cache0(const char *name, ZFILE zfd, char **pmsg, jlong lastModified,
// Assumption, zfd refers to start of file. Trivially, reuse errbuf.
if (readFully(zfd, errbuf, 4) != -1) { // errors will be handled later
- if (GETSIG(errbuf) == LOCSIG)
- zip->locsig = JNI_TRUE;
- else
- zip->locsig = JNI_FALSE;
+ zip->locsig = LOCSIG_AT(errbuf) ? JNI_TRUE : JNI_FALSE;
}
len = zip->len = IO_Lseek(zfd, 0, SEEK_END);
@@ -1284,7 +1281,7 @@ ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry)
zip->msg = "error reading zip file";
return -1;
}
- if (GETSIG(loc) != LOCSIG) {
+ if (!LOCSIG_AT(loc)) {
zip->msg = "invalid LOC header (bad signature)";
return -1;
}
diff --git a/jdk/src/java.base/share/native/libzip/zip_util.h b/jdk/src/java.base/share/native/libzip/zip_util.h
index 1287d3aa29e..1f5f3bd6cab 100644
--- a/jdk/src/java.base/share/native/libzip/zip_util.h
+++ b/jdk/src/java.base/share/native/libzip/zip_util.h
@@ -33,13 +33,14 @@
/*
* Header signatures
*/
-#define LOCSIG 0x04034b50L /* "PK\003\004" */
-#define EXTSIG 0x08074b50L /* "PK\007\008" */
-#define CENSIG 0x02014b50L /* "PK\001\002" */
-#define ENDSIG 0x06054b50L /* "PK\005\006" */
-
-#define ZIP64_ENDSIG 0x06064b50L /* "PK\006\006" */
-#define ZIP64_LOCSIG 0x07064b50L /* "PK\006\007" */
+#define PKZIP_SIGNATURE_AT(p, b2, b3) \
+ (((p)[0] == 'P') & ((p)[1] == 'K') & ((p)[2] == b2) & ((p)[3] == b3))
+#define CENSIG_AT(p) PKZIP_SIGNATURE_AT(p, 1, 2)
+#define LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 3, 4)
+#define ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 5, 6)
+#define EXTSIG_AT(p) PKZIP_SIGNATURE_AT(p, 7, 8)
+#define ZIP64_ENDSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 6)
+#define ZIP64_LOCSIG_AT(p) PKZIP_SIGNATURE_AT(p, 6, 7)
/*
* Header sizes including signatures
diff --git a/jdk/src/java.base/unix/native/launcher/jexec.c b/jdk/src/java.base/unix/native/launcher/jexec.c
index a30617de7b9..179ae4f893c 100644
--- a/jdk/src/java.base/unix/native/launcher/jexec.c
+++ b/jdk/src/java.base/unix/native/launcher/jexec.c
@@ -323,7 +323,7 @@ const char * isJar(const char * path) {
result = BAD_MAGIC_MSG;
// be sure the file is at least a ZIP file
- if (GETSIG(buf) == LOCSIG) {
+ if (LOCSIG_AT(buf)) {
off_t flen = LOCNAM(buf);
off_t xlen = LOCEXT(buf);
diff --git a/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c b/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
index 2308a59b44b..c245045696e 100644
--- a/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
+++ b/jdk/src/java.base/windows/native/libnet/NetworkInterface_winXP.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
#include /* needed for htonl */
#include
#include
+#include
#include "java_net_NetworkInterface.h"
#include "jni_util.h"
@@ -70,7 +71,7 @@ void printnifs (netif *netifPP, char *str) {
#endif
-static int bufsize = 1024;
+static int bufsize = 4096;
/*
* return an array of IP_ADAPTER_ADDRESSES containing one element
@@ -102,7 +103,11 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (ret == ERROR_BUFFER_OVERFLOW) {
- IP_ADAPTER_ADDRESSES * newAdapterInfo =
+ IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
+ if (len < (ULONG_MAX - bufsize)) {
+ len = len + bufsize;
+ }
+ newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (newAdapterInfo == NULL) {
free(adapterInfo);
@@ -113,7 +118,6 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
adapterInfo = newAdapterInfo;
- bufsize = len;
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
@@ -176,7 +180,11 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
flags |= GAA_FLAG_INCLUDE_PREFIX;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (val == ERROR_BUFFER_OVERFLOW) {
- IP_ADAPTER_ADDRESSES * newAdapterInfo =
+ IP_ADAPTER_ADDRESSES * newAdapterInfo = NULL;
+ if (len < (ULONG_MAX - bufsize)) {
+ len = len + bufsize;
+ }
+ newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (newAdapterInfo == NULL) {
free(adapterInfo);
@@ -187,7 +195,6 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
adapterInfo = newAdapterInfo;
- bufsize = len;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
}
diff --git a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
index 3b7b47f30cf..beb0b0fa1a9 100644
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -489,6 +489,8 @@ public abstract class Preferences {
* MAX_VALUE_LENGTH.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
+ * @throws IllegalArgumentException if either the key or the value contain
+ * the null control character, code point U+0000.
*/
public abstract void put(String key, String value);
diff --git a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
index ebbca48a255..7bcd1d3ad24 100644
--- a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
+++ b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,13 @@ import sun.util.logging.PlatformLogger;
*/
class FileSystemPreferences extends AbstractPreferences {
+ /**
+ * The code point U+0000, assigned to the null control character, is the
+ * only character encoded in Unicode and ISO/IEC 10646 that is always
+ * invalid in any XML 1.0 and 1.1 document.
+ */
+ private static final String CODE_POINT_U0000 = String.valueOf('\u0000');
+
static {
PrivilegedAction load = () -> {
System.loadLibrary("prefs");
@@ -525,6 +532,11 @@ class FileSystemPreferences extends AbstractPreferences {
}
protected void putSpi(String key, String value) {
+ if (key.indexOf(CODE_POINT_U0000) != -1) {
+ throw new IllegalArgumentException("Key contains code point U+0000");
+ } else if (value.indexOf(CODE_POINT_U0000) != -1) {
+ throw new IllegalArgumentException("Value contains code point U+0000");
+ }
initCacheIfNecessary();
changeLog.add(new Put(key, value));
prefsCache.put(key, value);
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
index 351b3a9a674..f1a7f16d24d 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
@@ -52,7 +52,7 @@ import java.util.List;
*
* XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
* Reference ref = factory.newReference("#reference-1", DigestMethod.SHA1);
- * List references = Collections.singletonList(ref);
+ * List<Reference> references = Collections.singletonList(ref);
* Manifest manifest = factory.newManifest(references, "manifest-1");
*
*
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
index 572be86f207..4117c8b1901 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
@@ -65,7 +65,7 @@ import javax.xml.crypto.XMLStructure;
*
* XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
* Manifest manifest = fac.newManifest(references);
- * List content = Collections.singletonList(manifest);
+ * List<XMLStructure> content = Collections.singletonList(manifest);
* XMLObject object = factory.newXMLObject(content, "object-1", null, null);
*
*
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSigner.java b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSigner.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSigner.java
rename to jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSigner.java
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSignerParameters.java b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/jarsigner/ContentSignerParameters.java
rename to jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/ContentSignerParameters.java
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/jarsigner/package-info.java b/jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/package-info.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/jarsigner/package-info.java
rename to jdk/src/jdk.jartool/share/classes/com/sun/jarsigner/package-info.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_ja.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_ja.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java b/jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
rename to jdk/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/TimestampedSigner.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/CommandLine.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/CommandLine.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/CommandLine.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/CommandLine.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/JarException.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/JarException.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/JarException.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/JarException.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/Main.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/Manifest.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Manifest.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/Manifest.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/Manifest.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/SignatureFile.java b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/SignatureFile.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/SignatureFile.java
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/SignatureFile.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_de.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_de.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_es.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_es.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_fr.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_fr.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_it.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_it.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ja.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ja.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ko.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_ko.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_pt_BR.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_pt_BR.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_sv.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_sv.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_CN.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_CN.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties
diff --git a/jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_TW.properties b/jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/tools/jar/resources/jar_zh_TW.properties
rename to jdk/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties
diff --git a/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java b/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java
index f80df887abf..c9a520a8388 100644
--- a/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java
+++ b/jdk/src/jdk.localedata/share/classes/sun/text/resources/fi/FormatData_fi.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -295,8 +295,8 @@ public class FormatData_fi extends ParallelListResourceBundle {
},
{ "DatePatterns",
new String[] {
- "d. MMMM'ta 'yyyy", // full date pattern
- "d. MMMM'ta 'yyyy", // long date pattern
+ "d. MMMM yyyy", // full date pattern
+ "d. MMMM yyyy", // long date pattern
"d.M.yyyy", // medium date pattern
"d.M.yyyy", // short date pattern
}
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bands.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/bands.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bands.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/bands.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bands.h b/jdk/src/jdk.pack200/share/native/common-unpack/bands.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bands.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/bands.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bytes.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/bytes.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bytes.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/bytes.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/bytes.h b/jdk/src/jdk.pack200/share/native/common-unpack/bytes.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/bytes.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/bytes.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/coding.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/coding.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/coding.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/coding.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/coding.h b/jdk/src/jdk.pack200/share/native/common-unpack/coding.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/coding.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/coding.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/constants.h b/jdk/src/jdk.pack200/share/native/common-unpack/constants.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/constants.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/constants.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/defines.h b/jdk/src/jdk.pack200/share/native/common-unpack/defines.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/defines.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/defines.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/unpack.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/unpack.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/unpack.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/unpack.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/unpack.h b/jdk/src/jdk.pack200/share/native/common-unpack/unpack.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/unpack.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/unpack.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/utils.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/utils.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/utils.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/utils.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/utils.h b/jdk/src/jdk.pack200/share/native/common-unpack/utils.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/utils.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/utils.h
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/zip.cpp b/jdk/src/jdk.pack200/share/native/common-unpack/zip.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/zip.cpp
rename to jdk/src/jdk.pack200/share/native/common-unpack/zip.cpp
diff --git a/jdk/src/jdk.runtime/share/native/common-unpack/zip.h b/jdk/src/jdk.pack200/share/native/common-unpack/zip.h
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/common-unpack/zip.h
rename to jdk/src/jdk.pack200/share/native/common-unpack/zip.h
diff --git a/jdk/src/jdk.runtime/share/native/libunpack/jni.cpp b/jdk/src/jdk.pack200/share/native/libunpack/jni.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/libunpack/jni.cpp
rename to jdk/src/jdk.pack200/share/native/libunpack/jni.cpp
diff --git a/jdk/src/jdk.runtime/share/native/unpack200/main.cpp b/jdk/src/jdk.pack200/share/native/unpack200/main.cpp
similarity index 100%
rename from jdk/src/jdk.runtime/share/native/unpack200/main.cpp
rename to jdk/src/jdk.pack200/share/native/unpack200/main.cpp
diff --git a/jdk/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest b/jdk/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest
similarity index 100%
rename from jdk/src/jdk.runtime/windows/native/unpack200/unpack200_proto.exe.manifest
rename to jdk/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/PolicyTool.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/PolicyTool.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/PolicyTool.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_de.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_de.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_de.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_de.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_es.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_es.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_es.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_es.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_fr.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_fr.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_fr.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_fr.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_it.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_it.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_it.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_it.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ja.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ja.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ja.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ja.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ko.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ko.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_ko.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_ko.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_pt_BR.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_pt_BR.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_sv.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_sv.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_sv.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_sv.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_CN.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_CN.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_HK.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_HK.java
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_TW.java b/jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
rename to jdk/src/jdk.policytool/share/classes/sun/security/tools/policytool/Resources_zh_TW.java
diff --git a/jdk/test/TEST.ROOT b/jdk/test/TEST.ROOT
index 6df529bccbd..20863c62a87 100644
--- a/jdk/test/TEST.ROOT
+++ b/jdk/test/TEST.ROOT
@@ -5,7 +5,7 @@
keys=2d dnd i18n
# Tests that must run in othervm mode
-othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces
+othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces javax/xml/jaxp/testng/validation
# Tests that cannot run concurrently
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/Dynamic.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/Dynamic.java
new file mode 100644
index 00000000000..3aa6d29e8fe
--- /dev/null
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/Dynamic.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.PrintStream;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
+import java.util.Random;
+
+import javax.crypto.Cipher;
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.IvParameterSpec;
+
+public class Dynamic {
+
+ static final String ALGORITHM = "AES";
+ static final String[] MODE = {
+ "ECb", "CbC", "CTR", "PCBC", "OFB", "OFB150", "cFB", "CFB7",
+ "cFB8", "cFB16", "cFB24", "cFB32", "Cfb40", "cfB48", "cfB56",
+ "cfB64", "cfB72", "cfB80", "cfB88", "cfB96", "cfb104", "cfB112",
+ "cfB120", "cfB128", "OFB8", "OFB16", "OFB24", "OFB32", "OFB40",
+ "OFB48", "OFB56", "OFB64", "OFB72", "OFB80", "OFB88", "OFB96",
+ "OFB104", "OFB112", "OFB120", "OFB128", "GCM"
+ };
+ static final String[] PADDING = {
+ "NoPadding", "PKCS5Padding", "ISO10126Padding"
+ };
+ static final String SUNJCE = "SunJCE";
+
+ Cipher ci = null;
+ byte[] iv = null;
+ AlgorithmParameterSpec aps = null;
+ SecretKey key = null;
+ int keyStrength;
+ static int DefaultSize = 128;
+
+ public void run(String[] argv) throws Exception {
+ if (!runAllTest(argv, System.out)) {
+ throw new Exception("Test Failed");
+ }
+ }
+
+ protected boolean runAllTest(String argv[], PrintStream out) {
+ boolean result = true;
+ StringBuilder failedList = new StringBuilder();
+ int failedCnt = 0;
+ int testCount = 0;
+ int padKinds; // how many kinds of padding mode such as PKCS5padding and
+ // NoPadding.
+
+ try {
+ for (int i = 0; i < 3; i++) {
+ keyStrength = DefaultSize + i * 64; // obtain the key size 128,
+ // 192, 256
+
+ for (int j = 0; j < MODE.length; j++) {
+ if (MODE[j].equalsIgnoreCase("ECB")
+ || MODE[j].equalsIgnoreCase("PCBC")
+ || MODE[j].equalsIgnoreCase("CBC")) {
+ padKinds = PADDING.length;
+ } else {
+ padKinds = 1;
+ }
+
+ for (int k = 0; k < padKinds; k++) {
+ testCount++;
+ try {
+ if (!runTest(ALGORITHM, MODE[j], PADDING[k])) {
+ result = false;
+ failedCnt++;
+ failedList.append(ALGORITHM + "/" + MODE[j]
+ + "/" + PADDING[k] + " ");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ result = false;
+ failedCnt++;
+ failedList.append(ALGORITHM + "/" + MODE[j] + "/"
+ + PADDING[k] + " ");
+ }
+
+ }
+ }
+ }
+
+ if (result) {
+ out.println("STATUS:Passed. Test " + testCount
+ + " cases, All Passed");
+ return true;
+ }
+ out.println("STATUS:Failed. " + failedCnt + " Failed: "
+ + failedList);
+ return false;
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ out.println("STATUS:Failed. Unexpected Exception: " + ex);
+ return false;
+ }
+ }
+
+ protected boolean runTest(String algo, String mo, String pad)
+ throws Exception {
+ boolean result = true;
+ try {
+ byte[] plainText = new byte[160000];
+ new Random().nextBytes(plainText);
+
+ String transformation = algo + "/" + mo + "/" + pad;
+ ci = Cipher.getInstance(transformation, SUNJCE);
+ KeyGenerator kg = KeyGenerator.getInstance(algo, SUNJCE);
+ if (keyStrength > Cipher.getMaxAllowedKeyLength(transformation)) {
+ // skip if this key length is larger than what's
+ // configured in the jce jurisdiction policy files
+ System.out.println(keyStrength
+ + " is larger than what's configured "
+ + "in the jce jurisdiction policy files");
+ return result;
+ }
+ kg.init(keyStrength);
+ key = kg.generateKey();
+
+ if (!mo.equalsIgnoreCase("GCM")) {
+ ci.init(Cipher.ENCRYPT_MODE, key, aps);
+ } else {
+ ci.init(Cipher.ENCRYPT_MODE, key);
+ }
+ byte[] cipherText = new byte[ci.getOutputSize(plainText.length)];
+ int offset = ci.update(plainText, 0, plainText.length, cipherText,
+ 0);
+ ci.doFinal(cipherText, offset);
+
+ if (!mo.equalsIgnoreCase("ECB")) {
+ iv = ci.getIV();
+ aps = new IvParameterSpec(iv);
+ } else {
+ aps = null;
+ }
+
+ if (!mo.equalsIgnoreCase("GCM")) {
+ ci.init(Cipher.DECRYPT_MODE, key, aps);
+ } else {
+ ci.init(Cipher.DECRYPT_MODE, key, ci.getParameters());
+ }
+ byte[] recoveredText = new byte[ci.getOutputSize(cipherText.length)];
+ int len = ci.doFinal(cipherText, 0, cipherText.length,
+ recoveredText);
+
+ byte[] tmp = new byte[len];
+ for (int i = 0; i < len; i++) {
+ tmp[i] = recoveredText[i];
+ }
+
+ result = Arrays.equals(plainText, tmp);
+ } catch (NoSuchAlgorithmException nsaEx) {
+ nsaEx.printStackTrace();
+ // CFB7 and OFB150 are negative test,SunJCE not support this
+ // algorithm
+ result = mo.equalsIgnoreCase("CFB7")
+ || mo.equalsIgnoreCase("OFB150");
+
+ }
+ return result;
+ }
+}
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java
new file mode 100644
index 00000000000..132e79d9a35
--- /dev/null
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithDefaultProvider.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes with
+ * default provider
+ */
+
+public class TestAESWithDefaultProvider extends Dynamic {
+ public static void main(String argv[]) throws Exception {
+ new TestAESWithDefaultProvider().run(argv);
+ }
+}
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java
new file mode 100644
index 00000000000..8dec9f136a4
--- /dev/null
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java
@@ -0,0 +1,39 @@
+/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.Security;
+
+/*
+ * @test
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes after
+ * remove then add provider.
+ * @run main/othervm/policy=testAES.policy TestAESWithProviderChange
+ */
+
+public class TestAESWithProviderChange extends Dynamic {
+ public static void main(String argv[]) throws Exception {
+ Security.removeProvider(SUNJCE);
+ Security.addProvider(new com.sun.crypto.provider.SunJCE());
+ new TestAESWithProviderChange().run(argv);
+ }
+}
diff --git a/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java
similarity index 53%
rename from langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java
rename to jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java
index ef809e96074..81761a7ea4b 100644
--- a/langtools/test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,33 +21,22 @@
* questions.
*/
+import java.security.*;
+import java.security.Provider;
+
/*
* @test
- * @bug 7001086
- * @summary Test Non-frame warning.
- * @author Bhavesh Patel
- * @library ../lib
- * @build JavadocTester
- * @run main TestNonFrameWarning
+ * @bug 8044193
+ * @summary Test AES ciphers with different modes and padding schemes after
+ * remove default provider then add it back.
+ * @run main/othervm/policy=testAES.policy TestAESWithRemoveAddProvider
*/
-public class TestNonFrameWarning extends JavadocTester {
-
- public static void main(String... args) throws Exception {
- TestNonFrameWarning tester = new TestNonFrameWarning();
- tester.runTests();
- }
-
- @Test
- void test() {
- javadoc("-d", "out",
- "-sourcepath", testSrc,
- "pkg");
- checkExit(Exit.OK);
-
- checkOutput("index.html", true,
- "This document is designed to be viewed using the frames feature. "
- + "If you see this message, you are using a non-frame-capable web client. "
- + "Link to Non-frame version.
");
+public class TestAESWithRemoveAddProvider extends Dynamic {
+ public static void main(String argv[]) throws Exception {
+ Provider pJCE = Security.getProvider(SUNJCE);
+ Security.removeProvider(SUNJCE);
+ Security.addProvider(pJCE);
+ new TestAESWithRemoveAddProvider().run(argv);
}
}
diff --git a/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy
new file mode 100644
index 00000000000..a138a577ff7
--- /dev/null
+++ b/jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/testAES.policy
@@ -0,0 +1,6 @@
+grant
+{
+ permission java.security.SecurityPermission "removeProvider.SunJCE";
+ permission java.security.SecurityPermission "insertProvider.SunJCE";
+ permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+};
diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java
index 03d165f7111..cfc4d443ff8 100644
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java
@@ -26,7 +26,7 @@
* @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
* 5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
* 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
- * 4947220 7018606 7034570 4244896 5049299 8003488 8054494
+ * 4947220 7018606 7034570 4244896 5049299 8003488 8054494 8058464
* @summary Basic tests for Process and Environment Variable code
* @run main/othervm/timeout=300 Basic
* @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
@@ -941,6 +941,14 @@ public class Basic {
() -> pb.redirectOutput(Redirect.from(ifile)),
() -> pb.redirectError(Redirect.from(ifile)));
+ THROWS(NullPointerException.class,
+ () -> pb.redirectInput((File)null),
+ () -> pb.redirectOutput((File)null),
+ () -> pb.redirectError((File)null),
+ () -> pb.redirectInput((Redirect)null),
+ () -> pb.redirectOutput((Redirect)null),
+ () -> pb.redirectError((Redirect)null));
+
THROWS(IOException.class,
// Input file does not exist
() -> pb.start());
diff --git a/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java
new file mode 100644
index 00000000000..05f9f1942ff
--- /dev/null
+++ b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkAgent.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8046246
+ * @summary Tests and benchmarks the JVMTI RedefineClasses when a
+ * single class (and its parent) contains many methods.
+ *
+ * @run build ManyMethodsBenchmarkApp ManyMethodsBenchmarkAgent
+ * @run shell MakeJAR3.sh ManyMethodsBenchmarkAgent 'Can-Retransform-Classes: true'
+ * @run main/othervm -javaagent:ManyMethodsBenchmarkAgent.jar ManyMethodsBenchmarkApp
+ */
+import java.lang.instrument.*;
+
+public class ManyMethodsBenchmarkAgent
+{
+ public static boolean fail = false;
+ public static boolean completed = false;
+ private static Instrumentation instrumentation;
+
+ public static void
+ premain( String agentArgs,
+ Instrumentation instrumentation) {
+ System.out.println("ManyMethodsBenchmarkAgent started");
+ ManyMethodsBenchmarkAgent.instrumentation = instrumentation;
+ System.out.println("ManyMethodsBenchmarkAgent finished");
+ }
+
+ static void instr() {
+ System.out.println("ManyMethodsBenchmarkAgent.instr started");
+
+ Class[] allClasses = instrumentation.getAllLoadedClasses();
+
+ for (int i = 0; i < allClasses.length; i++) {
+ Class klass = allClasses[i];
+ String name = klass.getName();
+ if (!name.equals("Base")) {
+ continue;
+ }
+ System.err.println("Instrumenting the class: " + klass);
+
+ try {
+ instrumentation.retransformClasses(klass);
+ } catch (Throwable e) {
+ System.err.println("Error: bad return from retransform: " + klass);
+ System.err.println(" ERROR: " + e);
+ fail = true;
+ }
+ }
+ completed = true;
+ System.out.println("ManyMethodsBenchmarkAgent.instr finished");
+ }
+
+}
diff --git a/jdk/test/java/lang/instrument/ManyMethodsBenchmarkApp.java b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkApp.java
new file mode 100644
index 00000000000..c85bf42b820
--- /dev/null
+++ b/jdk/test/java/lang/instrument/ManyMethodsBenchmarkApp.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2015 Google Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.List;
+import javax.tools.JavaCompiler;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+/**
+ * A manual benchmark of the JVMTI RedefineClasses when a
+ * single class (and its parent) contains many methods.
+ */
+public class ManyMethodsBenchmarkApp {
+ // Limit is 64k but we can not put such many as the CP limit is 32k.
+ // In practice, it means a real limit is much lower (less than 22000).
+ static final int METHOD_COUNT = 20000;
+
+ static Class> loadClassInNewClassLoader(String className) throws Exception {
+ URL[] urls = { new File(".").toURI().toURL() };
+ URLClassLoader ucl = new URLClassLoader(urls, null);
+ Class> klazz = Class.forName(className, true, ucl);
+ return klazz;
+ }
+
+ static void benchmarkClassOperations(String className) throws Exception {
+ Class> klazz = loadClassInNewClassLoader(className);
+
+ Method[] methods = klazz.getDeclaredMethods();
+ if (methods.length != METHOD_COUNT) {
+ throw new AssertionError("unexpected method count: " + methods.length +
+ " expected: " + METHOD_COUNT);
+ }
+
+ methods = klazz.getMethods();
+ // returned methods includes those inherited from Object
+ int objectMethodSlop = 100;
+ if (methods.length <= METHOD_COUNT ||
+ methods.length >= METHOD_COUNT + objectMethodSlop) {
+ throw new AssertionError("unexpected method count: " + methods.length);
+ }
+
+ // Invoke methods to make them appear in the constant pool cache
+ Object obj = klazz.newInstance();
+ Object[] args = new Object[0];
+ for (Method m: methods) {
+ try {
+ Class>[] types = m.getParameterTypes();
+ String name = m.getName();
+ // System.out.println("method: " + name + "; argno: " + types.length);
+ if (types.length == 0 && name.length() == 2 && name.startsWith("f")) {
+ m.invoke(obj, args);
+ }
+ } catch (InvocationTargetException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("test started: ManyMethodsBenchmarkApp");
+
+ // Create source files with many methods
+ File base = new File("Base.java");
+ try (FileWriter fw = new FileWriter(base)) {
+ fw.write("public class Base {\n");
+ final int L = 10;
+ // Each of the first L methods makes calls to its own chunk of METHOD_COUNT/L methods
+ for (int k = 0; k < L; k++) {
+ fw.write(" public void f" + k + "() {\n");
+ int shift = (k == 0) ? L : 0;
+ for (int i = (k * (METHOD_COUNT/L)) + shift; i < (k + 1) * METHOD_COUNT/L; i++) {
+ fw.write(" f" + i + "();\n");
+ }
+ fw.write(" }\n");
+ }
+
+ // The rest of (METHOD_COUNT - L) methods have empty body
+ for (int i = L; i < METHOD_COUNT; i++) {
+ fw.write(" public static void f" + i + "() {}\n");
+ }
+ fw.write("}\n");
+ }
+
+ // Compile the generated source files.
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ List files = Arrays.asList(new File[] { base });
+ try (StandardJavaFileManager fileManager =
+ compiler.getStandardFileManager(null, null, null)) {
+ compiler.getTask(null, fileManager, null, null, null,
+ fileManager.getJavaFileObjectsFromFiles(files))
+ .call();
+ }
+
+ benchmarkClassOperations("Base");
+
+ ManyMethodsBenchmarkAgent.instr();
+
+ // Cleanup
+ base.delete();
+ new File("Base.class").delete();
+ if (!ManyMethodsBenchmarkAgent.completed) {
+ throw new Exception("ERROR: ManyMethodsBenchmarkAgent did not complete.");
+ }
+
+ if (ManyMethodsBenchmarkAgent.fail) {
+ throw new Exception("ERROR: ManyMethodsBenchmarkAgent failed.");
+ } else {
+ System.out.println("ManyMethodsBenchmarkAgent succeeded.");
+ }
+ System.out.println("test finished: ManyMethodsBenchmarkApp");
+ }
+}
diff --git a/jdk/test/java/math/BigDecimal/StringConstructor.java b/jdk/test/java/math/BigDecimal/StringConstructor.java
index 992eb9dc1b8..c8051eb98a5 100644
--- a/jdk/test/java/math/BigDecimal/StringConstructor.java
+++ b/jdk/test/java/math/BigDecimal/StringConstructor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,19 +23,20 @@
/*
* @test
- * @bug 4103117 4331084 4488017 4490929 6255285 6268365
- * @summary Tests the BigDecimal string constructor.
+ * @library ..
+ * @bug 4103117 4331084 4488017 4490929 6255285 6268365 8074460
+ * @summary Tests the BigDecimal string constructor (use -Dseed=X to set PRNG seed).
*/
import java.math.*;
-import java.util.Random;
public class StringConstructor {
- private static int seed = new Random().nextInt();
- private static Random rnd = new Random(seed);
+ private static RandomSeed rndSeed = new RandomSeed(false);
public static void main(String[] args) throws Exception {
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+
constructWithError("");
constructWithError("+");
constructWithError("-");
@@ -71,19 +72,18 @@ public class StringConstructor {
// Roundtrip tests
for (int i=0; i<100; i++) {
- int size = rnd.nextInt(100) + 1;
- BigInteger bi = new BigInteger(size, rnd);
- if (rnd.nextBoolean())
+ int size = rndSeed.getRandom().nextInt(100) + 1;
+ BigInteger bi = new BigInteger(size, rndSeed.getRandom());
+ if (rndSeed.getRandom().nextBoolean())
bi = bi.negate();
int decimalLength = bi.toString().length();
- int scale = rnd.nextInt(decimalLength);
+ int scale = rndSeed.getRandom().nextInt(decimalLength);
BigDecimal bd = new BigDecimal(bi, scale);
String bdString = bd.toString();
// System.err.println("bi" + bi.toString() + "\tscale " + scale);
// System.err.println("bd string: " + bdString);
BigDecimal bdDoppel = new BigDecimal(bdString);
if (!bd.equals(bdDoppel)) {
- System.err.println("Random number seed = " + seed);
System.err.println("bd string: scale: " + bd.scale() +
"\t" + bdString);
System.err.println("bd doppel: scale: " + bdDoppel.scale() +
diff --git a/jdk/test/java/math/BigInteger/BigIntegerTest.java b/jdk/test/java/math/BigInteger/BigIntegerTest.java
index 4de80fad4fd..e1b36c0812b 100644
--- a/jdk/test/java/math/BigInteger/BigIntegerTest.java
+++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,9 @@
/*
* @test
- * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465
- * @summary tests methods in BigInteger
+ * @library ..
+ * @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465 8074460
+ * @summary tests methods in BigInteger (use -Dseed=X to set PRNG seed)
* @run main/timeout=400 BigIntegerTest
* @author madbot
*/
@@ -35,7 +36,6 @@ import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.math.BigInteger;
-import java.util.Random;
/**
* This is a simple test class created to ensure that the results
@@ -86,7 +86,8 @@ public class BigIntegerTest {
static final int SIZE = 1000; // numbers per batch
- static Random rnd = new Random();
+ private static RandomSeed rndSeed = new RandomSeed(false);
+
static boolean failure = false;
public static void constructor() {
@@ -97,7 +98,7 @@ public class BigIntegerTest {
int arrayLength = 23;
int halfLength = arrayLength/2;
byte[] array = new byte[arrayLength];
- rnd.nextBytes(array);
+ rndSeed.getRandom().nextBytes(array);
int[][] offLen = new int[][] { // offset, length, num exceptions
{-1, arrayLength, 1}, // negative offset
@@ -161,7 +162,7 @@ public class BigIntegerTest {
}
byte[] magNonZeroLength = new byte[42];
- rnd.nextBytes(magNonZeroLength);
+ rndSeed.getRandom().nextBytes(magNonZeroLength);
for (int signum = -1; signum <= 1; signum++) {
BigInteger bi = new BigInteger(signum, magNonZeroLength, 0, 0);
if (bi.compareTo(BigInteger.ZERO) != 0) {
@@ -174,13 +175,13 @@ public class BigIntegerTest {
for (int i = 0; i < SIZE; i++) {
// create reference value via a different code path from those tested
- BigInteger reference = new BigInteger(2 + rnd.nextInt(336), 4, rnd);
+ BigInteger reference = new BigInteger(2 + rndSeed.getRandom().nextInt(336), 4, rndSeed.getRandom());
byte[] refArray = reference.toByteArray();
int refLen = refArray.length;
- int factor = rnd.nextInt(5);
- int objLen = refArray.length + factor*rnd.nextInt(refArray.length) + 1;
- int offset = rnd.nextInt(objLen - refLen);
+ int factor = rndSeed.getRandom().nextInt(5);
+ int objLen = refArray.length + factor*rndSeed.getRandom().nextInt(refArray.length) + 1;
+ int offset = rndSeed.getRandom().nextInt(objLen - refLen);
byte[] objArray = new byte[objLen];
System.arraycopy(refArray, 0, objArray, offset, refLen);
@@ -191,7 +192,7 @@ public class BigIntegerTest {
failCount++;
}
- boolean isNegative = rnd.nextBoolean();
+ boolean isNegative = rndSeed.getRandom().nextBoolean();
BigInteger signMag = new BigInteger(isNegative ? -1 : 1, objArray, offset, refLen);
if (signMag.compareTo(isNegative ? reference.negate() : reference) != 0) {
System.err.println("Sign-magnitude BigInteger not equal for offset " +
@@ -208,7 +209,7 @@ public class BigIntegerTest {
for (int i=0; i= lower; bits--) {
for (int i = 0; i < 50; i++) {
- BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rnd));
+ BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rndSeed.getRandom()));
for (int radix = Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
String result = x.toString(radix);
@@ -764,9 +765,9 @@ public class BigIntegerTest {
int failCount = 0;
for (int i=0; i<10; i++) {
- BigInteger m = new BigInteger(100, 5, rnd);
+ BigInteger m = new BigInteger(100, 5, rndSeed.getRandom());
while(m.compareTo(BigInteger.ONE) != 1)
- m = new BigInteger(100, 5, rnd);
+ m = new BigInteger(100, 5, rndSeed.getRandom());
BigInteger exp = m.subtract(BigInteger.ONE);
BigInteger base = fetchNumber(order).abs();
while(base.compareTo(m) != -1)
@@ -826,7 +827,7 @@ public class BigIntegerTest {
// Test consistency
for(int i=0; i<10; i++) {
- p1 = BigInteger.probablePrime(100, rnd);
+ p1 = BigInteger.probablePrime(100, rndSeed.getRandom());
if (!p1.isProbablePrime(100)) {
System.err.println("Consistency "+p1.toString(16));
failCount++;
@@ -867,7 +868,7 @@ public class BigIntegerTest {
// Numbers of the form (6k+1)(12k+1)(18k+1) are Carmichael numbers if
// each of the factors is prime
int found = 0;
- BigInteger f1 = new BigInteger(40, 100, rnd);
+ BigInteger f1 = new BigInteger(40, 100, rndSeed.getRandom());
while (found < NUM_CARMICHAELS_TO_TEST) {
BigInteger k = null;
BigInteger f2, f3;
@@ -894,8 +895,8 @@ public class BigIntegerTest {
// Test some composites that are products of 2 primes
for (int i=0; i<50; i++) {
- p1 = BigInteger.probablePrime(100, rnd);
- p2 = BigInteger.probablePrime(100, rnd);
+ p1 = BigInteger.probablePrime(100, rndSeed.getRandom());
+ p2 = BigInteger.probablePrime(100, rndSeed.getRandom());
c1 = p1.multiply(p2);
if (c1.isProbablePrime(100)) {
System.err.println("Composite failed "+c1.toString(16));
@@ -904,8 +905,8 @@ public class BigIntegerTest {
}
for (int i=0; i<4; i++) {
- p1 = BigInteger.probablePrime(600, rnd);
- p2 = BigInteger.probablePrime(600, rnd);
+ p1 = BigInteger.probablePrime(600, rndSeed.getRandom());
+ p2 = BigInteger.probablePrime(600, rndSeed.getRandom());
c1 = p1.multiply(p2);
if (c1.isProbablePrime(100)) {
System.err.println("Composite failed "+c1.toString(16));
@@ -960,7 +961,7 @@ public class BigIntegerTest {
// Next, pick some large primes, use nextProbablePrime to find the
// next one, and make sure there are no primes in between
for (int i=0; i<100; i+=10) {
- p1 = BigInteger.probablePrime(50 + i, rnd);
+ p1 = BigInteger.probablePrime(50 + i, rndSeed.getRandom());
p2 = p1.add(ONE);
p3 = p1.nextProbablePrime();
while(p2.compareTo(p3) < 0) {
@@ -1025,7 +1026,7 @@ public class BigIntegerTest {
}
for(int i=0; i<10; i++) {
- BigInteger b1 = fetchNumber(rnd.nextInt(100));
+ BigInteger b1 = fetchNumber(rndSeed.getRandom().nextInt(100));
BigInteger b2 = null;
File f = new File("serialtest");
try (FileOutputStream fos = new FileOutputStream(f)) {
@@ -1059,6 +1060,7 @@ public class BigIntegerTest {
*
*/
public static void main(String[] args) throws Exception {
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
// Some variables for sizing test numbers in bits
int order1 = ORDER_MEDIUM;
@@ -1131,8 +1133,8 @@ public class BigIntegerTest {
* If order is less than 2, order is changed to 2.
*/
private static BigInteger fetchNumber(int order) {
- boolean negative = rnd.nextBoolean();
- int numType = rnd.nextInt(7);
+ boolean negative = rndSeed.getRandom().nextBoolean();
+ int numType = rndSeed.getRandom().nextInt(7);
BigInteger result = null;
if (order < 2) order = 2;
@@ -1156,14 +1158,14 @@ public class BigIntegerTest {
break;
case 3: // One bit in number
- result = BigInteger.ONE.shiftLeft(rnd.nextInt(order));
+ result = BigInteger.ONE.shiftLeft(rndSeed.getRandom().nextInt(order));
break;
case 4: // Random bit density
byte[] val = new byte[(order+7)/8];
- int iterations = rnd.nextInt(order);
+ int iterations = rndSeed.getRandom().nextInt(order);
for (int i=0; i 0) {
- int runLength = Math.min(remaining, rnd.nextInt(order));
+ int runLength = Math.min(remaining, rndSeed.getRandom().nextInt(order));
result = result.shiftLeft(runLength);
if (bit > 0)
result = result.add(ONE.shiftLeft(runLength).subtract(ONE));
@@ -1183,7 +1185,7 @@ public class BigIntegerTest {
break;
default: // random bits
- result = new BigInteger(order, rnd);
+ result = new BigInteger(order, rndSeed.getRandom());
}
if (negative)
diff --git a/jdk/test/java/math/BigInteger/ModPow65537.java b/jdk/test/java/math/BigInteger/ModPow65537.java
index ec962e2a5ff..f8e4a5422d1 100644
--- a/jdk/test/java/math/BigInteger/ModPow65537.java
+++ b/jdk/test/java/math/BigInteger/ModPow65537.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,13 @@
/*
* @test
- * @bug 4891312
- * @summary verify that modPow() not broken by the special case for 65537
+ * @library ..
+ * @bug 4891312 8074460
+ * @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed)
* @author Andreas Sterbenz
*/
import java.math.BigInteger;
-import java.util.*;
import java.security.*;
import java.security.spec.*;
@@ -78,7 +78,9 @@ public class ModPow65537 {
private static void testSigning(KeyPair kp) throws Exception {
System.out.println(kp.getPublic());
byte[] data = new byte[1024];
- new Random().nextBytes(data);
+ RandomSeed rndSeed = new RandomSeed(false);
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+ rndSeed.getRandom().nextBytes(data);
Signature sig = Signature.getInstance("SHA1withRSA", "SunRsaSign");
sig.initSign(kp.getPrivate());
diff --git a/jdk/test/java/math/BigInteger/PrimeTest.java b/jdk/test/java/math/BigInteger/PrimeTest.java
index 5f5affeb240..fae4fd7979b 100644
--- a/jdk/test/java/math/BigInteger/PrimeTest.java
+++ b/jdk/test/java/math/BigInteger/PrimeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,13 @@
/*
* @test
- * @bug 8026236
- * @summary test primality verification methods in BigInteger
+ * @library ..
+ * @bug 8026236 8074460
+ * @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed)
* @author bpb
*/
import java.math.BigInteger;
import java.util.BitSet;
-import java.util.HashSet;
import java.util.List;
import java.util.NavigableSet;
import java.util.Set;
@@ -178,7 +178,9 @@ public class PrimeTest {
}
// Create a list of non-prime BigIntegers.
- List nonPrimeBigInts = (new SplittableRandom())
+ RandomSeed rndSeed = new RandomSeed(true);
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+ List nonPrimeBigInts = (rndSeed.getSplittableRandom())
.ints(NUM_NON_PRIMES, 2, maxPrime).mapToObj(BigInteger::valueOf)
.filter(b -> !b.isProbablePrime(certainty)).collect(toList());
diff --git a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java
index b944a95d32f..d3cb73cbef2 100644
--- a/jdk/test/java/math/BigInteger/SymmetricRangeTests.java
+++ b/jdk/test/java/math/BigInteger/SymmetricRangeTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 1025, 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
@@ -24,9 +24,10 @@
/*
* @test
* @ignore This test has huge memory requirements
+ * @library ..
* @run main/timeout=180/othervm -Xmx8g SymmetricRangeTests
- * @bug 6910473 8021204 8021203 9005933
- * @summary Test range of BigInteger values
+ * @bug 6910473 8021204 8021203 9005933 8074460
+ * @summary Test range of BigInteger values (use -Dseed=X to set PRNG seed)
* @author Dmitry Nadezhin
*/
import java.io.ByteArrayInputStream;
@@ -35,7 +36,6 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Arrays;
-import java.util.Random;
import java.math.BigInteger;
public class SymmetricRangeTests {
@@ -114,8 +114,9 @@ public class SymmetricRangeTests {
System.out.println("Testing overflow in BitSieve.sieveSingle");
int bitLength = (5 << 27) - 1;
try {
- Random rnd = new Random();
- BigInteger actual = new BigInteger(bitLength, 0, rnd);
+ RandomSeed rndSeed = new RandomSeed(false);
+ System.out.println("Random number generator seed = " + rndSeed.getSeed());
+ BigInteger actual = new BigInteger(bitLength, 0, rndSeed.getRandom());
throw new RuntimeException("new BigInteger(bitLength, 0, null).bitLength()=" + actual.bitLength());
} catch (ArithmeticException e) {
// expected
diff --git a/jdk/test/java/math/RandomSeed.java b/jdk/test/java/math/RandomSeed.java
new file mode 100644
index 00000000000..494705c5fd6
--- /dev/null
+++ b/jdk/test/java/math/RandomSeed.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Random;
+import java.util.SplittableRandom;
+
+public class RandomSeed {
+ private long seed = 0L;
+ private Random rnd = null;
+ private SplittableRandom srnd = null;
+
+ public RandomSeed(boolean isSplittableRandom) {
+ init(isSplittableRandom);
+ }
+
+ private void init(boolean isSplittableRandom) {
+ // obtain seed from environment if supplied
+ boolean isSeedProvided = false;
+ try {
+ // note that Long.valueOf(null) also throws a NumberFormatException
+ // so if the property is undefined this will still work correctly
+ seed = Long.valueOf(System.getProperty("seed"));
+ isSeedProvided = true;
+ } catch (NumberFormatException e) {
+ // do nothing: isSeedProvided is already false
+ }
+
+ // if no seed from environment, create a fresh one
+ Random tmpRnd = null;
+ if (!isSeedProvided) {
+ tmpRnd = new Random();
+ seed = tmpRnd.nextLong();
+ }
+
+ // create the PRNG
+ if (isSplittableRandom) {
+ srnd = new SplittableRandom(seed);
+ } else {
+ rnd = tmpRnd != null ? tmpRnd : new Random();
+ rnd.setSeed(seed);
+ }
+ }
+
+ public Random getRandom() {
+ if (rnd == null) {
+ throw new IllegalStateException("Variable of type Random not initialized");
+ }
+ return rnd;
+ }
+
+ public SplittableRandom getSplittableRandom() {
+ if (srnd == null) {
+ throw new IllegalStateException("Variable of type SplittableRandom not initialized");
+ }
+ return srnd;
+ }
+
+ public long getSeed() {
+ return seed;
+ }
+}
diff --git a/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java b/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
index 122da8608c2..11e2dcd9620 100644
--- a/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
+++ b/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
@@ -152,144 +152,181 @@ public class TCKZoneIdPrinterParser {
@DataProvider(name="parseSuccess")
Object[][] data_parseSuccess() {
return new Object[][] {
- {"Z", 1, -1, ZoneId.of("Z")},
- {"UTC", 3, -1, ZoneId.of("UTC")},
- {"UT", 2, -1, ZoneId.of("UT")},
- {"GMT", 3, -1, ZoneId.of("GMT")},
+ {"Z", 1, -1, ZoneId.of("Z"), true},
+ {"UTC", 3, -1, ZoneId.of("UTC"), false},
+ {"UT", 2, -1, ZoneId.of("UT"), false},
+ {"GMT", 3, -1, ZoneId.of("GMT"), false},
- {"+00:00", 6, -1, ZoneOffset.UTC},
- {"UTC+00:00", 9, -1, ZoneId.of("UTC")},
- {"UT+00:00", 8, -1, ZoneId.of("UT")},
- {"GMT+00:00", 9, -1, ZoneId.of("GMT")},
- {"-00:00", 6, -1, ZoneOffset.UTC},
- {"UTC-00:00", 9, -1, ZoneId.of("UTC")},
- {"UT-00:00", 8, -1, ZoneId.of("UT")},
- {"GMT-00:00", 9, -1, ZoneId.of("GMT")},
+ {"+00:00", 6, -1, ZoneOffset.UTC, true},
+ {"UTC+00:00", 9, -1, ZoneId.of("UTC"), false},
+ {"UT+00:00", 8, -1, ZoneId.of("UT"), false},
+ {"GMT+00:00", 9, -1, ZoneId.of("GMT"), false},
+ {"-00:00", 6, -1, ZoneOffset.UTC, true},
+ {"UTC-00:00", 9, -1, ZoneId.of("UTC"), false},
+ {"UT-00:00", 8, -1, ZoneId.of("UT"), false},
+ {"GMT-00:00", 9, -1, ZoneId.of("GMT"), false},
- {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)},
- {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")},
- {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")},
- {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")},
- {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)},
- {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")},
- {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")},
- {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")},
+ {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30), true},
+ {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30"), false},
+ {"UT+02:30", 8, -1, ZoneId.of("UT+02:30"), false},
+ {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30"), false},
+ {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30), true},
+ {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30"), false},
+ {"UT-02:30", 8, -1, ZoneId.of("UT-02:30"), false},
+ {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30"), false},
// fallback to UTC
- {"UTC-01:WW", 3, -1, ZoneId.of("UTC")},
- {"UT-02:WW", 2, -1, ZoneId.of("UT")},
- {"GMT-03:WW", 3, -1, ZoneId.of("GMT")},
- {"Z0", 1, -1, ZoneOffset.UTC},
- {"UTC1", 3, -1, ZoneId.of("UTC")},
+ {"UTC-01:WW", 3, -1, ZoneId.of("UTC"), false},
+ {"UT-02:WW", 2, -1, ZoneId.of("UT"), false},
+ {"GMT-03:WW", 3, -1, ZoneId.of("GMT"), false},
+ {"Z0", 1, -1, ZoneOffset.UTC, true},
+ {"UTC1", 3, -1, ZoneId.of("UTC"), false},
// Z not parsed as zero
- {"UTCZ", 3, -1, ZoneId.of("UTC")},
- {"UTZ", 2, -1, ZoneId.of("UT")},
- {"GMTZ", 3, -1, ZoneId.of("GMT")},
+ {"UTCZ", 3, -1, ZoneId.of("UTC"), false},
+ {"UTZ", 2, -1, ZoneId.of("UT"), false},
+ {"GMTZ", 3, -1, ZoneId.of("GMT"), false},
// 0 not parsed
- {"UTC0", 3, -1, ZoneId.of("UTC")},
- {"UT0", 2, -1, ZoneId.of("UT")},
+ {"UTC0", 3, -1, ZoneId.of("UTC"), false},
+ {"UT0", 2, -1, ZoneId.of("UT"), false},
// fail to parse
- {"", 0, 0, null},
- {"A", 0, 0, null},
- {"UZ", 0, 0, null},
- {"GMA", 0, 0, null},
- {"0", 0, 0, null},
- {"+", 0, 0, null},
- {"-", 0, 0, null},
+ {"", 0, 0, null, false},
+ {"A", 0, 0, null, false},
+ {"UZ", 0, 0, null, false},
+ {"GMA", 0, 0, null, false},
+ {"0", 0, 0, null, false},
+ {"+", 0, 0, null, false},
+ {"-", 0, 0, null, false},
// zone IDs
- {"Europe/London", 13, -1, ZoneId.of("Europe/London")},
- {"America/New_York", 16, -1, ZoneId.of("America/New_York")},
- {"America/Bogusville", 0, 0, null},
+ {"Europe/London", 13, -1, ZoneId.of("Europe/London"), false},
+ {"America/New_York", 16, -1, ZoneId.of("America/New_York"), false},
+ {"America/Bogusville", 0, 0, null, false},
};
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_plain(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_plain(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + text);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + text);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + text);
- } else {
- assertEquals(parsed, null);
- }
+ test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_prefix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_prefix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
pos.setIndex(3);
- String prefixText = "XXX" + text;
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(prefixText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex, "Incorrect error index parsing: " + prefixText);
- assertEquals(pos.getIndex(), expectedIndex + 3, "Incorrect index parsing: " + prefixText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + prefixText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + prefixText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + prefixText);
- } else {
- assertEquals(parsed, null);
- }
+ test("XXX" + text,
+ expectedIndex + 3,
+ expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+ expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_suffix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_suffix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
- String suffixText = text + "XXX";
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(suffixText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + suffixText);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + suffixText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + suffixText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + suffixText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + suffixText);
- } else {
- assertEquals(parsed, null);
- }
+ test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_caseSensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_caseSensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.parseCaseSensitive().appendZoneId();
- String lcText = text.toLowerCase(Locale.ENGLISH);
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+
if (text.matches("[^A-Z]*[A-Z].*")) { // if input has letters
+ String lcText = text.toLowerCase(Locale.ENGLISH);
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
assertEquals(pos.getErrorIndex() >= 0, true);
assertEquals(pos.getIndex(), 0);
assertEquals(parsed, null);
} else {
- // case sensitive made no difference
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected);
- assertEquals(parsed.query(TemporalQueries.offset()), null);
- assertEquals(parsed.query(TemporalQueries.zone()), expected);
- } else {
- assertEquals(parsed, null);
- }
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_caseInsensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_caseInsensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.parseCaseInsensitive().appendZoneId();
- String lcText = text.toLowerCase(Locale.ENGLISH);
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_plain(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_prefix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ pos.setIndex(3);
+ test("XXX" + text,
+ expectedIndex + 3,
+ expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+ expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_suffix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_caseSensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.parseCaseSensitive().appendZoneOrOffsetId();
+ if (text.matches("[^A-Z]*[A-Z].*")) { // if input has letters
+ String lcText = text.toLowerCase(Locale.ENGLISH);
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+ assertEquals(pos.getErrorIndex() >= 0, true);
+ assertEquals(pos.getIndex(), 0);
+ assertEquals(parsed, null);
+ } else {
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetIdparseSuccess_caseInsensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.parseCaseInsensitive().appendZoneOrOffsetId();
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ private void test(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected,
+ boolean isZoneOffset) {
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
+ assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
+ assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
if (expected != null) {
- ZoneId zid = parsed.query(TemporalQueries.zoneId());
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + lcText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + lcText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + lcText);
+ assertEquals(parsed.query(TemporalQueries.zoneId()),
+ expected,
+ "Incorrect zoneId parsing: " + text);
+ assertEquals(parsed.query(TemporalQueries.offset()),
+ isZoneOffset ? expected : null,
+ "Incorrect offset parsing: " + text);
+ assertEquals(parsed.query(TemporalQueries.zone()),
+ expected,
+ "Incorrect zone parsing: " + text);
} else {
assertEquals(parsed, null);
}
diff --git a/jdk/test/java/util/prefs/CodePointZeroPrefsTest.java b/jdk/test/java/util/prefs/CodePointZeroPrefsTest.java
new file mode 100644
index 00000000000..8a63b86caf9
--- /dev/null
+++ b/jdk/test/java/util/prefs/CodePointZeroPrefsTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.lang.reflect.Constructor;
+import java.util.prefs.Preferences;
+import java.util.prefs.PreferencesFactory;
+
+/*
+ * @test
+ * @bug 8068373
+ * @summary Ensure writing a code point U+0000 null control character is detected.
+ */
+public class CodePointZeroPrefsTest
+{
+ public static void main(String[] args) throws Exception
+ {
+ int failures = 0;
+
+ // Deliberately reflect so you can reproduce it on any platform.
+ Constructor extends PreferencesFactory> constructor =
+ Class.forName("java.util.prefs.FileSystemPreferencesFactory").asSubclass(PreferencesFactory.class).getDeclaredConstructor();
+ constructor.setAccessible(true);
+ PreferencesFactory factory = constructor.newInstance();
+
+ Preferences node = factory.userRoot().node("com/acme/testing");
+
+ // legal key and value
+ try {
+ node.put("a", "1");
+ } catch (IllegalArgumentException iae) {
+ System.err.println("Unexpected IllegalArgumentException for legal key");
+ failures++;
+ }
+
+ // illegal key only
+ int numIAEs = 0;
+ try {
+ node.put("a\u0000b", "1");
+ System.err.println("IllegalArgumentException not thrown for illegal key");
+ failures++;
+ } catch (IllegalArgumentException iae) {
+ // do nothing
+ }
+
+ // illegal value only
+ numIAEs = 0;
+ try {
+ node.put("ab", "2\u00003");
+ System.err.println("IllegalArgumentException not thrown for illegal value");
+ failures++;
+ } catch (IllegalArgumentException iae) {
+ // do nothing
+ }
+
+ // illegal key and value
+ numIAEs = 0;
+ try {
+ node.put("a\u0000b", "2\u00003");
+ System.err.println("IllegalArgumentException not thrown for illegal entry");
+ failures++;
+ } catch (IllegalArgumentException iae) {
+ // do nothing
+ }
+
+ if (failures != 0) {
+ throw new RuntimeException("CodePointZeroPrefsTest failed with "
+ + failures + " errors!");
+ }
+ }
+}
diff --git a/jdk/test/sun/text/resources/Format/Bug8074791.java b/jdk/test/sun/text/resources/Format/Bug8074791.java
new file mode 100644
index 00000000000..138158ca090
--- /dev/null
+++ b/jdk/test/sun/text/resources/Format/Bug8074791.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8074791
+ * @summary Make sure that Finnish month names are correct in formatted text.
+ */
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import static java.text.DateFormat.*;
+import static java.util.Calendar.JANUARY;
+
+public class Bug8074791 {
+ private static Locale FINNISH = new Locale("fi");
+ private static String JAN_FORMAT = "tammikuuta";
+ private static String JAN_STANDALONE = "tammikuu";
+
+ public static void main(String[] arg) {
+ int errors = 0;
+
+ DateFormat df = DateFormat.getDateInstance(LONG, FINNISH);
+ Date jan20 = new GregorianCalendar(2015, JANUARY, 20).getTime();
+ String str = df.format(jan20).toString();
+ // Extract the month name (locale data dependent)
+ String month = str.replaceAll(".+\\s([a-z]+)\\s\\d+$", "$1");
+ if (!month.equals(JAN_FORMAT)) {
+ errors++;
+ System.err.println("wrong format month name: got '" + month
+ + "', expected '" + JAN_FORMAT + "'");
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat("LLLL", FINNISH); // stand-alone month name
+ month = sdf.format(jan20);
+ if (!month.equals(JAN_STANDALONE)) {
+ errors++;
+ System.err.println("wrong stand-alone month name: got '" + month
+ + "', expected '" + JAN_STANDALONE + "'");
+ }
+
+ if (errors > 0) {
+ throw new RuntimeException();
+ }
+ }
+}
diff --git a/jdk/test/sun/text/resources/LocaleData b/jdk/test/sun/text/resources/LocaleData
index 205932144d3..719cc3df066 100644
--- a/jdk/test/sun/text/resources/LocaleData
+++ b/jdk/test/sun/text/resources/LocaleData
@@ -8273,3 +8273,9 @@ FormatData/zh/MonthNarrows/9=10
FormatData/zh/MonthNarrows/10=11
FormatData/zh/MonthNarrows/11=12
FormatData/zh/MonthNarrows/12=
+
+# bug #8074791
+FormatData/fi/DatePatterns/0=d. MMMM yyyy
+FormatData/fi/DatePatterns/1=d. MMMM yyyy
+FormatData/fi/DatePatterns/2=d.M.yyyy
+FormatData/fi/DatePatterns/3=d.M.yyyy
diff --git a/jdk/test/sun/text/resources/LocaleDataTest.java b/jdk/test/sun/text/resources/LocaleDataTest.java
index abfdd97943d..96d6d1d9a75 100644
--- a/jdk/test/sun/text/resources/LocaleDataTest.java
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
* 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
* 7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 8017142
- * 8037343 8055222 8042126
+ * 8037343 8055222 8042126 8074791
* @summary Verify locale data
*
*/
diff --git a/jdk/test/tools/launcher/TestSpecialArgs.java b/jdk/test/tools/launcher/TestSpecialArgs.java
index 0e35f028521..307a4e06fb4 100644
--- a/jdk/test/tools/launcher/TestSpecialArgs.java
+++ b/jdk/test/tools/launcher/TestSpecialArgs.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7124089 7131021 8042469 8066185
+ * @bug 7124089 7131021 8042469 8066185 8074373
* @summary Checks for Launcher special flags, such as MacOSX specific flags,
* and JVM NativeMemoryTracking flags.
* @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java
@@ -270,6 +270,16 @@ public class TestSpecialArgs extends TestHelper {
tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary");
checkTestResult(tr);
+ // should accept with no warnings
+ tr = doExec(javaCmd, "-cp", jarFile.getName(),
+ "-XX:NativeMemoryTracking=summary", "Foo");
+ ensureNoWarnings(tr);
+
+ // should accept with no warnings
+ tr = doExec(javaCmd, "-classpath", jarFile.getName(),
+ "-XX:NativeMemoryTracking=summary", "Foo");
+ ensureNoWarnings(tr);
+
// make sure a missing class is handled correctly, because the class
// resolution is performed by the JVM.
tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary");
@@ -278,6 +288,14 @@ public class TestSpecialArgs extends TestHelper {
}
}
+ void ensureNoWarnings(TestResult tr) {
+ checkTestResult(tr);
+ if (tr.contains("warning: Native Memory Tracking")) {
+ System.err.println(tr.toString());
+ throw new RuntimeException("Test Fails");
+ }
+ }
+
void checkTestResult(TestResult tr) {
if (!tr.isOK()) {
System.err.println(tr.toString());
diff --git a/langtools/.hgtags b/langtools/.hgtags
index c0b793ff25c..0d0e8539556 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -296,3 +296,4 @@ e272d9be5f90edb6bb6b40f7816ec85eec0f5dc2 jdk9-b46
7c44d9a33bbea75f5d91625df9bbccea360aea2a jdk9-b51
ee20efe0255d7ac6e06e88e06f7c72f6c6da7bf9 jdk9-b52
99ff00581f3633c1787bec21f2a8f3a2ffe57665 jdk9-b53
+ed34864f3b43a7df394fce6c3f0bc86b70a5d686 jdk9-b54
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
index fde64a55d00..c1627f23f6a 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java
@@ -144,6 +144,7 @@ public class Checker extends DocTreePathScanner {
}
public Void scan(DocCommentTree tree, TreePath p) {
+ env.initTypes();
env.setCurrent(p, tree);
boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
index 5597d308d2b..e6ee1e4513b 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java
@@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
+import java.util.regex.Pattern;
import javax.lang.model.element.Name;
import javax.tools.StandardLocation;
@@ -79,7 +80,8 @@ public class DocLint implements Plugin {
private static final String STATS = "-stats";
public static final String XIMPLICIT_HEADERS = "-XimplicitHeaders:";
public static final String XCUSTOM_TAGS_PREFIX = "-XcustomTags:";
- public static final String TAGS_SEPARATOR = ",";
+ public static final String XCHECK_PACKAGE = "-XcheckPackage:";
+ public static final String SEPARATOR = ",";
//
public static void main(String... args) {
@@ -156,7 +158,7 @@ public class DocLint implements Plugin {
env.init(task);
checker = new Checker(env);
- DeclScanner ds = new DeclScanner() {
+ DeclScanner ds = new DeclScanner(env) {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
@@ -272,6 +274,8 @@ public class DocLint implements Plugin {
env.setImplicitHeaders(Character.digit(ch, 10));
} else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) {
env.setCustomTags(arg.substring(arg.indexOf(":") + 1));
+ } else if (arg.startsWith(XCHECK_PACKAGE)) {
+ env.setCheckPackages(arg.substring(arg.indexOf(":") + 1));
} else
throw new IllegalArgumentException(arg);
}
@@ -280,7 +284,7 @@ public class DocLint implements Plugin {
checker = new Checker(env);
if (addTaskListener) {
- final DeclScanner ds = new DeclScanner() {
+ final DeclScanner ds = new DeclScanner(env) {
@Override
void visitDecl(Tree tree, Name name) {
TreePath p = getCurrentPath();
@@ -337,6 +341,9 @@ public class DocLint implements Plugin {
return true;
if (opt.startsWith(XMSGS_CUSTOM_PREFIX))
return Messages.Options.isValidOptions(opt.substring(XMSGS_CUSTOM_PREFIX.length()));
+ if (opt.startsWith(XCHECK_PACKAGE)) {
+ return Env.validatePackages(opt.substring(opt.indexOf(":") + 1));
+ }
return false;
}
@@ -348,6 +355,12 @@ public class DocLint implements Plugin {
//
static abstract class DeclScanner extends TreePathScanner {
+ final Env env;
+
+ public DeclScanner(Env env) {
+ this.env = env;
+ }
+
abstract void visitDecl(Tree tree, Name name);
@Override @DefinedBy(Api.COMPILER_TREE)
@@ -373,6 +386,33 @@ public class DocLint implements Plugin {
visitDecl(tree, tree.getName());
return super.visitVariable(tree, ignore);
}
+
+ @Override @DefinedBy(Api.COMPILER_TREE)
+ public Void visitCompilationUnit(CompilationUnitTree node, Void p) {
+ if (env.includePackages != null) {
+ String packageName = node.getPackageName() != null
+ ? node.getPackageName().toString()
+ : "";
+ if (!env.includePackages.isEmpty()) {
+ boolean included = false;
+ for (Pattern pack : env.includePackages) {
+ if (pack.matcher(packageName).matches()) {
+ included = true;
+ break;
+ }
+ }
+ if (!included)
+ return null;
+ }
+ for (Pattern pack : env.excludePackages) {
+ if (pack.matcher(packageName).matches()) {
+ return null;
+ }
+ }
+ }
+ return super.visitCompilationUnit(node, p);
+ }
+
}
//
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java
index 222945de626..448e4d79c19 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java
@@ -26,8 +26,12 @@
package com.sun.tools.doclint;
-import java.util.Set;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Pattern;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
@@ -36,6 +40,7 @@ import javax.lang.model.element.Modifier;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
+import javax.tools.Diagnostic.Kind;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.util.DocTrees;
@@ -44,6 +49,7 @@ import com.sun.source.util.SourcePositions;
import com.sun.source.util.TreePath;
import com.sun.tools.javac.model.JavacTypes;
import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.MatchingUtils;
import com.sun.tools.javac.util.StringUtils;
/**
@@ -90,6 +96,9 @@ public class Env {
Set customTags;
+ Set includePackages;
+ Set excludePackages;
+
// Utility classes
DocTrees trees;
Elements elements;
@@ -129,6 +138,12 @@ public class Env {
this.trees = trees;
this.elements = elements;
this.types = types;
+ }
+
+ void initTypes() {
+ if (java_lang_Error != null)
+ return ;
+
java_lang_Error = elements.getTypeElement("java.lang.Error").asType();
java_lang_RuntimeException = elements.getTypeElement("java.lang.RuntimeException").asType();
java_lang_Throwable = elements.getTypeElement("java.lang.Throwable").asType();
@@ -141,12 +156,43 @@ public class Env {
void setCustomTags(String cTags) {
customTags = new LinkedHashSet<>();
- for (String s : cTags.split(DocLint.TAGS_SEPARATOR)) {
+ for (String s : cTags.split(DocLint.SEPARATOR)) {
if (!s.isEmpty())
customTags.add(s);
}
}
+ void setCheckPackages(String packages) {
+ includePackages = new HashSet<>();
+ excludePackages = new HashSet<>();
+ for (String pack : packages.split(DocLint.SEPARATOR)) {
+ boolean excluded = false;
+ if (pack.startsWith("-")) {
+ pack = pack.substring(1);
+ excluded = true;
+ }
+ if (pack.isEmpty())
+ continue;
+ Pattern pattern = MatchingUtils.validImportStringToPattern(pack);
+ if (excluded) {
+ excludePackages.add(pattern);
+ } else {
+ includePackages.add(pattern);
+ }
+ }
+ }
+
+ static boolean validatePackages(String packages) {
+ for (String pack : packages.split(DocLint.SEPARATOR)) {
+ if (pack.startsWith("-")) {
+ pack = pack.substring(1);
+ }
+ if (!pack.isEmpty() && !MatchingUtils.isValidImportString(pack))
+ return false;
+ }
+ return true;
+ }
+
/** Set the current declaration and its doc comment. */
void setCurrent(TreePath path, DocCommentTree comment) {
currPath = path;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties
index 7a6907699e5..1f47d94d3bc 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties
@@ -107,6 +107,13 @@ Options:\n\
\ equivalent to -Xmsgs:all/protected, meaning that\n\
\ all messages are reported for protected and public\n\
\ declarations only. \n\
+\ -XcheckPackage:\n\
+\ Enable or disable checks in specific packages.\n\
+\ is a comma separated list of package specifiers.\n\
+\ Package specifier is either a qualified name of a package\n\
+\ or a package name prefix followed by ''.*'', which expands to\n\
+\ all sub-packages of the given package. Prefix the package specifier\n\
+\ with ''-'' to disable checks for the specified packages.\n\
\ -stats\n\
\ Report statistics on the reported issues.\n\
\ -h -help --help -usage -?\n\
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index df8d0eac204..25d25c3b863 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1211,10 +1211,8 @@ public class Attr extends JCTree.Visitor {
if (pattype.constValue() == null) {
log.error(c.pat.pos(),
(stringSwitch ? "string.const.req" : "const.expr.req"));
- } else if (labels.contains(pattype.constValue())) {
+ } else if (!labels.add(pattype.constValue())) {
log.error(c.pos(), "duplicate.case.label");
- } else {
- labels.add(pattype.constValue());
}
}
}
@@ -1251,19 +1249,17 @@ public class Attr extends JCTree.Visitor {
// where
/** Return the selected enumeration constant symbol, or null. */
private Symbol enumConstant(JCTree tree, Type enumType) {
- if (!tree.hasTag(IDENT)) {
- log.error(tree.pos(), "enum.label.must.be.unqualified.enum");
- return syms.errSymbol;
- }
- JCIdent ident = (JCIdent)tree;
- Name name = ident.name;
- for (Symbol sym : enumType.tsym.members().getSymbolsByName(name)) {
- if (sym.kind == VAR) {
- Symbol s = ident.sym = sym;
- ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
- ident.type = s.type;
- return ((s.flags_field & Flags.ENUM) == 0)
- ? null : s;
+ if (tree.hasTag(IDENT)) {
+ JCIdent ident = (JCIdent)tree;
+ Name name = ident.name;
+ for (Symbol sym : enumType.tsym.members().getSymbolsByName(name)) {
+ if (sym.kind == VAR) {
+ Symbol s = ident.sym = sym;
+ ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
+ ident.type = s.type;
+ return ((s.flags_field & Flags.ENUM) == 0)
+ ? null : s;
+ }
}
}
return null;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
index 912cb24a06f..a37f37aa084 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java
@@ -496,6 +496,14 @@ public class Arguments {
if (doclintOpts.equals(Collections.singleton(DocLint.XMSGS_CUSTOM_PREFIX + "none")))
return List.nil();
+ String checkPackages = options.get(Option.XDOCLINT_PACKAGE);
+
+ if (checkPackages != null) {
+ for (String s : checkPackages.split("\\s+")) {
+ doclintOpts.add(s.replace(Option.XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
+ }
+ }
+
// standard doclet normally generates H1, H2,
// so for now, allow user comments to assume that
doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
index acde6e702c5..01284a32baf 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java
@@ -129,6 +129,22 @@ public enum Option {
}
},
+ XDOCLINT_PACKAGE("-Xdoclint/package:", "opt.Xdoclint.package.args", "opt.Xdoclint.package.desc", EXTENDED, BASIC) {
+ @Override
+ public boolean matches(String option) {
+ return DocLint.isValidOption(
+ option.replace(XDOCLINT_PACKAGE.text, DocLint.XCHECK_PACKAGE));
+ }
+
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ String prev = helper.get(XDOCLINT_PACKAGE);
+ String next = (prev == null) ? option : (prev + " " + option);
+ helper.put(XDOCLINT_PACKAGE.text, next);
+ return false;
+ }
+ },
+
// -nowarn is retained for command-line backward compatibility
NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) {
@Override
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
index 67bf74c3d51..eedd14a4b8c 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java
@@ -70,6 +70,7 @@ import com.sun.tools.javac.util.JCDiagnostic;
import com.sun.tools.javac.util.JavacMessages;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.MatchingUtils;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.util.Options;
@@ -1431,7 +1432,6 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
return specifiedPackages;
}
- private static final Pattern allMatches = Pattern.compile(".*");
public static final Pattern noMatches = Pattern.compile("(\\P{all})+");
/**
@@ -1440,62 +1440,14 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea
* import-style string, return a regex that won't match anything.
*/
private static Pattern importStringToPattern(String s, Processor p, Log log) {
- if (isValidImportString(s)) {
- return validImportStringToPattern(s);
+ if (MatchingUtils.isValidImportString(s)) {
+ return MatchingUtils.validImportStringToPattern(s);
} else {
log.warning("proc.malformed.supported.string", s, p.getClass().getName());
return noMatches; // won't match any valid identifier
}
}
- /**
- * Return true if the argument string is a valid import-style
- * string specifying claimed annotations; return false otherwise.
- */
- public static boolean isValidImportString(String s) {
- if (s.equals("*"))
- return true;
-
- boolean valid = true;
- String t = s;
- int index = t.indexOf('*');
-
- if (index != -1) {
- // '*' must be last character...
- if (index == t.length() -1) {
- // ... any and preceding character must be '.'
- if ( index-1 >= 0 ) {
- valid = t.charAt(index-1) == '.';
- // Strip off ".*$" for identifier checks
- t = t.substring(0, t.length()-2);
- }
- } else
- return false;
- }
-
- // Verify string is off the form (javaId \.)+ or javaId
- if (valid) {
- String[] javaIds = t.split("\\.", t.length()+2);
- for(String javaId: javaIds)
- valid &= SourceVersion.isIdentifier(javaId);
- }
- return valid;
- }
-
- public static Pattern validImportStringToPattern(String s) {
- if (s.equals("*")) {
- return allMatches;
- } else {
- String s_prime = s.replace(".", "\\.");
-
- if (s_prime.endsWith("*")) {
- s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+";
- }
-
- return Pattern.compile(s_prime);
- }
- }
-
/**
* For internal use only. This method may be removed without warning.
*/
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
index b38b82718a1..92f2d4ce0b3 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties
@@ -228,6 +228,17 @@ javac.opt.Xdoclint.custom=\n\
\ Enable or disable specific checks for problems in javadoc comments,\n\
\ where is one of accessibility, html, missing, reference, or syntax,\n\
\ and is one of public, protected, package, or private.
+
+javac.opt.Xdoclint.package.args = \
+ ([-])
+
+javac.opt.Xdoclint.package.desc=\n\
+\ Enable or disable checks in specific packages. is a comma separated\n\
+\ list of package specifiers. Package specifier is either a qualified name of a package\n\
+\ or a package name prefix followed by '.*', which expands to all sub-packages of\n\
+\ the given package. Prefix the package specifier with '-' to disable checks for\n\
+\ the specified packages.
+
javac.opt.Xstdout=\
Redirect standard output
javac.opt.X=\
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java
new file mode 100644
index 00000000000..e8d930dcf24
--- /dev/null
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MatchingUtils.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.util;
+
+import java.util.regex.Pattern;
+import javax.lang.model.SourceVersion;
+
+/**Utilities to convert an import-like string to a regexp.
+ *
+ * This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.
+ */
+public class MatchingUtils {
+ private static final Pattern allMatches = Pattern.compile(".*");
+
+ /**
+ * Return true if the argument string is a valid import-style
+ * string specifying claimed annotations; return false otherwise.
+ */
+ public static boolean isValidImportString(String s) {
+ if (s.equals("*"))
+ return true;
+
+ boolean valid = true;
+ String t = s;
+ int index = t.indexOf('*');
+
+ if (index != -1) {
+ // '*' must be last character...
+ if (index == t.length() -1) {
+ // ... any and preceding character must be '.'
+ if ( index-1 >= 0 ) {
+ valid = t.charAt(index-1) == '.';
+ // Strip off ".*$" for identifier checks
+ t = t.substring(0, t.length()-2);
+ }
+ } else
+ return false;
+ }
+
+ // Verify string is off the form (javaId \.)+ or javaId
+ if (valid) {
+ String[] javaIds = t.split("\\.", t.length()+2);
+ for(String javaId: javaIds)
+ valid &= SourceVersion.isIdentifier(javaId);
+ }
+ return valid;
+ }
+
+ public static Pattern validImportStringToPattern(String s) {
+ if (s.equals("*")) {
+ return allMatches;
+ } else {
+ String s_prime = s.replace(".", "\\.");
+
+ if (s_prime.endsWith("*")) {
+ s_prime = s_prime.substring(0, s_prime.length() - 1) + ".+";
+ }
+
+ return Pattern.compile(s_prime);
+ }
+ }
+
+}
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java
index 9393710c7a5..cffb0da87fa 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@ import java.util.Set;
import java.util.HashSet;
import com.sun.tools.sjavac.Transformer;
+import com.sun.tools.sjavac.Util;
/**
* Instances of this class represent values for sjavac command line options.
@@ -358,21 +359,25 @@ public class Options {
@Override
public void exclude(String exclPattern) {
+ exclPattern = Util.normalizeDriveLetter(exclPattern);
excludes.add(exclPattern);
}
@Override
public void include(String inclPattern) {
+ inclPattern = Util.normalizeDriveLetter(inclPattern);
includes.add(inclPattern);
}
@Override
public void excludeFile(String exclFilePattern) {
+ exclFilePattern = Util.normalizeDriveLetter(exclFilePattern);
excludeFiles.add(exclFilePattern);
}
@Override
public void includeFile(String inclFilePattern) {
+ inclFilePattern = Util.normalizeDriveLetter(inclFilePattern);
includeFiles.add(inclFilePattern);
}
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
index d6665e13dbd..706f0d7b6c7 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,8 +55,6 @@ public class FrameOutputWriter extends HtmlDocletWriter {
*/
int noOfPackages;
- private final String SCROLL_YES = "yes";
-
/**
* Constructor to construct FrameOutputWriter object.
*
@@ -96,90 +94,73 @@ public class FrameOutputWriter extends HtmlDocletWriter {
* as well as warning if browser is not supporting the Html frames.
*/
protected void generateFrameFile() throws IOException {
- Content frameset = getFrameDetails();
+ Content frame = getFrameDetails();
+ HtmlTree body = new HtmlTree(HtmlTag.BODY);
+ body.addContent(frame);
if (configuration.windowtitle.length() > 0) {
- printFramesetDocument(configuration.windowtitle, configuration.notimestamp,
- frameset);
+ printFramesDocument(configuration.windowtitle, configuration,
+ body);
} else {
- printFramesetDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
- configuration.notimestamp, frameset);
+ printFramesDocument(configuration.getText("doclet.Generated_Docs_Untitled"),
+ configuration, body);
}
}
- /**
- * Add the code for issueing the warning for a non-frame capable web
- * client. Also provide links to the non-frame version documentation.
- *
- * @param contentTree the content tree to which the non-frames information will be added
- */
- protected void addFrameWarning(Content contentTree) {
- Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
- Content noScript = HtmlTree.NOSCRIPT(
- HtmlTree.DIV(getResource("doclet.No_Script_Message")));
- noframes.addContent(noScript);
- Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
- getResource("doclet.Frame_Alert"));
- noframes.addContent(noframesHead);
- Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
- getHyperLink(configuration.topFile,
- configuration.getText("doclet.Non_Frame_Version"))));
- noframes.addContent(p);
- contentTree.addContent(noframes);
- }
-
/**
* Get the frame sizes and their contents.
*
* @return a content tree for the frame details
*/
protected Content getFrameDetails() {
- HtmlTree frameset = HtmlTree.FRAMESET("20%,80%", null, "Documentation frame",
- "top.loadFrames()");
+ HtmlTree leftContainerDiv = new HtmlTree(HtmlTag.DIV);
+ HtmlTree rightContainerDiv = new HtmlTree(HtmlTag.DIV);
+ leftContainerDiv.addStyle(HtmlStyle.leftContainer);
+ rightContainerDiv.addStyle(HtmlStyle.rightContainer);
if (noOfPackages <= 1) {
- addAllClassesFrameTag(frameset);
+ addAllClassesFrameTag(leftContainerDiv);
} else if (noOfPackages > 1) {
- HtmlTree leftFrameset = HtmlTree.FRAMESET(null, "30%,70%", "Left frames",
- "top.loadFrames()");
- addAllPackagesFrameTag(leftFrameset);
- addAllClassesFrameTag(leftFrameset);
- frameset.addContent(leftFrameset);
+ addAllPackagesFrameTag(leftContainerDiv);
+ addAllClassesFrameTag(leftContainerDiv);
}
- addClassFrameTag(frameset);
- addFrameWarning(frameset);
- return frameset;
+ addClassFrameTag(rightContainerDiv);
+ HtmlTree mainContainer = HtmlTree.DIV(HtmlStyle.mainContainer, leftContainerDiv);
+ mainContainer.addContent(rightContainerDiv);
+ return mainContainer;
}
/**
- * Add the FRAME tag for the frame that lists all packages.
+ * Add the IFRAME tag for the frame that lists all packages.
*
* @param contentTree the content tree to which the information will be added
*/
private void addAllPackagesFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(DocPaths.OVERVIEW_FRAME.getPath(),
+ HtmlTree frame = HtmlTree.IFRAME(DocPaths.OVERVIEW_FRAME.getPath(),
"packageListFrame", configuration.getText("doclet.All_Packages"));
- contentTree.addContent(frame);
+ HtmlTree leftTop = HtmlTree.DIV(HtmlStyle.leftTop, frame);
+ contentTree.addContent(leftTop);
}
/**
- * Add the FRAME tag for the frame that lists all classes.
+ * Add the IFRAME tag for the frame that lists all classes.
*
* @param contentTree the content tree to which the information will be added
*/
private void addAllClassesFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
+ HtmlTree frame = HtmlTree.IFRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
"packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
- contentTree.addContent(frame);
+ HtmlTree leftBottom = HtmlTree.DIV(HtmlStyle.leftBottom, frame);
+ contentTree.addContent(leftBottom);
}
/**
- * Add the FRAME tag for the frame that describes the class in detail.
+ * Add the IFRAME tag for the frame that describes the class in detail.
*
* @param contentTree the content tree to which the information will be added
*/
private void addClassFrameTag(Content contentTree) {
- HtmlTree frame = HtmlTree.FRAME(configuration.topFile.getPath(), "classFrame",
- configuration.getText("doclet.Package_class_and_interface_descriptions"),
- SCROLL_YES);
+ HtmlTree frame = HtmlTree.IFRAME(configuration.topFile.getPath(), "classFrame",
+ configuration.getText("doclet.Package_class_and_interface_descriptions"));
+ frame.addStyle(HtmlStyle.rightIframe);
contentTree.addContent(frame);
}
}
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
index fed89db837b..6ffaf7993eb 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/DocType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,9 +48,6 @@ public class DocType extends Content {
public static final DocType TRANSITIONAL =
new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
- public static final DocType FRAMESET =
- new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
-
/**
* Constructor to construct a DocType object.
*
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
index ab3200a0301..3b9b003348b 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@ import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
import com.sun.tools.doclets.internal.toolkit.util.DocPath;
+import com.sun.tools.doclets.internal.toolkit.util.DocPaths;
/**
@@ -56,6 +57,8 @@ public abstract class HtmlDocWriter extends HtmlWriter {
public static final String CONTENT_TYPE = "text/html";
+ DocPath pathToRoot;
+
/**
* Constructor. Initializes the destination file name through the super
* class HtmlWriter.
@@ -65,6 +68,7 @@ public abstract class HtmlDocWriter extends HtmlWriter {
public HtmlDocWriter(Configuration configuration, DocPath filename)
throws IOException {
super(configuration, filename);
+ this.pathToRoot = filename.parent().invert();
configuration.message.notice("doclet.Generating_0",
DocFile.createFileForOutput(configuration, filename).getPath());
}
@@ -298,33 +302,54 @@ public abstract class HtmlDocWriter extends HtmlWriter {
}
/**
- * Print the frameset version of the Html file header.
- * Called only when generating an HTML frameset file.
+ * Print the frames version of the Html file header.
+ * Called only when generating an HTML frames file.
*
* @param title Title of this HTML document
- * @param noTimeStamp If true, don't print time stamp in header
- * @param frameset the frameset to be added to the HTML document
+ * @param configuration the configuration object
+ * @param frame the frame content tree to be added to the HTML document
*/
- public void printFramesetDocument(String title, boolean noTimeStamp,
- Content frameset) throws IOException {
- Content htmlDocType = DocType.FRAMESET;
+ public void printFramesDocument(String title, ConfigurationImpl configuration,
+ HtmlTree body) throws IOException {
+ Content htmlDocType = DocType.TRANSITIONAL;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD);
- head.addContent(getGeneratedBy(!noTimeStamp));
+ head.addContent(getGeneratedBy(!configuration.notimestamp));
Content windowTitle = HtmlTree.TITLE(new StringContent(title));
head.addContent(windowTitle);
Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
(configuration.charset.length() > 0) ?
configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
head.addContent(meta);
- head.addContent(getFramesetJavaScript());
+ head.addContent(getStyleSheetProperties(configuration));
+ head.addContent(getFramesJavaScript());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
- head, frameset);
+ head, body);
Content htmlDocument = new HtmlDocument(htmlDocType,
htmlComment, htmlTree);
write(htmlDocument);
}
+ /**
+ * Returns a link to the stylesheet file.
+ *
+ * @return an HtmlTree for the lINK tag which provides the stylesheet location
+ */
+ public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) {
+ String stylesheetfile = configuration.stylesheetfile;
+ DocPath stylesheet;
+ if (stylesheetfile.isEmpty()) {
+ stylesheet = DocPaths.STYLESHEET;
+ } else {
+ DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
+ stylesheet = DocPath.create(file.getName());
+ }
+ HtmlTree link = HtmlTree.LINK("stylesheet", "text/css",
+ pathToRoot.resolve(stylesheet).getPath(),
+ "Style");
+ return link;
+ }
+
protected Comment getGeneratedBy(boolean timestamp) {
String text = "Generated by javadoc"; // marker string, deliberately not localized
if (timestamp) {
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
index a2dddaf9aae..4d3002842e7 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,11 @@ public enum HtmlStyle {
indexHeader,
inheritance,
interfaceName,
+ leftContainer,
+ leftTop,
+ leftBottom,
legalCopy,
+ mainContainer,
memberNameLabel,
memberNameLink,
memberSummary,
@@ -79,6 +83,8 @@ public enum HtmlStyle {
packageHierarchyLabel,
paramLabel,
returnLabel,
+ rightContainer,
+ rightIframe,
rowColor,
seeLabel,
serializedFormContainer,
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
index eea7112676d..f2133916d1c 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,8 +52,6 @@ public enum HtmlTag {
DT,
EM(BlockType.INLINE, EndTag.END),
FONT(BlockType.INLINE, EndTag.END),
- FRAME(BlockType.OTHER, EndTag.NOEND),
- FRAMESET(BlockType.OTHER, EndTag.END),
H1,
H2,
H3,
@@ -64,6 +62,7 @@ public enum HtmlTag {
HR(BlockType.BLOCK, EndTag.NOEND),
HTML(BlockType.OTHER, EndTag.END),
I(BlockType.INLINE, EndTag.END),
+ IFRAME(BlockType.OTHER, EndTag.END),
IMG(BlockType.INLINE, EndTag.NOEND),
LI,
LISTING,
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
index 7d5c47b4ddd..77aee4aed1e 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -326,53 +326,18 @@ public class HtmlTree extends Content {
}
/**
- * Generates a FRAME tag.
+ * Generates a IFRAME tag.
*
* @param src the url of the document to be shown in the frame
* @param name specifies the name of the frame
* @param title the title for the frame
- * @param scrolling specifies whether to display scrollbars in the frame
- * @return an HtmlTree object for the FRAME tag
+ * @return an HtmlTree object for the IFRAME tag
*/
- public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
- HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
+ public static HtmlTree IFRAME(String src, String name, String title) {
+ HtmlTree htmltree = new HtmlTree(HtmlTag.IFRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
- if (scrolling != null)
- htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
- return htmltree;
- }
-
- /**
- * Generates a Frame tag.
- *
- * @param src the url of the document to be shown in the frame
- * @param name specifies the name of the frame
- * @param title the title for the frame
- * @return an HtmlTree object for the SPAN tag
- */
- public static HtmlTree FRAME(String src, String name, String title) {
- return FRAME(src, name, title, null);
- }
-
- /**
- * Generates a FRAMESET tag.
- *
- * @param cols the size of columns in the frameset
- * @param rows the size of rows in the frameset
- * @param title the title for the frameset
- * @param onload the script to run when the document loads
- * @return an HtmlTree object for the FRAMESET tag
- */
- public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
- HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
- if (cols != null)
- htmltree.addAttr(HtmlAttr.COLS, cols);
- if (rows != null)
- htmltree.addAttr(HtmlAttr.ROWS, rows);
- htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
- htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
}
@@ -779,7 +744,7 @@ public class HtmlTree extends Content {
return (hasAttr(HtmlAttr.NAME) || (hasAttr(HtmlAttr.HREF) && hasContent()));
case BR :
return (!hasContent() && (!hasAttrs() || hasAttr(HtmlAttr.CLEAR)));
- case FRAME :
+ case IFRAME :
return (hasAttr(HtmlAttr.SRC) && !hasContent());
case HR :
return (!hasContent());
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
index f74c0849842..3e923cb8de6 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -376,7 +376,7 @@ public class HtmlWriter {
*
* @return a content for the SCRIPT tag
*/
- protected Content getFramesetJavaScript() {
+ protected Content getFramesJavaScript() {
HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
script.addAttr(HtmlAttr.TYPE, "text/javascript");
String scriptCode = DocletConstants.NL +
@@ -425,10 +425,6 @@ public class HtmlWriter {
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" return true;" + DocletConstants.NL +
- " }" + DocletConstants.NL +
- " function loadFrames() {" + DocletConstants.NL +
- " if (targetPage != \"\" && targetPage != \"undefined\")" + DocletConstants.NL +
- " top.classFrame.location = top.targetPage;" + DocletConstants.NL +
" }" + DocletConstants.NL;
RawHtml scriptContent = new RawHtml(scriptCode);
script.addContent(scriptContent);
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
index 9951877f8bc..8e97bda890b 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties
@@ -104,10 +104,7 @@ doclet.No_Frames=No Frames
doclet.Package_Hierarchies=Package Hierarchies:
doclet.Hierarchy_For_Package=Hierarchy For Package {0}
doclet.Hierarchy_For_All_Packages=Hierarchy For All Packages
-doclet.Frame_Alert=Frame Alert
-doclet.Frame_Warning_Message=This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to {0}.
doclet.No_Script_Message=JavaScript is disabled on your browser.
-doclet.Non_Frame_Version=Non-frame version
doclet.Description_From_Interface=Description copied from interface:
doclet.Description_From_Class=Description copied from class:
doclet.No_Non_Deprecated_Classes_To_Document=No non-deprecated classes found to document.
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
index cebb4fd8d56..883f64b6555 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
@@ -11,6 +11,17 @@ body {
font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
font-size:14px;
margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+}
+iframe {
+ margin:0;
+ padding:0;
+ height:100%;
+ width:100%;
+ overflow-y:scroll;
+ border:none;
}
a:link, a:visited {
text-decoration:none;
@@ -463,7 +474,6 @@ Table styles
.useSummary td, .constantsSummary td, .deprecatedSummary td {
text-align:left;
padding:0px 0px 12px 10px;
- width:100%;
}
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
@@ -488,6 +498,7 @@ td.colOne, th.colOne {
font-size:13px;
}
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.useSummary td.colFirst, .useSummary th.colFirst,
.overviewSummary td.colOne, .overviewSummary th.colOne,
.memberSummary td.colFirst, .memberSummary th.colFirst,
.memberSummary td.colOne, .memberSummary th.colOne,
@@ -569,6 +580,61 @@ div.block div.block span.interfaceName {
font-style:normal;
}
-div.contentContainer ul.blockList li.blockList h2{
+div.contentContainer ul.blockList li.blockList h2 {
padding-bottom:0px;
}
+/*
+IFRAME specific styles
+*/
+.mainContainer {
+ margin:0 auto;
+ padding:0;
+ height:100%;
+ width:100%;
+ position:fixed;
+ top:0;
+ left:0;
+}
+.leftContainer {
+ height:100%;
+ position:fixed;
+ width:320px;
+}
+.leftTop {
+ position:relative;
+ float:left;
+ width:315px;
+ top:0;
+ left:0;
+ height:30%;
+ border-right:6px solid #ccc;
+ border-bottom:6px solid #ccc;
+}
+.leftBottom {
+ position:relative;
+ float:left;
+ width:315px;
+ bottom:0;
+ left:0;
+ height:70%;
+ border-right:6px solid #ccc;
+ border-top:1px solid #000;
+}
+.rightContainer {
+ position:absolute;
+ left:320px;
+ top:0;
+ bottom:0;
+ height:100%;
+ right:0;
+ border-left:1px solid #000;
+}
+.rightIframe {
+ margin:0;
+ padding:0;
+ height:100%;
+ right:30px;
+ width:100%;
+ overflow:visible;
+ margin-bottom:30px;
+}
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
index 17a08f958e4..273261563df 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/DocEnv.java
@@ -833,7 +833,7 @@ public class DocEnv {
for (String customTag : customTagNames) {
customTags.append(sep);
customTags.append(customTag);
- sep = DocLint.TAGS_SEPARATOR;
+ sep = DocLint.SEPARATOR;
}
doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
diff --git a/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java b/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
index 43da7cdae81..aac1d0c39ce 100644
--- a/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
+++ b/langtools/test/com/sun/javadoc/ValidHtml/ValidHtml.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,10 @@
/*
* @test
- * @bug 4275630 4749453 4625400 4753048 4415270
- * @summary Generated HTML is invalid with frameset DTD.
+ * @bug 4275630 4749453 4625400 4753048 4415270 8074521
+ * @summary Generated HTML is invalid with frames.
* Displays unnecessary horizontal scroll bars.
* Missing whitespace in DOCTYPE declaration
- * not allowed outside ");
+ "