From 0588e8953c66be237a9871e1aabb3c113ddd199f Mon Sep 17 00:00:00 2001
From: Mikael Vidstedt
Date: Fri, 6 May 2016 13:00:21 -0700
Subject: [PATCH 001/381] 8156088: Reintegrate 8153892: Handle unsafe access
error directly in signal handler instead of going through a stub
Reviewed-by: stuefe, dholmes
---
hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp | 13 ----
.../src/cpu/sparc/vm/stubGenerator_sparc.cpp | 75 +------------------
.../src/cpu/x86/vm/stubGenerator_x86_32.cpp | 41 +---------
.../src/cpu/x86/vm/stubGenerator_x86_64.cpp | 46 +-----------
.../src/cpu/zero/vm/stubGenerator_zero.cpp | 6 +-
hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp | 16 ++--
hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp | 6 +-
.../linux_aarch64/vm/os_linux_aarch64.cpp | 23 +-----
.../src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp | 14 ++--
.../os_cpu/linux_sparc/vm/os_linux_sparc.cpp | 8 +-
.../src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 6 +-
.../solaris_sparc/vm/os_solaris_sparc.cpp | 4 +-
.../os_cpu/solaris_x86/vm/os_solaris_x86.cpp | 6 +-
.../src/share/vm/runtime/sharedRuntime.cpp | 15 ++++
.../src/share/vm/runtime/sharedRuntime.hpp | 2 +
hotspot/src/share/vm/runtime/stubRoutines.cpp | 1 -
hotspot/src/share/vm/runtime/stubRoutines.hpp | 5 --
17 files changed, 54 insertions(+), 233 deletions(-)
diff --git a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
index 2eba3edacef..58222baa2fa 100644
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp
@@ -825,17 +825,6 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- // The following routine generates a subroutine to throw an asynchronous
- // UnknownError when an unsafe access gets a fault that could not be
- // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.)
- //
- address generate_handler_for_unsafe_access() {
- StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access");
- address start = __ function_entry();
- __ unimplemented("StubRoutines::handler_for_unsafe_access", 93);
- return start;
- }
-
#if !defined(PRODUCT)
// Wrapper which calls oopDesc::is_oop_or_null()
// Only called by MacroAssembler::verify_oop
@@ -3111,8 +3100,6 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError), false);
StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false);
- StubRoutines::_handler_for_unsafe_access_entry = generate_handler_for_unsafe_access();
-
// support for verify_oop (must happen after universe_init)
StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
index db2c5eefac8..efac738816a 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, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,20 +64,6 @@ static const Register& Lstub_temp = L2;
// -------------------------------------------------------------------------------------------------------------------------
// Stub Code definitions
-static address handle_unsafe_access() {
- JavaThread* thread = JavaThread::current();
- address pc = thread->saved_exception_pc();
- address npc = thread->saved_exception_npc();
- // pc is the instruction which we must emulate
- // doing a no-op is fine: return garbage from the load
-
- // request an async exception
- thread->set_pending_unsafe_access_error();
-
- // return address of next instruction to execute
- return npc;
-}
-
class StubGenerator: public StubCodeGenerator {
private:
@@ -746,62 +732,6 @@ class StubGenerator: public StubCodeGenerator {
Label _atomic_add_stub; // called from other stubs
- //------------------------------------------------------------------------------------------------------------------------
- // The following routine generates a subroutine to throw an asynchronous
- // UnknownError when an unsafe access gets a fault that could not be
- // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.)
- //
- // Arguments :
- //
- // trapping PC: O7
- //
- // Results:
- // posts an asynchronous exception, skips the trapping instruction
- //
-
- address generate_handler_for_unsafe_access() {
- StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access");
- address start = __ pc();
-
- const int preserve_register_words = (64 * 2);
- Address preserve_addr(FP, (-preserve_register_words * wordSize) + STACK_BIAS);
-
- Register Lthread = L7_thread_cache;
- int i;
-
- __ save_frame(0);
- __ mov(G1, L1);
- __ mov(G2, L2);
- __ mov(G3, L3);
- __ mov(G4, L4);
- __ mov(G5, L5);
- for (i = 0; i < 64; i += 2) {
- __ stf(FloatRegisterImpl::D, as_FloatRegister(i), preserve_addr, i * wordSize);
- }
-
- address entry_point = CAST_FROM_FN_PTR(address, handle_unsafe_access);
- BLOCK_COMMENT("call handle_unsafe_access");
- __ call(entry_point, relocInfo::runtime_call_type);
- __ delayed()->nop();
-
- __ mov(L1, G1);
- __ mov(L2, G2);
- __ mov(L3, G3);
- __ mov(L4, G4);
- __ mov(L5, G5);
- for (i = 0; i < 64; i += 2) {
- __ ldf(FloatRegisterImpl::D, preserve_addr, as_FloatRegister(i), i * wordSize);
- }
-
- __ verify_thread();
-
- __ jmp(O0, 0);
- __ delayed()->restore();
-
- return start;
- }
-
-
// Support for uint StubRoutine::Sparc::partial_subtype_check( Klass sub, Klass super );
// Arguments :
//
@@ -5380,9 +5310,6 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError));
StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call));
- StubRoutines::_handler_for_unsafe_access_entry =
- generate_handler_for_unsafe_access();
-
// support for verify_oop (must happen after universe_init)
StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop_subroutine();
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp
index 66a819a07f7..adcfe63b39f 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, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,21 +63,6 @@ const int FPU_CNTRL_WRD_MASK = 0xFFFF;
// -------------------------------------------------------------------------------------------------------------------------
// Stub Code definitions
-static address handle_unsafe_access() {
- JavaThread* thread = JavaThread::current();
- address pc = thread->saved_exception_pc();
- // pc is the instruction which we must emulate
- // doing a no-op is fine: return garbage from the load
- // therefore, compute npc
- address npc = Assembler::locate_next_instruction(pc);
-
- // request an async exception
- thread->set_pending_unsafe_access_error();
-
- // return address of next instruction to execute
- return npc;
-}
-
class StubGenerator: public StubCodeGenerator {
private:
@@ -623,27 +608,6 @@ class StubGenerator: public StubCodeGenerator {
}
- //---------------------------------------------------------------------------
- // The following routine generates a subroutine to throw an asynchronous
- // UnknownError when an unsafe access gets a fault that could not be
- // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.)
- address generate_handler_for_unsafe_access() {
- StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access");
- address start = __ pc();
-
- __ push(0); // hole for return address-to-be
- __ pusha(); // push registers
- Address next_pc(rsp, RegisterImpl::number_of_registers * BytesPerWord);
- BLOCK_COMMENT("call handle_unsafe_access");
- __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, handle_unsafe_access)));
- __ movptr(next_pc, rax); // stuff next address
- __ popa();
- __ ret(0); // jump to next address
-
- return start;
- }
-
-
//----------------------------------------------------------------------------------------------------
// Non-destructive plausibility checks for oops
@@ -3865,9 +3829,6 @@ class StubGenerator: public StubCodeGenerator {
// These are currently used by Solaris/Intel
StubRoutines::_atomic_xchg_entry = generate_atomic_xchg();
- StubRoutines::_handler_for_unsafe_access_entry =
- generate_handler_for_unsafe_access();
-
// platform dependent
create_control_words();
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index 3d8acc78947..9d3bb2d03df 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, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,21 +61,6 @@ const int MXCSR_MASK = 0xFFC0; // Mask out any pending exceptions
// Stub Code definitions
-static address handle_unsafe_access() {
- JavaThread* thread = JavaThread::current();
- address pc = thread->saved_exception_pc();
- // pc is the instruction which we must emulate
- // doing a no-op is fine: return garbage from the load
- // therefore, compute npc
- address npc = Assembler::locate_next_instruction(pc);
-
- // request an async exception
- thread->set_pending_unsafe_access_error();
-
- // return address of next instruction to execute
- return npc;
-}
-
class StubGenerator: public StubCodeGenerator {
private:
@@ -989,32 +974,6 @@ class StubGenerator: public StubCodeGenerator {
return start;
}
- // The following routine generates a subroutine to throw an
- // asynchronous UnknownError when an unsafe access gets a fault that
- // could not be reasonably prevented by the programmer. (Example:
- // SIGBUS/OBJERR.)
- address generate_handler_for_unsafe_access() {
- StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access");
- address start = __ pc();
-
- __ push(0); // hole for return address-to-be
- __ pusha(); // push registers
- Address next_pc(rsp, RegisterImpl::number_of_registers * BytesPerWord);
-
- // FIXME: this probably needs alignment logic
-
- __ subptr(rsp, frame::arg_reg_save_area_bytes);
- BLOCK_COMMENT("call handle_unsafe_access");
- __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, handle_unsafe_access)));
- __ addptr(rsp, frame::arg_reg_save_area_bytes);
-
- __ movptr(next_pc, rax); // stuff next address
- __ popa();
- __ ret(0); // jump to next address
-
- return start;
- }
-
// Non-destructive plausibility checks for oops
//
// Arguments:
@@ -5136,9 +5095,6 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr();
StubRoutines::_fence_entry = generate_orderaccess_fence();
- StubRoutines::_handler_for_unsafe_access_entry =
- generate_handler_for_unsafe_access();
-
// platform dependent
StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp();
StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp();
diff --git a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
index bdaec67cd73..9d64fb99e94 100644
--- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2010, 2015 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -261,10 +261,6 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_atomic_add_entry = ShouldNotCallThisStub();
StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub();
StubRoutines::_fence_entry = ShouldNotCallThisStub();
-
- // amd64 does this here, sparc does it in generate_all()
- StubRoutines::_handler_for_unsafe_access_entry =
- ShouldNotCallThisStub();
}
void generate_all() {
diff --git a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp
index 824d4d7a820..211a2dc3323 100644
--- a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp
+++ b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp
@@ -392,11 +392,9 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = cb->as_compiled_method_or_null();
if (nm != NULL && nm->has_unsafe_access()) {
- // We don't really need a stub here! Just set the pending exeption and
- // continue at the next instruction after the faulting read. Returning
- // garbage from this read is ok.
- thread->set_pending_unsafe_access_error();
- os::Aix::ucontext_set_pc(uc, pc + 4);
+ address next_pc = pc + 4;
+ next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
+ os::Aix::ucontext_set_pc(uc, next_pc);
return 1;
}
}
@@ -415,11 +413,9 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec
}
else if (thread->thread_state() == _thread_in_vm &&
sig == SIGBUS && thread->doing_unsafe_access()) {
- // We don't really need a stub here! Just set the pending exeption and
- // continue at the next instruction after the faulting read. Returning
- // garbage from this read is ok.
- thread->set_pending_unsafe_access_error();
- os::Aix::ucontext_set_pc(uc, pc + 4);
+ address next_pc = pc + 4;
+ next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
+ os::Aix::ucontext_set_pc(uc, next_pc);
return 1;
}
}
diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
index 911dfe50fed..9fe34fc1770 100644
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp
@@ -584,7 +584,8 @@ JVM_handle_bsd_signal(int sig,
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ address next_pc = Assembler::locate_next_instruction(pc);
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
else
@@ -655,7 +656,8 @@ JVM_handle_bsd_signal(int sig,
} else if (thread->thread_state() == _thread_in_vm &&
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
thread->doing_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ address next_pc = Assembler::locate_next_instruction(pc);
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
// jni_fast_GetField can trap at certain pc's if a GC kicks in
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
index e6070b63dd6..04179925e67 100644
--- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
@@ -226,23 +226,6 @@ extern "C" void FetchNPFI () ;
extern "C" void FetchNResume () ;
#endif
-// An operation in Unsafe has faulted. We're going to return to the
-// instruction after the faulting load or store. We also set
-// pending_unsafe_access_error so that at some point in the future our
-// user will get a helpful message.
-static address handle_unsafe_access(JavaThread* thread, address pc) {
- // pc is the instruction which we must emulate
- // doing a no-op is fine: return garbage from the load
- // therefore, compute npc
- address npc = pc + NativeCall::instruction_size;
-
- // request an async exception
- thread->set_pending_unsafe_access_error();
-
- // return address of next instruction to execute
- return npc;
-}
-
extern "C" JNIEXPORT int
JVM_handle_linux_signal(int sig,
siginfo_t* info,
@@ -387,7 +370,8 @@ JVM_handle_linux_signal(int sig,
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
- stub = handle_unsafe_access(thread, pc);
+ address next_pc = pc + NativeCall::instruction_size;
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
else
@@ -408,7 +392,8 @@ JVM_handle_linux_signal(int sig,
} else if (thread->thread_state() == _thread_in_vm &&
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
thread->doing_unsafe_access()) {
- stub = handle_unsafe_access(thread, pc);
+ address next_pc = pc + NativeCall::instruction_size;
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
// jni_fast_GetField can trap at certain pc's if a GC kicks in
diff --git a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
index 7ecf0ad8263..8cd04dce290 100644
--- a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
+++ b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
@@ -366,11 +366,9 @@ JVM_handle_linux_signal(int sig,
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
- // We don't really need a stub here! Just set the pending exeption and
- // continue at the next instruction after the faulting read. Returning
- // garbage from this read is ok.
- thread->set_pending_unsafe_access_error();
- os::Linux::ucontext_set_pc(uc, pc + 4);
+ address next_pc = pc + 4;
+ next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
+ os::Linux::ucontext_set_pc(uc, next_pc);
return true;
}
}
@@ -385,10 +383,8 @@ JVM_handle_linux_signal(int sig,
}
else if (thread->thread_state() == _thread_in_vm &&
sig == SIGBUS && thread->doing_unsafe_access()) {
- // We don't really need a stub here! Just set the pending exeption and
- // continue at the next instruction after the faulting read. Returning
- // garbage from this read is ok.
- thread->set_pending_unsafe_access_error();
+ address next_pc = pc + 4;
+ next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc);
os::Linux::ucontext_set_pc(uc, pc + 4);
return true;
}
diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
index 4f83c606600..4a0da12c498 100644
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp
@@ -433,14 +433,14 @@ inline static bool checkPollingPage(address pc, address fault, address* stub) {
return false;
}
-inline static bool checkByteBuffer(address pc, address* stub) {
+inline static bool checkByteBuffer(address pc, address npc, address* stub) {
// BugId 4454115: A read from a MappedByteBuffer can fault
// here if the underlying file has been truncated.
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = cb->as_compiled_method_or_null();
if (nm != NULL && nm->has_unsafe_access()) {
- *stub = StubRoutines::handler_for_unsafe_access();
+ *stub = SharedRuntime::handle_unsafe_access(thread, npc);
return true;
}
return false;
@@ -613,7 +613,7 @@ JVM_handle_linux_signal(int sig,
if (sig == SIGBUS &&
thread->thread_state() == _thread_in_vm &&
thread->doing_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ stub = SharedRuntime::handle_unsafe_access(thread, npc);
}
if (thread->thread_state() == _thread_in_Java) {
@@ -625,7 +625,7 @@ JVM_handle_linux_signal(int sig,
break;
}
- if ((sig == SIGBUS) && checkByteBuffer(pc, &stub)) {
+ if ((sig == SIGBUS) && checkByteBuffer(pc, npc, &stub)) {
break;
}
diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index 7d7aad54046..b73658ed036 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -420,7 +420,8 @@ JVM_handle_linux_signal(int sig,
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ address next_pc = Assembler::locate_next_instruction(pc);
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
else
@@ -469,7 +470,8 @@ JVM_handle_linux_signal(int sig,
} else if (thread->thread_state() == _thread_in_vm &&
sig == SIGBUS && /* info->si_code == BUS_OBJERR && */
thread->doing_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ address next_pc = Assembler::locate_next_instruction(pc);
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
// jni_fast_GetField can trap at certain pc's if a GC kicks in
diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
index 0fd9adf3c03..39663ed0e74 100644
--- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp
@@ -441,7 +441,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
if (thread->thread_state() == _thread_in_vm) {
if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ stub = SharedRuntime::handle_unsafe_access(thread, npc);
}
}
@@ -480,7 +480,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
CompiledMethod* nm = cb->as_compiled_method_or_null();
if (nm != NULL && nm->has_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ stub = SharedRuntime::handle_unsafe_access(thread, npc);
}
}
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
index d1bc192646d..695fc127835 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp
@@ -503,7 +503,8 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
if (thread->thread_state() == _thread_in_vm) {
if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ address next_pc = Assembler::locate_next_instruction(pc);
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
@@ -520,7 +521,8 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
if (cb != NULL) {
CompiledMethod* nm = cb->as_compiled_method_or_null();
if (nm != NULL && nm->has_unsafe_access()) {
- stub = StubRoutines::handler_for_unsafe_access();
+ address next_pc = Assembler::locate_next_instruction(pc);
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
}
}
}
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
index 0824a8a56df..4e0aec4a423 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
@@ -1762,6 +1762,21 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) {
return callee_method;
}
+address SharedRuntime::handle_unsafe_access(JavaThread* thread, address next_pc) {
+ // The faulting unsafe accesses should be changed to throw the error
+ // synchronously instead. Meanwhile the faulting instruction will be
+ // skipped over (effectively turning it into a no-op) and an
+ // asynchronous exception will be raised which the thread will
+ // handle at a later point. If the instruction is a load it will
+ // return garbage.
+
+ // Request an async exception.
+ thread->set_pending_unsafe_access_error();
+
+ // Return address of next instruction to execute.
+ return next_pc;
+}
+
#ifdef ASSERT
void SharedRuntime::check_member_name_argument_is_last_argument(const methodHandle& method,
const BasicType* sig_bt,
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
index 52bca29cf72..eb9797f26f5 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp
@@ -522,6 +522,8 @@ class SharedRuntime: AllStatic {
static address handle_wrong_method_abstract(JavaThread* thread);
static address handle_wrong_method_ic_miss(JavaThread* thread);
+ static address handle_unsafe_access(JavaThread* thread, address next_pc);
+
#ifndef PRODUCT
// Collect and print inline cache miss statistics
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp
index 8a8f0fd4762..12e0e3a5b82 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp
@@ -55,7 +55,6 @@ address StubRoutines::_throw_IncompatibleClassChangeError_entry = NULL;
address StubRoutines::_throw_NullPointerException_at_call_entry = NULL;
address StubRoutines::_throw_StackOverflowError_entry = NULL;
address StubRoutines::_throw_delayed_StackOverflowError_entry = NULL;
-address StubRoutines::_handler_for_unsafe_access_entry = NULL;
jint StubRoutines::_verify_oop_count = 0;
address StubRoutines::_verify_oop_subroutine_entry = NULL;
address StubRoutines::_atomic_xchg_entry = NULL;
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
index 49f3550c273..729886f04fd 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
@@ -111,7 +111,6 @@ class StubRoutines: AllStatic {
static address _throw_NullPointerException_at_call_entry;
static address _throw_StackOverflowError_entry;
static address _throw_delayed_StackOverflowError_entry;
- static address _handler_for_unsafe_access_entry;
static address _atomic_xchg_entry;
static address _atomic_xchg_ptr_entry;
@@ -288,10 +287,6 @@ class StubRoutines: AllStatic {
static address throw_StackOverflowError_entry() { return _throw_StackOverflowError_entry; }
static address throw_delayed_StackOverflowError_entry() { return _throw_delayed_StackOverflowError_entry; }
- // Exceptions during unsafe access - should throw Java exception rather
- // than crash.
- static address handler_for_unsafe_access() { return _handler_for_unsafe_access_entry; }
-
static address atomic_xchg_entry() { return _atomic_xchg_entry; }
static address atomic_xchg_ptr_entry() { return _atomic_xchg_ptr_entry; }
static address atomic_store_entry() { return _atomic_store_entry; }
From e9b0eedbc77a2a5ab998723edbc9fcea7372dac7 Mon Sep 17 00:00:00 2001
From: Vladimir Kozlov
Date: Fri, 6 May 2016 15:41:08 -0700
Subject: [PATCH 002/381] 8156480: Quarantine
compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java
Reviewed-by: dcubed
---
.../compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java
index 154c3b28bd2..14e53044357 100644
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8136421
+ * @ignore 8155216
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
* @library / /testlibrary /test/lib/
* @library ../common/patches
From fd9f92e18de45f899f0b14b6f0a175e796cd8479 Mon Sep 17 00:00:00 2001
From: Mikael Vidstedt
Date: Fri, 6 May 2016 15:59:26 -0700
Subject: [PATCH 003/381] 8150921: Update Unsafe getters/setters to use
double-register variants
Reviewed-by: dholmes, shade, psandoz, jrose
---
hotspot/src/share/vm/c1/c1_Compiler.cpp | 14 -
hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 14 -
hotspot/src/share/vm/classfile/vmSymbols.cpp | 16 -
hotspot/src/share/vm/classfile/vmSymbols.hpp | 37 ---
hotspot/src/share/vm/opto/c2compiler.cpp | 16 -
hotspot/src/share/vm/opto/library_call.cpp | 253 +++++++--------
hotspot/src/share/vm/prims/unsafe.cpp | 309 +++++++++----------
7 files changed, 251 insertions(+), 408 deletions(-)
diff --git a/hotspot/src/share/vm/c1/c1_Compiler.cpp b/hotspot/src/share/vm/c1/c1_Compiler.cpp
index 4903ab682f3..c3a55b4f1f7 100644
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp
@@ -198,20 +198,6 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
case vmIntrinsics::_putLongVolatile:
case vmIntrinsics::_putFloatVolatile:
case vmIntrinsics::_putDoubleVolatile:
- case vmIntrinsics::_getByte_raw:
- case vmIntrinsics::_getShort_raw:
- case vmIntrinsics::_getChar_raw:
- case vmIntrinsics::_getInt_raw:
- case vmIntrinsics::_getLong_raw:
- case vmIntrinsics::_getFloat_raw:
- case vmIntrinsics::_getDouble_raw:
- case vmIntrinsics::_putByte_raw:
- case vmIntrinsics::_putShort_raw:
- case vmIntrinsics::_putChar_raw:
- case vmIntrinsics::_putInt_raw:
- case vmIntrinsics::_putLong_raw:
- case vmIntrinsics::_putFloat_raw:
- case vmIntrinsics::_putDouble_raw:
case vmIntrinsics::_getShortUnaligned:
case vmIntrinsics::_getCharUnaligned:
case vmIntrinsics::_getIntUnaligned:
diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
index 2b4d36300a1..69d475ac939 100644
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
@@ -3465,20 +3465,6 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee) {
case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return;
case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return;
case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return;
- case vmIntrinsics::_getByte_raw : append_unsafe_get_raw(callee, T_BYTE ); return;
- case vmIntrinsics::_getShort_raw : append_unsafe_get_raw(callee, T_SHORT ); return;
- case vmIntrinsics::_getChar_raw : append_unsafe_get_raw(callee, T_CHAR ); return;
- case vmIntrinsics::_getInt_raw : append_unsafe_get_raw(callee, T_INT ); return;
- case vmIntrinsics::_getLong_raw : append_unsafe_get_raw(callee, T_LONG ); return;
- case vmIntrinsics::_getFloat_raw : append_unsafe_get_raw(callee, T_FLOAT ); return;
- case vmIntrinsics::_getDouble_raw : append_unsafe_get_raw(callee, T_DOUBLE); return;
- case vmIntrinsics::_putByte_raw : append_unsafe_put_raw(callee, T_BYTE ); return;
- case vmIntrinsics::_putShort_raw : append_unsafe_put_raw(callee, T_SHORT ); return;
- case vmIntrinsics::_putChar_raw : append_unsafe_put_raw(callee, T_CHAR ); return;
- case vmIntrinsics::_putInt_raw : append_unsafe_put_raw(callee, T_INT ); return;
- case vmIntrinsics::_putLong_raw : append_unsafe_put_raw(callee, T_LONG ); return;
- case vmIntrinsics::_putFloat_raw : append_unsafe_put_raw(callee, T_FLOAT ); return;
- case vmIntrinsics::_putDouble_raw : append_unsafe_put_raw(callee, T_DOUBLE); return;
case vmIntrinsics::_compareAndSwapLong:
case vmIntrinsics::_compareAndSwapInt:
case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return;
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.cpp b/hotspot/src/share/vm/classfile/vmSymbols.cpp
index 42555054305..4c46cb98780 100644
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp
@@ -578,20 +578,6 @@ bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) {
case vmIntrinsics::_putLongOpaque:
case vmIntrinsics::_putFloatOpaque:
case vmIntrinsics::_putDoubleOpaque:
- case vmIntrinsics::_getByte_raw:
- case vmIntrinsics::_getShort_raw:
- case vmIntrinsics::_getChar_raw:
- case vmIntrinsics::_getInt_raw:
- case vmIntrinsics::_getLong_raw:
- case vmIntrinsics::_getFloat_raw:
- case vmIntrinsics::_getDouble_raw:
- case vmIntrinsics::_putByte_raw:
- case vmIntrinsics::_putShort_raw:
- case vmIntrinsics::_putChar_raw:
- case vmIntrinsics::_putInt_raw:
- case vmIntrinsics::_putLong_raw:
- case vmIntrinsics::_putFloat_raw:
- case vmIntrinsics::_putDouble_raw:
case vmIntrinsics::_getAndAddInt:
case vmIntrinsics::_getAndAddLong:
case vmIntrinsics::_getAndSetInt:
@@ -632,8 +618,6 @@ bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) {
case vmIntrinsics::_putIntUnaligned:
case vmIntrinsics::_putLongUnaligned:
case vmIntrinsics::_allocateInstance:
- case vmIntrinsics::_getAddress_raw:
- case vmIntrinsics::_putAddress_raw:
if (!InlineUnsafeOps || !UseUnalignedAccesses) return true;
break;
case vmIntrinsics::_hashCode:
diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp
index 6f4d4c65ee6..50db4d6a87b 100644
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp
@@ -1231,43 +1231,6 @@
do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \
do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \
\
- /* %%% these are redundant except perhaps for getAddress, but Unsafe has native methods for them */ \
- do_signature(getByte_raw_signature, "(J)B") \
- do_signature(putByte_raw_signature, "(JB)V") \
- do_signature(getShort_raw_signature, "(J)S") \
- do_signature(putShort_raw_signature, "(JS)V") \
- do_signature(getChar_raw_signature, "(J)C") \
- do_signature(putChar_raw_signature, "(JC)V") \
- do_signature(putInt_raw_signature, "(JI)V") \
- do_alias(getLong_raw_signature, /*(J)J*/ long_long_signature) \
- do_alias(putLong_raw_signature, /*(JJ)V*/ long_long_void_signature) \
- do_signature(getFloat_raw_signature, "(J)F") \
- do_signature(putFloat_raw_signature, "(JF)V") \
- do_alias(getDouble_raw_signature, /*(J)D*/ long_double_signature) \
- do_signature(putDouble_raw_signature, "(JD)V") \
- do_alias(getAddress_raw_signature, /*(J)J*/ long_long_signature) \
- do_alias(putAddress_raw_signature, /*(JJ)V*/ long_long_void_signature) \
- \
- do_name( getAddress_name, "getAddress") \
- do_name( putAddress_name, "putAddress") \
- \
- do_intrinsic(_getByte_raw, jdk_internal_misc_Unsafe, getByte_name, getByte_raw_signature, F_R) \
- do_intrinsic(_getShort_raw, jdk_internal_misc_Unsafe, getShort_name, getShort_raw_signature, F_R) \
- do_intrinsic(_getChar_raw, jdk_internal_misc_Unsafe, getChar_name, getChar_raw_signature, F_R) \
- do_intrinsic(_getInt_raw, jdk_internal_misc_Unsafe, getInt_name, long_int_signature, F_R) \
- do_intrinsic(_getLong_raw, jdk_internal_misc_Unsafe, getLong_name, getLong_raw_signature, F_R) \
- do_intrinsic(_getFloat_raw, jdk_internal_misc_Unsafe, getFloat_name, getFloat_raw_signature, F_R) \
- do_intrinsic(_getDouble_raw, jdk_internal_misc_Unsafe, getDouble_name, getDouble_raw_signature, F_R) \
- do_intrinsic(_getAddress_raw, jdk_internal_misc_Unsafe, getAddress_name, getAddress_raw_signature, F_R) \
- do_intrinsic(_putByte_raw, jdk_internal_misc_Unsafe, putByte_name, putByte_raw_signature, F_R) \
- do_intrinsic(_putShort_raw, jdk_internal_misc_Unsafe, putShort_name, putShort_raw_signature, F_R) \
- do_intrinsic(_putChar_raw, jdk_internal_misc_Unsafe, putChar_name, putChar_raw_signature, F_R) \
- do_intrinsic(_putInt_raw, jdk_internal_misc_Unsafe, putInt_name, putInt_raw_signature, F_R) \
- do_intrinsic(_putLong_raw, jdk_internal_misc_Unsafe, putLong_name, putLong_raw_signature, F_R) \
- do_intrinsic(_putFloat_raw, jdk_internal_misc_Unsafe, putFloat_name, putFloat_raw_signature, F_R) \
- do_intrinsic(_putDouble_raw, jdk_internal_misc_Unsafe, putDouble_name, putDouble_raw_signature, F_R) \
- do_intrinsic(_putAddress_raw, jdk_internal_misc_Unsafe, putAddress_name, putAddress_raw_signature, F_R) \
- \
do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
do_signature(compareAndExchangeObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \
do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \
diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp
index b46b3c8d30f..1480ebf8fec 100644
--- a/hotspot/src/share/vm/opto/c2compiler.cpp
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp
@@ -409,22 +409,6 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
case vmIntrinsics::_putLong:
case vmIntrinsics::_putFloat:
case vmIntrinsics::_putDouble:
- case vmIntrinsics::_getByte_raw:
- case vmIntrinsics::_getShort_raw:
- case vmIntrinsics::_getChar_raw:
- case vmIntrinsics::_getInt_raw:
- case vmIntrinsics::_getLong_raw:
- case vmIntrinsics::_getFloat_raw:
- case vmIntrinsics::_getDouble_raw:
- case vmIntrinsics::_getAddress_raw:
- case vmIntrinsics::_putByte_raw:
- case vmIntrinsics::_putShort_raw:
- case vmIntrinsics::_putChar_raw:
- case vmIntrinsics::_putInt_raw:
- case vmIntrinsics::_putLong_raw:
- case vmIntrinsics::_putFloat_raw:
- case vmIntrinsics::_putDouble_raw:
- case vmIntrinsics::_putAddress_raw:
case vmIntrinsics::_getObjectVolatile:
case vmIntrinsics::_getBooleanVolatile:
case vmIntrinsics::_getByteVolatile:
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index aca79cbc6e2..3645c7e5f84 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -93,7 +93,7 @@ class LibraryCallKit : public GraphKit {
Node* _result; // the result node, if any
int _reexecute_sp; // the stack pointer when bytecode needs to be reexecuted
- const TypeOopPtr* sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type, bool is_native_ptr = false);
+ const TypeOopPtr* sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type);
public:
LibraryCallKit(JVMState* jvms, LibraryIntrinsic* intrinsic)
@@ -247,7 +247,7 @@ class LibraryCallKit : public GraphKit {
void insert_pre_barrier(Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar);
typedef enum { Relaxed, Opaque, Volatile, Acquire, Release } AccessKind;
- bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, AccessKind kind, bool is_unaligned);
+ bool inline_unsafe_access(bool is_store, BasicType type, AccessKind kind, bool is_unaligned);
static bool klass_needs_init_guard(Node* kls);
bool inline_unsafe_allocate();
bool inline_unsafe_newArray(bool uninitialized);
@@ -475,7 +475,6 @@ bool LibraryCallKit::try_to_inline(int predicate) {
// Handle symbolic names for otherwise undistinguished boolean switches:
const bool is_store = true;
const bool is_compress = true;
- const bool is_native_ptr = true;
const bool is_static = true;
const bool is_volatile = true;
@@ -555,113 +554,95 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_inflateStringC:
case vmIntrinsics::_inflateStringB: return inline_string_copy(!is_compress);
- case vmIntrinsics::_getObject: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Relaxed, false);
- case vmIntrinsics::_getBoolean: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Relaxed, false);
- case vmIntrinsics::_getByte: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Relaxed, false);
- case vmIntrinsics::_getShort: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Relaxed, false);
- case vmIntrinsics::_getChar: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Relaxed, false);
- case vmIntrinsics::_getInt: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Relaxed, false);
- case vmIntrinsics::_getLong: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Relaxed, false);
- case vmIntrinsics::_getFloat: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Relaxed, false);
- case vmIntrinsics::_getDouble: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Relaxed, false);
+ case vmIntrinsics::_getObject: return inline_unsafe_access(!is_store, T_OBJECT, Relaxed, false);
+ case vmIntrinsics::_getBoolean: return inline_unsafe_access(!is_store, T_BOOLEAN, Relaxed, false);
+ case vmIntrinsics::_getByte: return inline_unsafe_access(!is_store, T_BYTE, Relaxed, false);
+ case vmIntrinsics::_getShort: return inline_unsafe_access(!is_store, T_SHORT, Relaxed, false);
+ case vmIntrinsics::_getChar: return inline_unsafe_access(!is_store, T_CHAR, Relaxed, false);
+ case vmIntrinsics::_getInt: return inline_unsafe_access(!is_store, T_INT, Relaxed, false);
+ case vmIntrinsics::_getLong: return inline_unsafe_access(!is_store, T_LONG, Relaxed, false);
+ case vmIntrinsics::_getFloat: return inline_unsafe_access(!is_store, T_FLOAT, Relaxed, false);
+ case vmIntrinsics::_getDouble: return inline_unsafe_access(!is_store, T_DOUBLE, Relaxed, false);
- case vmIntrinsics::_putObject: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Relaxed, false);
- case vmIntrinsics::_putBoolean: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Relaxed, false);
- case vmIntrinsics::_putByte: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Relaxed, false);
- case vmIntrinsics::_putShort: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Relaxed, false);
- case vmIntrinsics::_putChar: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Relaxed, false);
- case vmIntrinsics::_putInt: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Relaxed, false);
- case vmIntrinsics::_putLong: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Relaxed, false);
- case vmIntrinsics::_putFloat: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Relaxed, false);
- case vmIntrinsics::_putDouble: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Relaxed, false);
+ case vmIntrinsics::_putObject: return inline_unsafe_access( is_store, T_OBJECT, Relaxed, false);
+ case vmIntrinsics::_putBoolean: return inline_unsafe_access( is_store, T_BOOLEAN, Relaxed, false);
+ case vmIntrinsics::_putByte: return inline_unsafe_access( is_store, T_BYTE, Relaxed, false);
+ case vmIntrinsics::_putShort: return inline_unsafe_access( is_store, T_SHORT, Relaxed, false);
+ case vmIntrinsics::_putChar: return inline_unsafe_access( is_store, T_CHAR, Relaxed, false);
+ case vmIntrinsics::_putInt: return inline_unsafe_access( is_store, T_INT, Relaxed, false);
+ case vmIntrinsics::_putLong: return inline_unsafe_access( is_store, T_LONG, Relaxed, false);
+ case vmIntrinsics::_putFloat: return inline_unsafe_access( is_store, T_FLOAT, Relaxed, false);
+ case vmIntrinsics::_putDouble: return inline_unsafe_access( is_store, T_DOUBLE, Relaxed, false);
- case vmIntrinsics::_getByte_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_BYTE, Relaxed, false);
- case vmIntrinsics::_getShort_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_SHORT, Relaxed, false);
- case vmIntrinsics::_getChar_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_CHAR, Relaxed, false);
- case vmIntrinsics::_getInt_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_INT, Relaxed, false);
- case vmIntrinsics::_getLong_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_LONG, Relaxed, false);
- case vmIntrinsics::_getFloat_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_FLOAT, Relaxed, false);
- case vmIntrinsics::_getDouble_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_DOUBLE, Relaxed, false);
- case vmIntrinsics::_getAddress_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_ADDRESS, Relaxed, false);
+ case vmIntrinsics::_getObjectVolatile: return inline_unsafe_access(!is_store, T_OBJECT, Volatile, false);
+ case vmIntrinsics::_getBooleanVolatile: return inline_unsafe_access(!is_store, T_BOOLEAN, Volatile, false);
+ case vmIntrinsics::_getByteVolatile: return inline_unsafe_access(!is_store, T_BYTE, Volatile, false);
+ case vmIntrinsics::_getShortVolatile: return inline_unsafe_access(!is_store, T_SHORT, Volatile, false);
+ case vmIntrinsics::_getCharVolatile: return inline_unsafe_access(!is_store, T_CHAR, Volatile, false);
+ case vmIntrinsics::_getIntVolatile: return inline_unsafe_access(!is_store, T_INT, Volatile, false);
+ case vmIntrinsics::_getLongVolatile: return inline_unsafe_access(!is_store, T_LONG, Volatile, false);
+ case vmIntrinsics::_getFloatVolatile: return inline_unsafe_access(!is_store, T_FLOAT, Volatile, false);
+ case vmIntrinsics::_getDoubleVolatile: return inline_unsafe_access(!is_store, T_DOUBLE, Volatile, false);
- case vmIntrinsics::_putByte_raw: return inline_unsafe_access( is_native_ptr, is_store, T_BYTE, Relaxed, false);
- case vmIntrinsics::_putShort_raw: return inline_unsafe_access( is_native_ptr, is_store, T_SHORT, Relaxed, false);
- case vmIntrinsics::_putChar_raw: return inline_unsafe_access( is_native_ptr, is_store, T_CHAR, Relaxed, false);
- case vmIntrinsics::_putInt_raw: return inline_unsafe_access( is_native_ptr, is_store, T_INT, Relaxed, false);
- case vmIntrinsics::_putLong_raw: return inline_unsafe_access( is_native_ptr, is_store, T_LONG, Relaxed, false);
- case vmIntrinsics::_putFloat_raw: return inline_unsafe_access( is_native_ptr, is_store, T_FLOAT, Relaxed, false);
- case vmIntrinsics::_putDouble_raw: return inline_unsafe_access( is_native_ptr, is_store, T_DOUBLE, Relaxed, false);
- case vmIntrinsics::_putAddress_raw: return inline_unsafe_access( is_native_ptr, is_store, T_ADDRESS, Relaxed, false);
+ case vmIntrinsics::_putObjectVolatile: return inline_unsafe_access( is_store, T_OBJECT, Volatile, false);
+ case vmIntrinsics::_putBooleanVolatile: return inline_unsafe_access( is_store, T_BOOLEAN, Volatile, false);
+ case vmIntrinsics::_putByteVolatile: return inline_unsafe_access( is_store, T_BYTE, Volatile, false);
+ case vmIntrinsics::_putShortVolatile: return inline_unsafe_access( is_store, T_SHORT, Volatile, false);
+ case vmIntrinsics::_putCharVolatile: return inline_unsafe_access( is_store, T_CHAR, Volatile, false);
+ case vmIntrinsics::_putIntVolatile: return inline_unsafe_access( is_store, T_INT, Volatile, false);
+ case vmIntrinsics::_putLongVolatile: return inline_unsafe_access( is_store, T_LONG, Volatile, false);
+ case vmIntrinsics::_putFloatVolatile: return inline_unsafe_access( is_store, T_FLOAT, Volatile, false);
+ case vmIntrinsics::_putDoubleVolatile: return inline_unsafe_access( is_store, T_DOUBLE, Volatile, false);
- case vmIntrinsics::_getObjectVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Volatile, false);
- case vmIntrinsics::_getBooleanVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Volatile, false);
- case vmIntrinsics::_getByteVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Volatile, false);
- case vmIntrinsics::_getShortVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Volatile, false);
- case vmIntrinsics::_getCharVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Volatile, false);
- case vmIntrinsics::_getIntVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Volatile, false);
- case vmIntrinsics::_getLongVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Volatile, false);
- case vmIntrinsics::_getFloatVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Volatile, false);
- case vmIntrinsics::_getDoubleVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Volatile, false);
+ case vmIntrinsics::_getShortUnaligned: return inline_unsafe_access(!is_store, T_SHORT, Relaxed, true);
+ case vmIntrinsics::_getCharUnaligned: return inline_unsafe_access(!is_store, T_CHAR, Relaxed, true);
+ case vmIntrinsics::_getIntUnaligned: return inline_unsafe_access(!is_store, T_INT, Relaxed, true);
+ case vmIntrinsics::_getLongUnaligned: return inline_unsafe_access(!is_store, T_LONG, Relaxed, true);
- case vmIntrinsics::_putObjectVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Volatile, false);
- case vmIntrinsics::_putBooleanVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Volatile, false);
- case vmIntrinsics::_putByteVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Volatile, false);
- case vmIntrinsics::_putShortVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Volatile, false);
- case vmIntrinsics::_putCharVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Volatile, false);
- case vmIntrinsics::_putIntVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Volatile, false);
- case vmIntrinsics::_putLongVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Volatile, false);
- case vmIntrinsics::_putFloatVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Volatile, false);
- case vmIntrinsics::_putDoubleVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Volatile, false);
+ case vmIntrinsics::_putShortUnaligned: return inline_unsafe_access( is_store, T_SHORT, Relaxed, true);
+ case vmIntrinsics::_putCharUnaligned: return inline_unsafe_access( is_store, T_CHAR, Relaxed, true);
+ case vmIntrinsics::_putIntUnaligned: return inline_unsafe_access( is_store, T_INT, Relaxed, true);
+ case vmIntrinsics::_putLongUnaligned: return inline_unsafe_access( is_store, T_LONG, Relaxed, true);
- case vmIntrinsics::_getShortUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Relaxed, true);
- case vmIntrinsics::_getCharUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Relaxed, true);
- case vmIntrinsics::_getIntUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Relaxed, true);
- case vmIntrinsics::_getLongUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Relaxed, true);
+ case vmIntrinsics::_getObjectAcquire: return inline_unsafe_access(!is_store, T_OBJECT, Acquire, false);
+ case vmIntrinsics::_getBooleanAcquire: return inline_unsafe_access(!is_store, T_BOOLEAN, Acquire, false);
+ case vmIntrinsics::_getByteAcquire: return inline_unsafe_access(!is_store, T_BYTE, Acquire, false);
+ case vmIntrinsics::_getShortAcquire: return inline_unsafe_access(!is_store, T_SHORT, Acquire, false);
+ case vmIntrinsics::_getCharAcquire: return inline_unsafe_access(!is_store, T_CHAR, Acquire, false);
+ case vmIntrinsics::_getIntAcquire: return inline_unsafe_access(!is_store, T_INT, Acquire, false);
+ case vmIntrinsics::_getLongAcquire: return inline_unsafe_access(!is_store, T_LONG, Acquire, false);
+ case vmIntrinsics::_getFloatAcquire: return inline_unsafe_access(!is_store, T_FLOAT, Acquire, false);
+ case vmIntrinsics::_getDoubleAcquire: return inline_unsafe_access(!is_store, T_DOUBLE, Acquire, false);
- case vmIntrinsics::_putShortUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Relaxed, true);
- case vmIntrinsics::_putCharUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Relaxed, true);
- case vmIntrinsics::_putIntUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Relaxed, true);
- case vmIntrinsics::_putLongUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Relaxed, true);
+ case vmIntrinsics::_putObjectRelease: return inline_unsafe_access( is_store, T_OBJECT, Release, false);
+ case vmIntrinsics::_putBooleanRelease: return inline_unsafe_access( is_store, T_BOOLEAN, Release, false);
+ case vmIntrinsics::_putByteRelease: return inline_unsafe_access( is_store, T_BYTE, Release, false);
+ case vmIntrinsics::_putShortRelease: return inline_unsafe_access( is_store, T_SHORT, Release, false);
+ case vmIntrinsics::_putCharRelease: return inline_unsafe_access( is_store, T_CHAR, Release, false);
+ case vmIntrinsics::_putIntRelease: return inline_unsafe_access( is_store, T_INT, Release, false);
+ case vmIntrinsics::_putLongRelease: return inline_unsafe_access( is_store, T_LONG, Release, false);
+ case vmIntrinsics::_putFloatRelease: return inline_unsafe_access( is_store, T_FLOAT, Release, false);
+ case vmIntrinsics::_putDoubleRelease: return inline_unsafe_access( is_store, T_DOUBLE, Release, false);
- case vmIntrinsics::_getObjectAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Acquire, false);
- case vmIntrinsics::_getBooleanAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Acquire, false);
- case vmIntrinsics::_getByteAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Acquire, false);
- case vmIntrinsics::_getShortAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Acquire, false);
- case vmIntrinsics::_getCharAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Acquire, false);
- case vmIntrinsics::_getIntAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Acquire, false);
- case vmIntrinsics::_getLongAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Acquire, false);
- case vmIntrinsics::_getFloatAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Acquire, false);
- case vmIntrinsics::_getDoubleAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Acquire, false);
+ case vmIntrinsics::_getObjectOpaque: return inline_unsafe_access(!is_store, T_OBJECT, Opaque, false);
+ case vmIntrinsics::_getBooleanOpaque: return inline_unsafe_access(!is_store, T_BOOLEAN, Opaque, false);
+ case vmIntrinsics::_getByteOpaque: return inline_unsafe_access(!is_store, T_BYTE, Opaque, false);
+ case vmIntrinsics::_getShortOpaque: return inline_unsafe_access(!is_store, T_SHORT, Opaque, false);
+ case vmIntrinsics::_getCharOpaque: return inline_unsafe_access(!is_store, T_CHAR, Opaque, false);
+ case vmIntrinsics::_getIntOpaque: return inline_unsafe_access(!is_store, T_INT, Opaque, false);
+ case vmIntrinsics::_getLongOpaque: return inline_unsafe_access(!is_store, T_LONG, Opaque, false);
+ case vmIntrinsics::_getFloatOpaque: return inline_unsafe_access(!is_store, T_FLOAT, Opaque, false);
+ case vmIntrinsics::_getDoubleOpaque: return inline_unsafe_access(!is_store, T_DOUBLE, Opaque, false);
- case vmIntrinsics::_putObjectRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Release, false);
- case vmIntrinsics::_putBooleanRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Release, false);
- case vmIntrinsics::_putByteRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Release, false);
- case vmIntrinsics::_putShortRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Release, false);
- case vmIntrinsics::_putCharRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Release, false);
- case vmIntrinsics::_putIntRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Release, false);
- case vmIntrinsics::_putLongRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Release, false);
- case vmIntrinsics::_putFloatRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Release, false);
- case vmIntrinsics::_putDoubleRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Release, false);
-
- case vmIntrinsics::_getObjectOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Opaque, false);
- case vmIntrinsics::_getBooleanOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Opaque, false);
- case vmIntrinsics::_getByteOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Opaque, false);
- case vmIntrinsics::_getShortOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Opaque, false);
- case vmIntrinsics::_getCharOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Opaque, false);
- case vmIntrinsics::_getIntOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Opaque, false);
- case vmIntrinsics::_getLongOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Opaque, false);
- case vmIntrinsics::_getFloatOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Opaque, false);
- case vmIntrinsics::_getDoubleOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Opaque, false);
-
- case vmIntrinsics::_putObjectOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Opaque, false);
- case vmIntrinsics::_putBooleanOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Opaque, false);
- case vmIntrinsics::_putByteOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Opaque, false);
- case vmIntrinsics::_putShortOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Opaque, false);
- case vmIntrinsics::_putCharOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Opaque, false);
- case vmIntrinsics::_putIntOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Opaque, false);
- case vmIntrinsics::_putLongOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Opaque, false);
- case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Opaque, false);
- case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Opaque, false);
+ case vmIntrinsics::_putObjectOpaque: return inline_unsafe_access( is_store, T_OBJECT, Opaque, false);
+ case vmIntrinsics::_putBooleanOpaque: return inline_unsafe_access( is_store, T_BOOLEAN, Opaque, false);
+ case vmIntrinsics::_putByteOpaque: return inline_unsafe_access( is_store, T_BYTE, Opaque, false);
+ case vmIntrinsics::_putShortOpaque: return inline_unsafe_access( is_store, T_SHORT, Opaque, false);
+ case vmIntrinsics::_putCharOpaque: return inline_unsafe_access( is_store, T_CHAR, Opaque, false);
+ case vmIntrinsics::_putIntOpaque: return inline_unsafe_access( is_store, T_INT, Opaque, false);
+ case vmIntrinsics::_putLongOpaque: return inline_unsafe_access( is_store, T_LONG, Opaque, false);
+ case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false);
+ case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false);
case vmIntrinsics::_compareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile);
@@ -2196,8 +2177,6 @@ bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) {
//----------------------------inline_unsafe_access----------------------------
-const static BasicType T_ADDRESS_HOLDER = T_LONG;
-
// Helper that guards and inserts a pre-barrier.
void LibraryCallKit::insert_pre_barrier(Node* base_oop, Node* offset,
Node* pre_val, bool need_mem_bar) {
@@ -2298,13 +2277,12 @@ void LibraryCallKit::insert_pre_barrier(Node* base_oop, Node* offset,
}
-const TypeOopPtr* LibraryCallKit::sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type, bool is_native_ptr) {
+const TypeOopPtr* LibraryCallKit::sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type) {
// Attempt to infer a sharper value type from the offset and base type.
ciKlass* sharpened_klass = NULL;
// See if it is an instance field, with an object type.
if (alias_type->field() != NULL) {
- assert(!is_native_ptr, "native pointer op cannot use a java address");
if (alias_type->field()->type()->is_klass()) {
sharpened_klass = alias_type->field()->type()->as_klass();
}
@@ -2337,7 +2315,7 @@ const TypeOopPtr* LibraryCallKit::sharpen_unsafe_type(Compile::AliasType* alias_
return NULL;
}
-bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_store, const BasicType type, const AccessKind kind, const bool unaligned) {
+bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, const AccessKind kind, const bool unaligned) {
if (callee()->is_static()) return false; // caller must have the capability!
guarantee(!is_store || kind != Acquire, "Acquire accesses can be produced only for loads");
guarantee( is_store || kind != Release, "Release accesses can be produced only for stores");
@@ -2352,31 +2330,17 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor
if (!is_store) {
// Object getObject(Object base, int/long offset), etc.
BasicType rtype = sig->return_type()->basic_type();
- if (rtype == T_ADDRESS_HOLDER && callee()->name() == ciSymbol::getAddress_name())
- rtype = T_ADDRESS; // it is really a C void*
assert(rtype == type, "getter must return the expected value");
- if (!is_native_ptr) {
- assert(sig->count() == 2, "oop getter has 2 arguments");
- assert(sig->type_at(0)->basic_type() == T_OBJECT, "getter base is object");
- assert(sig->type_at(1)->basic_type() == T_LONG, "getter offset is correct");
- } else {
- assert(sig->count() == 1, "native getter has 1 argument");
- assert(sig->type_at(0)->basic_type() == T_LONG, "getter base is long");
- }
+ assert(sig->count() == 2, "oop getter has 2 arguments");
+ assert(sig->type_at(0)->basic_type() == T_OBJECT, "getter base is object");
+ assert(sig->type_at(1)->basic_type() == T_LONG, "getter offset is correct");
} else {
// void putObject(Object base, int/long offset, Object x), etc.
assert(sig->return_type()->basic_type() == T_VOID, "putter must not return a value");
- if (!is_native_ptr) {
- assert(sig->count() == 3, "oop putter has 3 arguments");
- assert(sig->type_at(0)->basic_type() == T_OBJECT, "putter base is object");
- assert(sig->type_at(1)->basic_type() == T_LONG, "putter offset is correct");
- } else {
- assert(sig->count() == 2, "native putter has 2 arguments");
- assert(sig->type_at(0)->basic_type() == T_LONG, "putter base is long");
- }
+ assert(sig->count() == 3, "oop putter has 3 arguments");
+ assert(sig->type_at(0)->basic_type() == T_OBJECT, "putter base is object");
+ assert(sig->type_at(1)->basic_type() == T_LONG, "putter offset is correct");
BasicType vtype = sig->type_at(sig->count()-1)->basic_type();
- if (vtype == T_ADDRESS_HOLDER && callee()->name() == ciSymbol::putAddress_name())
- vtype = T_ADDRESS; // it is really a C void*
assert(vtype == type, "putter must accept the expected value");
}
#endif // ASSERT
@@ -2393,27 +2357,22 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor
Node* offset = top();
Node* val;
- if (!is_native_ptr) {
- // The base is either a Java object or a value produced by Unsafe.staticFieldBase
- Node* base = argument(1); // type: oop
- // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset
- offset = argument(2); // type: long
- // We currently rely on the cookies produced by Unsafe.xxxFieldOffset
- // to be plain byte offsets, which are also the same as those accepted
- // by oopDesc::field_base.
- assert(Unsafe_field_offset_to_byte_offset(11) == 11,
- "fieldOffset must be byte-scaled");
- // 32-bit machines ignore the high half!
- offset = ConvL2X(offset);
- adr = make_unsafe_address(base, offset);
+ // The base is either a Java object or a value produced by Unsafe.staticFieldBase
+ Node* base = argument(1); // type: oop
+ // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset
+ offset = argument(2); // type: long
+ // We currently rely on the cookies produced by Unsafe.xxxFieldOffset
+ // to be plain byte offsets, which are also the same as those accepted
+ // by oopDesc::field_base.
+ assert(Unsafe_field_offset_to_byte_offset(11) == 11,
+ "fieldOffset must be byte-scaled");
+ // 32-bit machines ignore the high half!
+ offset = ConvL2X(offset);
+ adr = make_unsafe_address(base, offset);
+ if (_gvn.type(base)->isa_ptr() != TypePtr::NULL_PTR) {
heap_base_oop = base;
- val = is_store ? argument(4) : NULL;
- } else {
- Node* ptr = argument(1); // type: long
- ptr = ConvL2X(ptr); // adjust Java long to machine word
- adr = make_unsafe_address(NULL, ptr);
- val = is_store ? argument(3) : NULL;
}
+ val = is_store ? argument(4) : NULL;
const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
@@ -2494,11 +2453,11 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor
// SATB log buffer using the pre-barrier mechanism.
// Also we need to add memory barrier to prevent commoning reads
// from this field across safepoint since GC can change its value.
- bool need_read_barrier = !is_native_ptr && !is_store &&
+ bool need_read_barrier = !is_store &&
offset != top() && heap_base_oop != top();
if (!is_store && type == T_OBJECT) {
- const TypeOopPtr* tjp = sharpen_unsafe_type(alias_type, adr_type, is_native_ptr);
+ const TypeOopPtr* tjp = sharpen_unsafe_type(alias_type, adr_type);
if (tjp != NULL) {
value_type = tjp;
}
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index 3b9c48558cc..71116760c07 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -131,38 +131,137 @@ jlong Unsafe_field_offset_from_byte_offset(jlong byte_offset) {
}
-///// Data in the Java heap.
+///// Data read/writes on the Java heap and in native (off-heap) memory
-#define truncate_jboolean(x) ((x) & 1)
-#define truncate_jbyte(x) (x)
-#define truncate_jshort(x) (x)
-#define truncate_jchar(x) (x)
-#define truncate_jint(x) (x)
-#define truncate_jlong(x) (x)
-#define truncate_jfloat(x) (x)
-#define truncate_jdouble(x) (x)
+/**
+ * Helper class for accessing memory.
+ *
+ * Normalizes values and wraps accesses in
+ * JavaThread::doing_unsafe_access() if needed.
+ */
+class MemoryAccess : StackObj {
+ JavaThread* _thread;
+ jobject _obj;
+ jlong _offset;
-#define GET_FIELD(obj, offset, type_name, v) \
- oop p = JNIHandles::resolve(obj); \
- type_name v = *(type_name*)index_oop_from_field_offset_long(p, offset)
+ // Resolves and returns the address of the memory access
+ void* addr() {
+ return index_oop_from_field_offset_long(JNIHandles::resolve(_obj), _offset);
+ }
-#define SET_FIELD(obj, offset, type_name, x) \
- oop p = JNIHandles::resolve(obj); \
- *(type_name*)index_oop_from_field_offset_long(p, offset) = truncate_##type_name(x)
+ template
+ T normalize(T x) {
+ return x;
+ }
-#define GET_FIELD_VOLATILE(obj, offset, type_name, v) \
- oop p = JNIHandles::resolve(obj); \
- if (support_IRIW_for_not_multiple_copy_atomic_cpu) { \
- OrderAccess::fence(); \
- } \
- volatile type_name v = OrderAccess::load_acquire((volatile type_name*)index_oop_from_field_offset_long(p, offset));
+ jboolean normalize(jboolean x) {
+ return x & 1;
+ }
-#define SET_FIELD_VOLATILE(obj, offset, type_name, x) \
- oop p = JNIHandles::resolve(obj); \
- OrderAccess::release_store_fence((volatile type_name*)index_oop_from_field_offset_long(p, offset), truncate_##type_name(x));
+ /**
+ * Helper class to wrap memory accesses in JavaThread::doing_unsafe_access()
+ */
+ class GuardUnsafeAccess {
+ JavaThread* _thread;
+ bool _active;
+
+ public:
+ GuardUnsafeAccess(JavaThread* thread, jobject _obj) : _thread(thread) {
+ if (JNIHandles::resolve(_obj) == NULL) {
+ // native/off-heap access which may raise SIGBUS if accessing
+ // memory mapped file data in a region of the file which has
+ // been truncated and is now invalid
+ _thread->set_doing_unsafe_access(true);
+ _active = true;
+ } else {
+ _active = false;
+ }
+ }
+
+ ~GuardUnsafeAccess() {
+ if (_active) {
+ _thread->set_doing_unsafe_access(false);
+ }
+ }
+ };
+
+public:
+ MemoryAccess(JavaThread* thread, jobject obj, jlong offset)
+ : _thread(thread), _obj(obj), _offset(offset) {
+ }
+
+ template
+ T get() {
+ GuardUnsafeAccess guard(_thread, _obj);
+
+ T* p = (T*)addr();
+
+ T x = *p;
+
+ return x;
+ }
+
+ template
+ void put(T x) {
+ GuardUnsafeAccess guard(_thread, _obj);
+
+ T* p = (T*)addr();
+
+ *p = normalize(x);
+ }
-// Get/SetObject must be special-cased, since it works with handles.
+ template
+ T get_volatile() {
+ GuardUnsafeAccess guard(_thread, _obj);
+
+ T* p = (T*)addr();
+
+ if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+ OrderAccess::fence();
+ }
+
+ T x = OrderAccess::load_acquire((volatile T*)p);
+
+ return x;
+ }
+
+ template
+ void put_volatile(T x) {
+ GuardUnsafeAccess guard(_thread, _obj);
+
+ T* p = (T*)addr();
+
+ OrderAccess::release_store_fence((volatile T*)p, normalize(x));
+ }
+
+
+#ifndef SUPPORTS_NATIVE_CX8
+ jlong get_jlong_locked() {
+ GuardUnsafeAccess guard(_thread, _obj);
+
+ MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+
+ jlong* p = (jlong*)addr();
+
+ jlong x = Atomic::load(p);
+
+ return x;
+ }
+
+ void put_jlong_locked(jlong x) {
+ GuardUnsafeAccess guard(_thread, _obj);
+
+ MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+
+ jlong* p = (jlong*)addr();
+
+ Atomic::store(normalize(x), p);
+ }
+#endif
+};
+
+// Get/PutObject must be special-cased, since it works with handles.
// These functions allow a null base pointer with an arbitrary address.
// But if the base pointer is non-null, the offset should make some sense.
@@ -208,7 +307,7 @@ UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj,
return ret;
} UNSAFE_END
-UNSAFE_ENTRY(void, Unsafe_SetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) {
+UNSAFE_ENTRY(void, Unsafe_PutObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) {
oop x = JNIHandles::resolve(x_h);
oop p = JNIHandles::resolve(obj);
@@ -236,7 +335,7 @@ UNSAFE_ENTRY(jobject, Unsafe_GetObjectVolatile(JNIEnv *env, jobject unsafe, jobj
return JNIHandles::make_local(env, v);
} UNSAFE_END
-UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) {
+UNSAFE_ENTRY(void, Unsafe_PutObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) {
oop x = JNIHandles::resolve(x_h);
oop p = JNIHandles::resolve(obj);
void* addr = index_oop_from_field_offset_long(p, offset);
@@ -301,25 +400,17 @@ UNSAFE_ENTRY(jlong, Unsafe_GetKlassPointer(JNIEnv *env, jobject unsafe, jobject
UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) {
if (VM_Version::supports_cx8()) {
- GET_FIELD_VOLATILE(obj, offset, jlong, v);
- return v;
+ return MemoryAccess(thread, obj, offset).get_volatile();
} else {
- Handle p (THREAD, JNIHandles::resolve(obj));
- jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
- MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
- jlong value = Atomic::load(addr);
- return value;
+ return MemoryAccess(thread, obj, offset).get_jlong_locked();
}
} UNSAFE_END
-UNSAFE_ENTRY(void, Unsafe_SetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) {
+UNSAFE_ENTRY(void, Unsafe_PutLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) {
if (VM_Version::supports_cx8()) {
- SET_FIELD_VOLATILE(obj, offset, jlong, x);
+ MemoryAccess(thread, obj, offset).put_volatile(x);
} else {
- Handle p (THREAD, JNIHandles::resolve(obj));
- jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
- MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
- Atomic::store(x, addr);
+ MemoryAccess(thread, obj, offset).put_jlong_locked(x);
}
} UNSAFE_END
@@ -337,15 +428,14 @@ UNSAFE_LEAF(jint, Unsafe_unalignedAccess0(JNIEnv *env, jobject unsafe)) {
return UseUnalignedAccesses;
} UNSAFE_END
-#define DEFINE_GETSETOOP(java_type, Type) \
+#define DEFINE_GETSETOOP(java_type, Type) \
\
UNSAFE_ENTRY(java_type, Unsafe_Get##Type(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { \
- GET_FIELD(obj, offset, java_type, v); \
- return v; \
+ return MemoryAccess(thread, obj, offset).get(); \
} UNSAFE_END \
\
-UNSAFE_ENTRY(void, Unsafe_Set##Type(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \
- SET_FIELD(obj, offset, java_type, x); \
+UNSAFE_ENTRY(void, Unsafe_Put##Type(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \
+ MemoryAccess(thread, obj, offset).put(x); \
} UNSAFE_END \
\
// END DEFINE_GETSETOOP.
@@ -364,12 +454,11 @@ DEFINE_GETSETOOP(jdouble, Double);
#define DEFINE_GETSETOOP_VOLATILE(java_type, Type) \
\
UNSAFE_ENTRY(java_type, Unsafe_Get##Type##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { \
- GET_FIELD_VOLATILE(obj, offset, java_type, v); \
- return v; \
+ return MemoryAccess(thread, obj, offset).get_volatile(); \
} UNSAFE_END \
\
-UNSAFE_ENTRY(void, Unsafe_Set##Type##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \
- SET_FIELD_VOLATILE(obj, offset, java_type, x); \
+UNSAFE_ENTRY(void, Unsafe_Put##Type##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \
+ MemoryAccess(thread, obj, offset).put_volatile(x); \
} UNSAFE_END \
\
// END DEFINE_GETSETOOP_VOLATILE.
@@ -400,98 +489,6 @@ UNSAFE_LEAF(void, Unsafe_FullFence(JNIEnv *env, jobject unsafe)) {
OrderAccess::fence();
} UNSAFE_END
-////// Data in the C heap.
-
-// Note: These do not throw NullPointerException for bad pointers.
-// They just crash. Only a oop base pointer can generate a NullPointerException.
-//
-#define DEFINE_GETSETNATIVE(java_type, Type, native_type) \
- \
-UNSAFE_ENTRY(java_type, Unsafe_GetNative##Type(JNIEnv *env, jobject unsafe, jlong addr)) { \
- void* p = addr_from_java(addr); \
- JavaThread* t = JavaThread::current(); \
- t->set_doing_unsafe_access(true); \
- java_type x = *(volatile native_type*)p; \
- t->set_doing_unsafe_access(false); \
- return x; \
-} UNSAFE_END \
- \
-UNSAFE_ENTRY(void, Unsafe_SetNative##Type(JNIEnv *env, jobject unsafe, jlong addr, java_type x)) { \
- JavaThread* t = JavaThread::current(); \
- t->set_doing_unsafe_access(true); \
- void* p = addr_from_java(addr); \
- *(volatile native_type*)p = x; \
- t->set_doing_unsafe_access(false); \
-} UNSAFE_END \
- \
-// END DEFINE_GETSETNATIVE.
-
-DEFINE_GETSETNATIVE(jbyte, Byte, signed char)
-DEFINE_GETSETNATIVE(jshort, Short, signed short);
-DEFINE_GETSETNATIVE(jchar, Char, unsigned short);
-DEFINE_GETSETNATIVE(jint, Int, jint);
-// no long -- handled specially
-DEFINE_GETSETNATIVE(jfloat, Float, float);
-DEFINE_GETSETNATIVE(jdouble, Double, double);
-
-#undef DEFINE_GETSETNATIVE
-
-UNSAFE_ENTRY(jlong, Unsafe_GetNativeLong(JNIEnv *env, jobject unsafe, jlong addr)) {
- JavaThread* t = JavaThread::current();
- // We do it this way to avoid problems with access to heap using 64
- // bit loads, as jlong in heap could be not 64-bit aligned, and on
- // some CPUs (SPARC) it leads to SIGBUS.
- t->set_doing_unsafe_access(true);
- void* p = addr_from_java(addr);
- jlong x;
-
- if (is_ptr_aligned(p, sizeof(jlong)) == 0) {
- // jlong is aligned, do a volatile access
- x = *(volatile jlong*)p;
- } else {
- jlong_accessor acc;
- acc.words[0] = ((volatile jint*)p)[0];
- acc.words[1] = ((volatile jint*)p)[1];
- x = acc.long_value;
- }
-
- t->set_doing_unsafe_access(false);
-
- return x;
-} UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_SetNativeLong(JNIEnv *env, jobject unsafe, jlong addr, jlong x)) {
- JavaThread* t = JavaThread::current();
- // see comment for Unsafe_GetNativeLong
- t->set_doing_unsafe_access(true);
- void* p = addr_from_java(addr);
-
- if (is_ptr_aligned(p, sizeof(jlong))) {
- // jlong is aligned, do a volatile access
- *(volatile jlong*)p = x;
- } else {
- jlong_accessor acc;
- acc.long_value = x;
- ((volatile jint*)p)[0] = acc.words[0];
- ((volatile jint*)p)[1] = acc.words[1];
- }
-
- t->set_doing_unsafe_access(false);
-} UNSAFE_END
-
-
-UNSAFE_LEAF(jlong, Unsafe_GetNativeAddress(JNIEnv *env, jobject unsafe, jlong addr)) {
- void* p = addr_from_java(addr);
-
- return addr_to_java(*(void**)p);
-} UNSAFE_END
-
-UNSAFE_LEAF(void, Unsafe_SetNativeAddress(JNIEnv *env, jobject unsafe, jlong addr, jlong x)) {
- void* p = addr_from_java(addr);
- *(void**)p = addr_from_java(x);
-} UNSAFE_END
-
-
////// Allocation requests
UNSAFE_ENTRY(jobject, Unsafe_AllocateInstance(JNIEnv *env, jobject unsafe, jclass cls)) {
@@ -980,8 +977,8 @@ UNSAFE_ENTRY(jint, Unsafe_CompareAndExchangeInt(JNIEnv *env, jobject unsafe, job
} UNSAFE_END
UNSAFE_ENTRY(jlong, Unsafe_CompareAndExchangeLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) {
- Handle p (THREAD, JNIHandles::resolve(obj));
- jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
+ Handle p(THREAD, JNIHandles::resolve(obj));
+ jlong* addr = (jlong*)index_oop_from_field_offset_long(p(), offset);
#ifdef SUPPORTS_NATIVE_CX8
return (jlong)(Atomic::cmpxchg(x, addr, e));
@@ -1017,7 +1014,7 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe,
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
oop p = JNIHandles::resolve(obj);
- jint* addr = (jint *) index_oop_from_field_offset_long(p, offset);
+ jint* addr = (jint *)index_oop_from_field_offset_long(p, offset);
return (jint)(Atomic::cmpxchg(x, addr, e)) == e;
} UNSAFE_END
@@ -1143,20 +1140,16 @@ UNSAFE_ENTRY(jint, Unsafe_GetLoadAverage0(JNIEnv *env, jobject unsafe, jdoubleAr
#define DECLARE_GETPUTOOP(Type, Desc) \
{CC "get" #Type, CC "(" OBJ "J)" #Desc, FN_PTR(Unsafe_Get##Type)}, \
- {CC "put" #Type, CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Set##Type)}, \
+ {CC "put" #Type, CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Put##Type)}, \
{CC "get" #Type "Volatile", CC "(" OBJ "J)" #Desc, FN_PTR(Unsafe_Get##Type##Volatile)}, \
- {CC "put" #Type "Volatile", CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Set##Type##Volatile)}
+ {CC "put" #Type "Volatile", CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Put##Type##Volatile)}
-#define DECLARE_GETPUTNATIVE(Byte, B) \
- {CC "get" #Byte, CC "(" ADR ")" #B, FN_PTR(Unsafe_GetNative##Byte)}, \
- {CC "put" #Byte, CC "(" ADR#B ")V", FN_PTR(Unsafe_SetNative##Byte)}
-
static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
{CC "getObject", CC "(" OBJ "J)" OBJ "", FN_PTR(Unsafe_GetObject)},
- {CC "putObject", CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_SetObject)},
+ {CC "putObject", CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutObject)},
{CC "getObjectVolatile",CC "(" OBJ "J)" OBJ "", FN_PTR(Unsafe_GetObjectVolatile)},
- {CC "putObjectVolatile",CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_SetObjectVolatile)},
+ {CC "putObjectVolatile",CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutObjectVolatile)},
{CC "getUncompressedObject", CC "(" ADR ")" OBJ, FN_PTR(Unsafe_GetUncompressedObject)},
{CC "getJavaMirror", CC "(" ADR ")" CLS, FN_PTR(Unsafe_GetJavaMirror)},
@@ -1171,17 +1164,6 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
DECLARE_GETPUTOOP(Float, F),
DECLARE_GETPUTOOP(Double, D),
- DECLARE_GETPUTNATIVE(Byte, B),
- DECLARE_GETPUTNATIVE(Short, S),
- DECLARE_GETPUTNATIVE(Char, C),
- DECLARE_GETPUTNATIVE(Int, I),
- DECLARE_GETPUTNATIVE(Long, J),
- DECLARE_GETPUTNATIVE(Float, F),
- DECLARE_GETPUTNATIVE(Double, D),
-
- {CC "getAddress", CC "(" ADR ")" ADR, FN_PTR(Unsafe_GetNativeAddress)},
- {CC "putAddress", CC "(" ADR "" ADR ")V", FN_PTR(Unsafe_SetNativeAddress)},
-
{CC "allocateMemory0", CC "(J)" ADR, FN_PTR(Unsafe_AllocateMemory0)},
{CC "reallocateMemory0", CC "(" ADR "J)" ADR, FN_PTR(Unsafe_ReallocateMemory0)},
{CC "freeMemory0", CC "(" ADR ")V", FN_PTR(Unsafe_FreeMemory0)},
@@ -1239,7 +1221,6 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
#undef DAC_Args
#undef DECLARE_GETPUTOOP
-#undef DECLARE_GETPUTNATIVE
// This function is exported, used by NativeLookup.
From d4a0000fdb18a9e776af7f80522fd4f891cc2606 Mon Sep 17 00:00:00 2001
From: Brent Christian
Date: Fri, 6 May 2016 22:45:32 -0700
Subject: [PATCH 004/381] 8147039: Incorrect locals and operands in compiled
frames
Implement stack walking using javaVFrame instead of vframeStream
Reviewed-by: mchung, vlivanov
---
hotspot/src/share/vm/prims/stackwalk.cpp | 103 +++++++++++------------
hotspot/src/share/vm/prims/stackwalk.hpp | 28 ++++--
hotspot/src/share/vm/runtime/vframe.hpp | 8 --
3 files changed, 69 insertions(+), 70 deletions(-)
diff --git a/hotspot/src/share/vm/prims/stackwalk.cpp b/hotspot/src/share/vm/prims/stackwalk.cpp
index d772620dcf5..70f46f747d2 100644
--- a/hotspot/src/share/vm/prims/stackwalk.cpp
+++ b/hotspot/src/share/vm/prims/stackwalk.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,44 +37,44 @@
#include "utilities/globalDefinitions.hpp"
// setup and cleanup actions
-void StackWalkAnchor::setup_magic_on_entry(objArrayHandle frames_array) {
+void JavaFrameStream::setup_magic_on_entry(objArrayHandle frames_array) {
frames_array->obj_at_put(magic_pos, _thread->threadObj());
_anchor = address_value();
assert(check_magic(frames_array), "invalid magic");
}
-bool StackWalkAnchor::check_magic(objArrayHandle frames_array) {
+bool JavaFrameStream::check_magic(objArrayHandle frames_array) {
oop m1 = frames_array->obj_at(magic_pos);
jlong m2 = _anchor;
if (m1 == _thread->threadObj() && m2 == address_value()) return true;
return false;
}
-bool StackWalkAnchor::cleanup_magic_on_exit(objArrayHandle frames_array) {
+bool JavaFrameStream::cleanup_magic_on_exit(objArrayHandle frames_array) {
bool ok = check_magic(frames_array);
frames_array->obj_at_put(magic_pos, NULL);
_anchor = 0L;
return ok;
}
-// Returns StackWalkAnchor for the current stack being traversed.
+// Returns JavaFrameStream for the current stack being traversed.
//
// Parameters:
// thread Current Java thread.
// magic Magic value used for each stack walking
// frames_array User-supplied buffers. The 0th element is reserved
-// to this StackWalkAnchor to use
+// to this JavaFrameStream to use
//
-StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic,
+JavaFrameStream* JavaFrameStream::from_current(JavaThread* thread, jlong magic,
objArrayHandle frames_array)
{
assert(thread != NULL && thread->is_Java_thread(), "");
oop m1 = frames_array->obj_at(magic_pos);
if (m1 != thread->threadObj()) return NULL;
if (magic == 0L) return NULL;
- StackWalkAnchor* anchor = (StackWalkAnchor*) (intptr_t) magic;
- if (!anchor->is_valid_in(thread, frames_array)) return NULL;
- return anchor;
+ JavaFrameStream* stream = (JavaFrameStream*) (intptr_t) magic;
+ if (!stream->is_valid_in(thread, frames_array)) return NULL;
+ return stream;
}
// Unpacks one or more frames into user-supplied buffers.
@@ -84,19 +84,19 @@ StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic,
// In other words, do not leave any stale data in the vfst.
//
// Parameters:
-// mode Restrict which frames to be decoded.
-// vfst vFrameStream.
-// max_nframes Maximum number of frames to be filled.
-// start_index Start index to the user-supplied buffers.
-// frames_array Buffer to store Class or StackFrame in, starting at start_index.
-// frames array is a Class>[] array when only getting caller
-// reference, and a StackFrameInfo[] array (or derivative)
-// otherwise. It should never be null.
-// end_index End index to the user-supplied buffers with unpacked frames.
+// mode Restrict which frames to be decoded.
+// JavaFrameStream stream of javaVFrames
+// max_nframes Maximum number of frames to be filled.
+// start_index Start index to the user-supplied buffers.
+// frames_array Buffer to store Class or StackFrame in, starting at start_index.
+// frames array is a Class>[] array when only getting caller
+// reference, and a StackFrameInfo[] array (or derivative)
+// otherwise. It should never be null.
+// end_index End index to the user-supplied buffers with unpacked frames.
//
// Returns the number of frames whose information was transferred into the buffers.
//
-int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst,
+int StackWalk::fill_in_frames(jlong mode, JavaFrameStream& stream,
int max_nframes, int start_index,
objArrayHandle frames_array,
int& end_index, TRAPS) {
@@ -108,9 +108,9 @@ int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst,
assert(start_index + max_nframes <= frames_array->length(), "oob");
int frames_decoded = 0;
- for (; !vfst.at_end(); vfst.next()) {
- Method* method = vfst.method();
- int bci = vfst.bci();
+ for (; !stream.at_end(); stream.next()) {
+ Method* method = stream.method();
+ int bci = stream.bci();
if (method == NULL) continue;
if (!ShowHiddenFrames && StackWalk::skip_hidden_frames(mode)) {
@@ -133,7 +133,7 @@ int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst,
if (live_frame_info(mode)) {
assert (use_frames_array(mode), "Bad mode for get live frame");
Handle stackFrame(frames_array->obj_at(index));
- fill_live_stackframe(stackFrame, method, bci, vfst.java_frame(), CHECK_0);
+ fill_live_stackframe(stackFrame, method, bci, stream.java_frame(), CHECK_0);
} else if (need_method_info(mode)) {
assert (use_frames_array(mode), "Bad mode for get stack frame");
Handle stackFrame(frames_array->obj_at(index));
@@ -294,6 +294,7 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
int skip_frames, int frame_count, int start_index,
objArrayHandle frames_array,
TRAPS) {
+ ResourceMark rm(THREAD);
JavaThread* jt = (JavaThread*)THREAD;
if (TraceStackWalk) {
tty->print_cr("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d",
@@ -309,41 +310,39 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
methodHandle m_doStackWalk(THREAD, Universe::do_stack_walk_method());
- // Open up a traversable stream onto my stack.
- // This stream will be made available by *reference* to the inner Java call.
- StackWalkAnchor anchor(jt);
- vframeStream& vfst = anchor.vframe_stream();
-
+ // Setup traversal onto my stack.
+ RegisterMap regMap(jt, true);
+ JavaFrameStream stream(jt, ®Map);
{
- while (!vfst.at_end()) {
- InstanceKlass* ik = vfst.method()->method_holder();
+ while (!stream.at_end()) {
+ InstanceKlass* ik = stream.method()->method_holder();
if (ik != stackWalker_klass &&
ik != abstractStackWalker_klass && ik->super() != abstractStackWalker_klass) {
break;
}
if (TraceStackWalk) {
- tty->print(" skip "); vfst.method()->print_short_name(); tty->print("\n");
+ tty->print(" skip "); stream.method()->print_short_name(); tty->print("\n");
}
- vfst.next();
+ stream.next();
}
// stack frame has been traversed individually and resume stack walk
// from the stack frame at depth == skip_frames.
- for (int n=0; n < skip_frames && !vfst.at_end(); vfst.next(), n++) {
+ for (int n=0; n < skip_frames && !stream.at_end(); stream.next(), n++) {
if (TraceStackWalk) {
- tty->print(" skip "); vfst.method()->print_short_name();
+ tty->print(" skip "); stream.method()->print_short_name();
tty->print_cr(" frame id: " PTR_FORMAT " pc: " PTR_FORMAT,
- p2i(vfst.frame_id()), p2i(vfst.frame_pc()));
+ p2i(stream.java_frame()->fr().id()),
+ p2i(stream.java_frame()->fr().pc()));
}
}
}
- // The Method* pointer in the vfst has a very short shelf life. Grab it now.
int end_index = start_index;
int numFrames = 0;
- if (!vfst.at_end()) {
- numFrames = fill_in_frames(mode, vfst, frame_count, start_index,
+ if (!stream.at_end()) {
+ numFrames = fill_in_frames(mode, stream, frame_count, start_index,
frames_array, end_index, CHECK_NULL);
if (numFrames < 1) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "stack walk: decode failed", NULL);
@@ -356,19 +355,19 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
// When JVM_CallStackWalk returns, it invalidates the stack stream.
JavaValue result(T_OBJECT);
JavaCallArguments args(stackStream);
- args.push_long(anchor.address_value());
+ args.push_long(stream.address_value());
args.push_int(skip_frames);
args.push_int(frame_count);
args.push_int(start_index);
args.push_int(end_index);
// Link the thread and vframe stream into the callee-visible object
- anchor.setup_magic_on_entry(frames_array);
+ stream.setup_magic_on_entry(frames_array);
JavaCalls::call(&result, m_doStackWalk, &args, THREAD);
// Do this before anything else happens, to disable any lingering stream objects
- bool ok = anchor.cleanup_magic_on_exit(frames_array);
+ bool ok = stream.cleanup_magic_on_exit(frames_array);
// Throw pending exception if we must
(void) (CHECK_NULL);
@@ -379,7 +378,6 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
// Return normally
return (oop)result.get_jobject();
-
}
// Walk the next batch of stack frames
@@ -400,8 +398,8 @@ jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic,
TRAPS)
{
JavaThread* jt = (JavaThread*)THREAD;
- StackWalkAnchor* existing_anchor = StackWalkAnchor::from_current(jt, magic, frames_array);
- if (existing_anchor == NULL) {
+ JavaFrameStream* existing_stream = JavaFrameStream::from_current(jt, magic, frames_array);
+ if (existing_stream == NULL) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers", 0L);
}
@@ -410,8 +408,8 @@ jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic,
}
if (TraceStackWalk) {
- tty->print_cr("StackWalk::moreFrames frame_count %d existing_anchor " PTR_FORMAT " start %d frames %d",
- frame_count, p2i(existing_anchor), start_index, frames_array->length());
+ tty->print_cr("StackWalk::moreFrames frame_count %d existing_stream " PTR_FORMAT " start %d frames %d",
+ frame_count, p2i(existing_stream), start_index, frames_array->length());
}
int end_index = start_index;
if (frame_count <= 0) {
@@ -421,12 +419,11 @@ jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic,
int count = frame_count + start_index;
assert (frames_array->length() >= count, "not enough space in buffers");
- StackWalkAnchor& anchor = (*existing_anchor);
- vframeStream& vfst = anchor.vframe_stream();
- if (!vfst.at_end()) {
- vfst.next(); // this was the last frame decoded in the previous batch
- if (!vfst.at_end()) {
- int n = fill_in_frames(mode, vfst, frame_count, start_index,
+ JavaFrameStream& stream = (*existing_stream);
+ if (!stream.at_end()) {
+ stream.next(); // advance past the last frame decoded in previous batch
+ if (!stream.at_end()) {
+ int n = fill_in_frames(mode, stream, frame_count, start_index,
frames_array, end_index, CHECK_0);
if (n < 1) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L);
diff --git a/hotspot/src/share/vm/prims/stackwalk.hpp b/hotspot/src/share/vm/prims/stackwalk.hpp
index 2eb41aeb711..e222e623f6d 100644
--- a/hotspot/src/share/vm/prims/stackwalk.hpp
+++ b/hotspot/src/share/vm/prims/stackwalk.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,21 +29,31 @@
#include "oops/oop.hpp"
#include "runtime/vframe.hpp"
-class StackWalkAnchor : public StackObj {
+//
+// JavaFrameStream is used by StackWalker to iterate through Java stack frames
+// on the given JavaThread.
+//
+class JavaFrameStream : public StackObj {
private:
enum {
magic_pos = 0
};
JavaThread* _thread;
- vframeStream _vfst;
+ javaVFrame* _jvf;
jlong _anchor;
public:
- StackWalkAnchor(JavaThread* thread)
- : _thread(thread), _vfst(thread), _anchor(0L) {}
+ JavaFrameStream(JavaThread* thread, RegisterMap* rm)
+ : _thread(thread), _anchor(0L) {
+ _jvf = _thread->last_java_vframe(rm);
+ }
- vframeStream& vframe_stream() { return _vfst; }
- JavaThread* thread() { return _thread; }
+ javaVFrame* java_frame() { return _jvf; }
+ void next() { _jvf = _jvf->java_sender(); }
+ bool at_end() { return _jvf == NULL; }
+
+ Method* method() { return _jvf->method(); }
+ int bci() { return _jvf->bci(); }
void setup_magic_on_entry(objArrayHandle frames_array);
bool check_magic(objArrayHandle frames_array);
@@ -57,12 +67,12 @@ public:
return (jlong) castable_address(this);
}
- static StackWalkAnchor* from_current(JavaThread* thread, jlong anchor, objArrayHandle frames_array);
+ static JavaFrameStream* from_current(JavaThread* thread, jlong magic, objArrayHandle frames_array);
};
class StackWalk : public AllStatic {
private:
- static int fill_in_frames(jlong mode, vframeStream& vfst,
+ static int fill_in_frames(jlong mode, JavaFrameStream& stream,
int max_nframes, int start_index,
objArrayHandle frames_array,
int& end_index, TRAPS);
diff --git a/hotspot/src/share/vm/runtime/vframe.hpp b/hotspot/src/share/vm/runtime/vframe.hpp
index 148244aee6f..de7d510fc2d 100644
--- a/hotspot/src/share/vm/runtime/vframe.hpp
+++ b/hotspot/src/share/vm/runtime/vframe.hpp
@@ -317,14 +317,6 @@ class vframeStreamCommon : StackObj {
intptr_t* frame_id() const { return _frame.id(); }
address frame_pc() const { return _frame.pc(); }
- javaVFrame* java_frame() {
- vframe* vf = vframe::new_vframe(&_frame, &_reg_map, _thread);
- if (vf->is_java_frame()) {
- return (javaVFrame*)vf;
- }
- return NULL;
- }
-
CodeBlob* cb() const { return _frame.cb(); }
CompiledMethod* nm() const {
assert( cb() != NULL && cb()->is_compiled(), "usage");
From af168abecc857b700f02256b11401b10b49f2ec0 Mon Sep 17 00:00:00 2001
From: Thomas Stuefe
Date: Thu, 28 Apr 2016 15:40:45 +0200
Subject: [PATCH 005/381] 8155639: Remove STEP numbers from error reporting
Reviewed-by: coleenp, twisti
---
hotspot/src/share/vm/utilities/vmError.cpp | 156 ++++++++++-----------
1 file changed, 78 insertions(+), 78 deletions(-)
diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp
index 1eac0b14d0e..095cc8bbb26 100644
--- a/hotspot/src/share/vm/utilities/vmError.cpp
+++ b/hotspot/src/share/vm/utilities/vmError.cpp
@@ -290,8 +290,8 @@ const char* VMError::_current_step_info;
void VMError::report(outputStream* st, bool _verbose) {
-# define BEGIN if (_current_step == 0) { _current_step = 1;
-# define STEP(n, s) } if (_current_step < n) { _current_step = n; _current_step_info = s;
+# define BEGIN if (_current_step == 0) { _current_step = __LINE__;
+# define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s;
# define END }
// don't allocate large buffer on stack
@@ -299,7 +299,7 @@ void VMError::report(outputStream* st, bool _verbose) {
BEGIN
- STEP(10, "(printing fatal error message)")
+ STEP("printing fatal error message")
st->print_cr("#");
if (should_report_bug(_id)) {
@@ -314,21 +314,21 @@ void VMError::report(outputStream* st, bool _verbose) {
// test secondary error handling. Test it twice, to test that resetting
// error handler after a secondary crash works.
- STEP(20, "(test secondary crash 1)")
+ STEP("test secondary crash 1")
if (_verbose && TestCrashInErrorHandler != 0) {
st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...",
TestCrashInErrorHandler);
controlled_crash(TestCrashInErrorHandler);
}
- STEP(30, "(test secondary crash 2)")
+ STEP("test secondary crash 2")
if (_verbose && TestCrashInErrorHandler != 0) {
st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...",
TestCrashInErrorHandler);
controlled_crash(TestCrashInErrorHandler);
}
- STEP(40, "(test safefetch in error handler)")
+ STEP("test safefetch in error handler")
// test whether it is safe to use SafeFetch32 in Crash Handler. Test twice
// to test that resetting the signal handler works correctly.
if (_verbose && TestSafeFetchInErrorHandler) {
@@ -349,7 +349,7 @@ void VMError::report(outputStream* st, bool _verbose) {
}
#endif // PRODUCT
- STEP(50, "(printing type of error)")
+ STEP("printing type of error")
switch(_id) {
case OOM_MALLOC_ERROR:
@@ -384,7 +384,7 @@ void VMError::report(outputStream* st, bool _verbose) {
break;
}
- STEP(60, "(printing exception/signal name)")
+ STEP("printing exception/signal name")
st->print_cr("#");
st->print("# ");
@@ -414,14 +414,14 @@ void VMError::report(outputStream* st, bool _verbose) {
}
}
- STEP(70, "(printing current thread and pid)")
+ STEP("printing current thread and pid")
// process id, thread id
st->print(", pid=%d", os::current_process_id());
st->print(", tid=" UINTX_FORMAT, os::current_thread_id());
st->cr();
- STEP(80, "(printing error message)")
+ STEP("printing error message")
if (should_report_bug(_id)) { // already printed the message.
// error message
@@ -432,11 +432,11 @@ void VMError::report(outputStream* st, bool _verbose) {
}
}
- STEP(90, "(printing Java version string)")
+ STEP("printing Java version string")
report_vm_version(st, buf, sizeof(buf));
- STEP(100, "(printing problematic frame)")
+ STEP("printing problematic frame")
// Print current frame if we have a context (i.e. it's a crash)
if (_context) {
@@ -448,7 +448,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->print_cr("#");
}
- STEP(110, "(printing core file information)")
+ STEP("printing core file information")
st->print("# ");
if (CreateCoredumpOnCrash) {
if (coredump_status) {
@@ -462,13 +462,13 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
st->print_cr("#");
- STEP(120, "(printing bug submit message)")
+ STEP("printing bug submit message")
if (should_report_bug(_id) && _verbose) {
print_bug_submit_message(st, _thread);
}
- STEP(130, "(printing summary)" )
+ STEP("printing summary")
if (_verbose) {
st->cr();
@@ -476,7 +476,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(140, "(printing VM option summary)" )
+ STEP("printing VM option summary")
if (_verbose) {
// VM options
@@ -484,20 +484,20 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(150, "(printing summary machine and OS info)")
+ STEP("printing summary machine and OS info")
if (_verbose) {
os::print_summary_info(st, buf, sizeof(buf));
}
- STEP(160, "(printing date and time)" )
+ STEP("printing date and time")
if (_verbose) {
os::print_date_and_time(st, buf, sizeof(buf));
}
- STEP(170, "(printing thread)" )
+ STEP("printing thread")
if (_verbose) {
st->cr();
@@ -505,7 +505,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(180, "(printing current thread)" )
+ STEP("printing current thread")
// current thread
if (_verbose) {
@@ -519,7 +519,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(190, "(printing current compile task)" )
+ STEP("printing current compile task")
if (_verbose && _thread && _thread->is_Compiler_thread()) {
CompilerThread* t = (CompilerThread*)_thread;
@@ -532,7 +532,7 @@ void VMError::report(outputStream* st, bool _verbose) {
}
- STEP(200, "(printing stack bounds)" )
+ STEP("printing stack bounds")
if (_verbose) {
st->print("Stack: ");
@@ -563,7 +563,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(210, "(printing native stack)" )
+ STEP("printing native stack")
if (_verbose) {
if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) {
@@ -577,13 +577,13 @@ void VMError::report(outputStream* st, bool _verbose) {
}
}
- STEP(220, "(printing Java stack)" )
+ STEP("printing Java stack")
if (_verbose && _thread && _thread->is_Java_thread()) {
print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf));
}
- STEP(230, "(printing target Java thread stack)" )
+ STEP("printing target Java thread stack")
// printing Java thread stack trace if it is involved in GC crash
if (_verbose && _thread && (_thread->is_Named_thread())) {
@@ -594,7 +594,7 @@ void VMError::report(outputStream* st, bool _verbose) {
}
}
- STEP(240, "(printing siginfo)" )
+ STEP("printing siginfo")
// signal no, signal code, address that caused the fault
if (_verbose && _siginfo) {
@@ -603,7 +603,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(245, "(CDS archive access warning)" )
+ STEP("CDS archive access warning")
// Print an explicit hint if we crashed on access to the CDS archive.
if (_verbose && _siginfo) {
@@ -611,7 +611,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(250, "(printing register info)")
+ STEP("printing register info")
// decode register contents if possible
if (_verbose && _context && Universe::is_fully_initialized()) {
@@ -619,7 +619,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(260, "(printing registers, top of stack, instructions near pc)")
+ STEP("printing registers, top of stack, instructions near pc")
// registers, top of stack, instructions near pc
if (_verbose && _context) {
@@ -627,7 +627,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(265, "(printing code blob if possible)")
+ STEP("printing code blob if possible")
if (_verbose && _context) {
CodeBlob* cb = CodeCache::find_blob(_pc);
@@ -652,7 +652,7 @@ void VMError::report(outputStream* st, bool _verbose) {
}
}
- STEP(270, "(printing VM operation)" )
+ STEP("printing VM operation")
if (_verbose && _thread && _thread->is_VM_thread()) {
VMThread* t = (VMThread*)_thread;
@@ -664,7 +664,7 @@ void VMError::report(outputStream* st, bool _verbose) {
}
}
- STEP(280, "(printing process)" )
+ STEP("printing process")
if (_verbose) {
st->cr();
@@ -672,7 +672,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(290, "(printing all threads)" )
+ STEP("printing all threads")
// all threads
if (_verbose && _thread) {
@@ -680,7 +680,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(300, "(printing VM state)" )
+ STEP("printing VM state")
if (_verbose) {
// Safepoint state
@@ -702,7 +702,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(310, "(printing owned locks on error)" )
+ STEP("printing owned locks on error")
// mutexes/monitors that currently have an owner
if (_verbose) {
@@ -710,7 +710,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(320, "(printing number of OutOfMemoryError and StackOverflow exceptions)")
+ STEP("printing number of OutOfMemoryError and StackOverflow exceptions")
if (_verbose && Exceptions::has_exception_counts()) {
st->print_cr("OutOfMemory and StackOverflow Exception counts:");
@@ -718,7 +718,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(330, "(printing compressed oops mode")
+ STEP("printing compressed oops mode")
if (_verbose && UseCompressedOops) {
Universe::print_compressed_oops_mode(st);
@@ -728,7 +728,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(340, "(printing heap information)" )
+ STEP("printing heap information")
if (_verbose && Universe::is_fully_initialized()) {
Universe::heap()->print_on_error(st);
@@ -737,7 +737,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(350, "(printing code cache information)" )
+ STEP("printing code cache information")
if (_verbose && Universe::is_fully_initialized()) {
// print code cache information before vm abort
@@ -745,14 +745,14 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(360, "(printing ring buffers)" )
+ STEP("printing ring buffers")
if (_verbose) {
Events::print_all(st);
st->cr();
}
- STEP(370, "(printing dynamic libraries)" )
+ STEP("printing dynamic libraries")
if (_verbose) {
// dynamic libraries, or memory map
@@ -760,7 +760,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(380, "(printing VM options)" )
+ STEP("printing VM options")
if (_verbose) {
// VM options
@@ -768,40 +768,40 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(390, "(printing warning if internal testing API used)" )
+ STEP("printing warning if internal testing API used")
if (WhiteBox::used()) {
st->print_cr("Unsupported internal testing APIs have been used.");
st->cr();
}
- STEP(395, "(printing log configuration)")
+ STEP("printing log configuration")
if (_verbose){
st->print_cr("Logging:");
LogConfiguration::describe_current_configuration(st);
st->cr();
}
- STEP(400, "(printing all environment variables)" )
+ STEP("printing all environment variables")
if (_verbose) {
os::print_environment_variables(st, env_list);
st->cr();
}
- STEP(410, "(printing signal handlers)" )
+ STEP("printing signal handlers")
if (_verbose) {
os::print_signal_handlers(st, buf, sizeof(buf));
st->cr();
}
- STEP(420, "(Native Memory Tracking)" )
+ STEP("Native Memory Tracking")
if (_verbose) {
MemTracker::error_report(st);
}
- STEP(430, "(printing system)" )
+ STEP("printing system")
if (_verbose) {
st->cr();
@@ -809,27 +809,27 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
}
- STEP(440, "(printing OS information)" )
+ STEP("printing OS information")
if (_verbose) {
os::print_os_info(st);
st->cr();
}
- STEP(450, "(printing CPU info)" )
+ STEP("printing CPU info")
if (_verbose) {
os::print_cpu_info(st, buf, sizeof(buf));
st->cr();
}
- STEP(460, "(printing memory info)" )
+ STEP("printing memory info")
if (_verbose) {
os::print_memory_info(st);
st->cr();
}
- STEP(470, "(printing internal vm info)" )
+ STEP("printing internal vm info")
if (_verbose) {
st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string());
@@ -837,7 +837,7 @@ void VMError::report(outputStream* st, bool _verbose) {
}
// print a defined marker to show that error handling finished correctly.
- STEP(480, "(printing end marker)" )
+ STEP("printing end marker")
if (_verbose) {
st->print_cr("END.");
@@ -858,35 +858,35 @@ void VMError::print_vm_info(outputStream* st) {
char buf[O_BUFLEN];
report_vm_version(st, buf, sizeof(buf));
- // STEP("(printing summary)")
+ // STEP("printing summary")
st->cr();
st->print_cr("--------------- S U M M A R Y ------------");
st->cr();
- // STEP("(printing VM option summary)")
+ // STEP("printing VM option summary")
// VM options
Arguments::print_summary_on(st);
st->cr();
- // STEP("(printing summary machine and OS info)")
+ // STEP("printing summary machine and OS info")
os::print_summary_info(st, buf, sizeof(buf));
- // STEP("(printing date and time)")
+ // STEP("printing date and time")
os::print_date_and_time(st, buf, sizeof(buf));
- // Skip: STEP("(printing thread)")
+ // Skip: STEP("printing thread")
- // STEP("(printing process)")
+ // STEP("printing process")
st->cr();
st->print_cr("--------------- P R O C E S S ---------------");
st->cr();
- // STEP("(printing number of OutOfMemoryError and StackOverflow exceptions)")
+ // STEP("printing number of OutOfMemoryError and StackOverflow exceptions")
if (Exceptions::has_exception_counts()) {
st->print_cr("OutOfMemory and StackOverflow Exception counts:");
@@ -894,7 +894,7 @@ void VMError::print_vm_info(outputStream* st) {
st->cr();
}
- // STEP("(printing compressed oops mode")
+ // STEP("printing compressed oops mode")
if (UseCompressedOops) {
Universe::print_compressed_oops_mode(st);
@@ -904,7 +904,7 @@ void VMError::print_vm_info(outputStream* st) {
st->cr();
}
- // STEP("(printing heap information)")
+ // STEP("printing heap information")
if (Universe::is_fully_initialized()) {
Universe::heap()->print_on_error(st);
@@ -913,7 +913,7 @@ void VMError::print_vm_info(outputStream* st) {
st->cr();
}
- // STEP("(printing code cache information)")
+ // STEP("printing code cache information")
if (Universe::is_fully_initialized()) {
// print code cache information before vm abort
@@ -921,77 +921,77 @@ void VMError::print_vm_info(outputStream* st) {
st->cr();
}
- // STEP("(printing ring buffers)")
+ // STEP("printing ring buffers")
Events::print_all(st);
st->cr();
- // STEP("(printing dynamic libraries)")
+ // STEP("printing dynamic libraries")
// dynamic libraries, or memory map
os::print_dll_info(st);
st->cr();
- // STEP("(printing VM options)")
+ // STEP("printing VM options")
// VM options
Arguments::print_on(st);
st->cr();
- // STEP("(printing warning if internal testing API used)")
+ // STEP("printing warning if internal testing API used")
if (WhiteBox::used()) {
st->print_cr("Unsupported internal testing APIs have been used.");
st->cr();
}
- // STEP("(printing log configuration)")
+ // STEP("printing log configuration")
st->print_cr("Logging:");
LogConfiguration::describe(st);
st->cr();
- // STEP("(printing all environment variables)")
+ // STEP("printing all environment variables")
os::print_environment_variables(st, env_list);
st->cr();
- // STEP("(printing signal handlers)")
+ // STEP("printing signal handlers")
os::print_signal_handlers(st, buf, sizeof(buf));
st->cr();
- // STEP("(Native Memory Tracking)")
+ // STEP("Native Memory Tracking")
MemTracker::error_report(st);
- // STEP("(printing system)")
+ // STEP("printing system")
st->cr();
st->print_cr("--------------- S Y S T E M ---------------");
st->cr();
- // STEP("(printing OS information)")
+ // STEP("printing OS information")
os::print_os_info(st);
st->cr();
- // STEP("(printing CPU info)")
+ // STEP("printing CPU info")
os::print_cpu_info(st, buf, sizeof(buf));
st->cr();
- // STEP("(printing memory info)")
+ // STEP("printing memory info")
os::print_memory_info(st);
st->cr();
- // STEP("(printing internal vm info)")
+ // STEP("printing internal vm info")
st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string());
st->cr();
// print a defined marker to show that error handling finished correctly.
- // STEP("(printing end marker)")
+ // STEP("printing end marker")
st->print_cr("END.");
}
@@ -1190,7 +1190,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
}
jio_snprintf(buffer, sizeof(buffer),
- "[error occurred during error reporting %s, id 0x%x]",
+ "[error occurred during error reporting (%s), id 0x%x]",
_current_step_info, _id);
if (log.is_open()) {
log.cr();
From c16b4b76731d971dcca9deeec20d5e8dae03190b Mon Sep 17 00:00:00 2001
From: Jon Masamitsu
Date: Thu, 6 Aug 2015 22:07:30 -0700
Subject: [PATCH 006/381] 6858051: Create GC worker threads dynamically
Reviewed-by: tschatzl, drwhite
---
.../share/vm/gc/parallel/gcTaskManager.cpp | 73 ++++++++++++------
.../share/vm/gc/parallel/gcTaskManager.hpp | 12 ++-
.../src/share/vm/gc/parallel/gcTaskThread.cpp | 7 --
.../src/share/vm/gc/parallel/gcTaskThread.hpp | 6 +-
.../share/vm/gc/shared/adaptiveSizePolicy.cpp | 9 +--
.../share/vm/gc/shared/adaptiveSizePolicy.hpp | 2 +-
.../src/share/vm/gc/shared/workerManager.hpp | 77 +++++++++++++++++++
hotspot/src/share/vm/gc/shared/workgroup.cpp | 53 +++++++------
hotspot/src/share/vm/gc/shared/workgroup.hpp | 22 +++++-
9 files changed, 196 insertions(+), 65 deletions(-)
create mode 100644 hotspot/src/share/vm/gc/shared/workerManager.hpp
diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp
index 57e91b6d16c..2ec5d190293 100644
--- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
#include "precompiled.hpp"
#include "gc/parallel/gcTaskManager.hpp"
#include "gc/parallel/gcTaskThread.hpp"
-#include "gc/shared/adaptiveSizePolicy.hpp"
#include "gc/shared/gcId.hpp"
+#include "gc/shared/workerManager.hpp"
#include "logging/log.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
@@ -34,6 +34,7 @@
#include "runtime/mutex.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/orderAccess.inline.hpp"
+#include "runtime/os.hpp"
//
// GCTask
@@ -372,10 +373,28 @@ SynchronizedGCTaskQueue::~SynchronizedGCTaskQueue() {
GCTaskManager::GCTaskManager(uint workers) :
_workers(workers),
_active_workers(0),
- _idle_workers(0) {
+ _idle_workers(0),
+ _created_workers(0) {
initialize();
}
+GCTaskThread* GCTaskManager::install_worker(uint t) {
+ GCTaskThread* new_worker = GCTaskThread::create(this, t, _processor_assignment[t]);
+ set_thread(t, new_worker);
+ return new_worker;
+}
+
+void GCTaskManager::add_workers(bool initializing) {
+ os::ThreadType worker_type = os::pgc_thread;
+ _created_workers = WorkerManager::add_workers(this,
+ _active_workers,
+ (uint) _workers,
+ _created_workers,
+ worker_type,
+ initializing);
+ _active_workers = MIN2(_created_workers, _active_workers);
+}
+
void GCTaskManager::initialize() {
if (TraceGCTaskManager) {
tty->print_cr("GCTaskManager::initialize: workers: %u", workers());
@@ -394,28 +413,30 @@ void GCTaskManager::initialize() {
// Set up worker threads.
// Distribute the workers among the available processors,
// unless we were told not to, or if the os doesn't want to.
- uint* processor_assignment = NEW_C_HEAP_ARRAY(uint, workers(), mtGC);
+ _processor_assignment = NEW_C_HEAP_ARRAY(uint, workers(), mtGC);
if (!BindGCTaskThreadsToCPUs ||
- !os::distribute_processes(workers(), processor_assignment)) {
+ !os::distribute_processes(workers(), _processor_assignment)) {
for (uint a = 0; a < workers(); a += 1) {
- processor_assignment[a] = sentinel_worker();
+ _processor_assignment[a] = sentinel_worker();
}
}
+
_thread = NEW_C_HEAP_ARRAY(GCTaskThread*, workers(), mtGC);
- for (uint t = 0; t < workers(); t += 1) {
- set_thread(t, GCTaskThread::create(this, t, processor_assignment[t]));
+ _active_workers = ParallelGCThreads;
+ if (UseDynamicNumberOfGCThreads && !FLAG_IS_CMDLINE(ParallelGCThreads)) {
+ _active_workers = 1U;
}
+
Log(gc, task, thread) log;
if (log.is_trace()) {
ResourceMark rm;
outputStream* out = log.trace_stream();
out->print("GCTaskManager::initialize: distribution:");
for (uint t = 0; t < workers(); t += 1) {
- out->print(" %u", processor_assignment[t]);
+ out->print(" %u", _processor_assignment[t]);
}
out->cr();
}
- FREE_C_HEAP_ARRAY(uint, processor_assignment);
}
reset_busy_workers();
set_unblocked();
@@ -426,9 +447,8 @@ void GCTaskManager::initialize() {
reset_completed_tasks();
reset_barriers();
reset_emptied_queue();
- for (uint s = 0; s < workers(); s += 1) {
- thread(s)->start();
- }
+
+ add_workers(true);
}
GCTaskManager::~GCTaskManager() {
@@ -437,13 +457,17 @@ GCTaskManager::~GCTaskManager() {
NoopGCTask::destroy(_noop_task);
_noop_task = NULL;
if (_thread != NULL) {
- for (uint i = 0; i < workers(); i += 1) {
+ for (uint i = 0; i < created_workers(); i += 1) {
GCTaskThread::destroy(thread(i));
set_thread(i, NULL);
}
FREE_C_HEAP_ARRAY(GCTaskThread*, _thread);
_thread = NULL;
}
+ if (_processor_assignment != NULL) {
+ FREE_C_HEAP_ARRAY(uint, _processor_assignment);
+ _processor_assignment = NULL;
+ }
if (_resource_flag != NULL) {
FREE_C_HEAP_ARRAY(bool, _resource_flag);
_resource_flag = NULL;
@@ -470,6 +494,9 @@ void GCTaskManager::set_active_gang() {
"all_workers_active() is incorrect: "
"active %d ParallelGCThreads %u", active_workers(),
ParallelGCThreads);
+ _active_workers = MIN2(_active_workers, _workers);
+ // "add_workers" does not guarantee any additional workers
+ add_workers(false);
log_trace(gc, task)("GCTaskManager::set_active_gang(): "
"all_workers_active() %d workers %d "
"active %d ParallelGCThreads %u",
@@ -499,7 +526,7 @@ void GCTaskManager::task_idle_workers() {
// is starting). Try later to release enough idle_workers
// to allow the desired number of active_workers.
more_inactive_workers =
- workers() - active_workers() - idle_workers();
+ created_workers() - active_workers() - idle_workers();
if (more_inactive_workers < 0) {
int reduced_active_workers = active_workers() + more_inactive_workers;
set_active_workers(reduced_active_workers);
@@ -507,7 +534,7 @@ void GCTaskManager::task_idle_workers() {
}
log_trace(gc, task)("JT: %d workers %d active %d idle %d more %d",
Threads::number_of_non_daemon_threads(),
- workers(),
+ created_workers(),
active_workers(),
idle_workers(),
more_inactive_workers);
@@ -517,7 +544,7 @@ void GCTaskManager::task_idle_workers() {
q->enqueue(IdleGCTask::create_on_c_heap());
increment_idle_workers();
}
- assert(workers() == active_workers() + idle_workers(),
+ assert(created_workers() == active_workers() + idle_workers(),
"total workers should equal active + inactive");
add_list(q);
// GCTaskQueue* q was created in a ResourceArea so a
@@ -539,14 +566,15 @@ void GCTaskManager::print_task_time_stamps() {
if (!log_is_enabled(Debug, gc, task, time)) {
return;
}
- for(uint i=0; iprint_task_time_stamps();
}
}
void GCTaskManager::print_threads_on(outputStream* st) {
- uint num_thr = workers();
+ uint num_thr = created_workers();
for (uint i = 0; i < num_thr; i++) {
thread(i)->print_on(st);
st->cr();
@@ -555,19 +583,20 @@ void GCTaskManager::print_threads_on(outputStream* st) {
void GCTaskManager::threads_do(ThreadClosure* tc) {
assert(tc != NULL, "Null ThreadClosure");
- uint num_thr = workers();
+ uint num_thr = created_workers();
for (uint i = 0; i < num_thr; i++) {
tc->do_thread(thread(i));
}
}
GCTaskThread* GCTaskManager::thread(uint which) {
- assert(which < workers(), "index out of bounds");
+ assert(which < created_workers(), "index out of bounds");
assert(_thread[which] != NULL, "shouldn't have null thread");
return _thread[which];
}
void GCTaskManager::set_thread(uint which, GCTaskThread* value) {
+ // "_created_workers" may not have been updated yet so use workers()
assert(which < workers(), "index out of bounds");
assert(value != NULL, "shouldn't have null thread");
_thread[which] = value;
@@ -728,7 +757,7 @@ uint GCTaskManager::decrement_busy_workers() {
void GCTaskManager::release_all_resources() {
// If you want this to be done atomically, do it in a WaitForBarrierGCTask.
- for (uint i = 0; i < workers(); i += 1) {
+ for (uint i = 0; i < created_workers(); i += 1) {
set_resource_flag(i, true);
}
}
diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp
index 9d462039ad7..70ac6b2d226 100644
--- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -370,6 +370,7 @@ private:
Monitor* _monitor; // Notification of changes.
SynchronizedGCTaskQueue* _queue; // Queue of tasks.
GCTaskThread** _thread; // Array of worker threads.
+ uint _created_workers; // Number of workers created.
uint _active_workers; // Number of active workers.
uint _busy_workers; // Number of busy workers.
uint _blocking_worker; // The worker that's blocking.
@@ -381,6 +382,8 @@ private:
NoopGCTask* _noop_task; // The NoopGCTask instance.
WaitHelper _wait_helper; // Used by inactive worker
volatile uint _idle_workers; // Number of idled workers
+ uint* _processor_assignment; // Worker to cpu mappings. May
+ // be used lazily
public:
// Factory create and destroy methods.
static GCTaskManager* create(uint workers) {
@@ -546,6 +549,13 @@ protected:
uint active_workers() const {
return _active_workers;
}
+ uint created_workers() const {
+ return _created_workers;
+ }
+ // Create a GC worker and install into GCTaskManager
+ GCTaskThread* install_worker(uint worker_id);
+ // Add GC workers as needed.
+ void add_workers(bool initializing);
};
//
diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp
index d81db6900e1..f6fd1a38a6f 100644
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp
@@ -44,9 +44,6 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager,
_time_stamps(NULL),
_time_stamp_index(0)
{
- if (!os::create_thread(this, os::pgc_thread))
- vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GC thread. Out of system resources.");
-
set_id(which);
set_name("ParGC Thread#%d", which);
}
@@ -57,10 +54,6 @@ GCTaskThread::~GCTaskThread() {
}
}
-void GCTaskThread::start() {
- os::start_thread(this);
-}
-
GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) {
guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries");
if (_time_stamps == NULL) {
diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp
index 49f9bd07fbf..aa10a69531a 100644
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,13 +48,13 @@ private:
bool _is_working; // True if participating in GC tasks
- public:
// Factory create and destroy methods.
static GCTaskThread* create(GCTaskManager* manager,
uint which,
uint processor_id) {
return new GCTaskThread(manager, which, processor_id);
}
+ public:
static void destroy(GCTaskThread* manager) {
if (manager != NULL) {
delete manager;
@@ -65,8 +65,6 @@ private:
return true;
}
virtual void run();
- // Methods.
- void start();
void print_task_time_stamps();
diff --git a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp
index 8365c62766f..9aa3f79c08d 100644
--- a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp
+++ b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -130,10 +130,7 @@ uint AdaptiveSizePolicy::calc_default_active_workers(uintx total_workers,
uintx max_active_workers =
MAX2(active_workers_by_JT, active_workers_by_heap_size);
- // Limit the number of workers to the the number created,
- // (workers()).
- new_active_workers = MIN2(max_active_workers,
- (uintx) total_workers);
+ new_active_workers = MIN2(max_active_workers, (uintx) total_workers);
// Increase GC workers instantly but decrease them more
// slowly.
@@ -167,7 +164,7 @@ uint AdaptiveSizePolicy::calc_default_active_workers(uintx total_workers,
"Jiggled active workers too much");
}
- log_trace(gc, task)("GCTaskManager::calc_default_active_workers() : "
+ log_trace(gc, task)("GCTaskManager::calc_default_active_workers() : "
"active_workers(): " UINTX_FORMAT " new_active_workers: " UINTX_FORMAT " "
"prev_active_workers: " UINTX_FORMAT "\n"
" active_workers_by_JT: " UINTX_FORMAT " active_workers_by_heap_size: " UINTX_FORMAT,
diff --git a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp
index eb483623d20..27bc4f307a0 100644
--- a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp
+++ b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/hotspot/src/share/vm/gc/shared/workerManager.hpp b/hotspot/src/share/vm/gc/shared/workerManager.hpp
new file mode 100644
index 00000000000..9dfa7d745bc
--- /dev/null
+++ b/hotspot/src/share/vm/gc/shared/workerManager.hpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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_GC_SHARED_WORKERMANAGER_HPP
+#define SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
+
+#include "gc/shared/adaptiveSizePolicy.hpp"
+
+class WorkerManager : public AllStatic {
+ public:
+ // Create additional workers as needed.
+ // active_workers - number of workers being requested for an upcoming
+ // parallel task.
+ // total_workers - total number of workers. This is the maximum
+ // number possible.
+ // created_workers - number of workers already created. This maybe
+ // less than, equal to, or greater than active workers. If greater than
+ // or equal to active_workers, nothing is done.
+ // worker_type - type of thread.
+ // initializing - true if this is called to get the initial number of
+ // GC workers.
+ // If initializing is true, do a vm exit if the workers cannot be created.
+ // The initializing = true case is for JVM start up and failing to
+ // create all the worker at start should considered a problem so exit.
+ // If initializing = false, there are already some number of worker
+ // threads and a failure would not be optimal but should not be fatal.
+ template
+ static uint add_workers (WorkerType* holder,
+ uint active_workers,
+ uint total_workers,
+ uint created_workers,
+ os::ThreadType worker_type,
+ bool initializing) {
+ uint start = created_workers;
+ uint end = MIN2(active_workers, total_workers);
+ for (uint worker_id = start; worker_id < end; worker_id += 1) {
+ WorkerThread* new_worker = holder->install_worker(worker_id);
+ assert(new_worker != NULL, "Failed to allocate GangWorker");
+ if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) {
+ if(initializing) {
+ vm_exit_out_of_memory(0, OOM_MALLOC_ERROR,
+ "Cannot create worker GC thread. Out of system resources.");
+ }
+ }
+ created_workers++;
+ os::start_thread(new_worker);
+ }
+
+ log_trace(gc, task)("AdaptiveSizePolicy::add_workers() : "
+ "active_workers: %u created_workers: %u",
+ active_workers, created_workers);
+
+ return created_workers;
+ }
+};
+#endif // SHARE_VM_GC_SHARED_WORKERMANAGER_HPP
diff --git a/hotspot/src/share/vm/gc/shared/workgroup.cpp b/hotspot/src/share/vm/gc/shared/workgroup.cpp
index 715b6a1e3b6..0dfffcd82e8 100644
--- a/hotspot/src/share/vm/gc/shared/workgroup.cpp
+++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "gc/shared/gcId.hpp"
#include "gc/shared/workgroup.hpp"
+#include "gc/shared/workerManager.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/atomic.inline.hpp"
@@ -35,37 +36,45 @@
// Definitions of WorkGang methods.
// The current implementation will exit if the allocation
-// of any worker fails. Still, return a boolean so that
-// a future implementation can possibly do a partial
-// initialization of the workers and report such to the
-// caller.
-bool AbstractWorkGang::initialize_workers() {
+// of any worker fails.
+void AbstractWorkGang::initialize_workers() {
log_develop_trace(gc, workgang)("Constructing work gang %s with %u threads", name(), total_workers());
_workers = NEW_C_HEAP_ARRAY(AbstractGangWorker*, total_workers(), mtInternal);
if (_workers == NULL) {
vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array.");
- return false;
}
+
+ _active_workers = ParallelGCThreads;
+ if (UseDynamicNumberOfGCThreads && !FLAG_IS_CMDLINE(ParallelGCThreads)) {
+ _active_workers = 1U;
+ }
+
+ add_workers(true);
+}
+
+
+AbstractGangWorker* AbstractWorkGang::install_worker(uint worker_id) {
+ AbstractGangWorker* new_worker = allocate_worker(worker_id);
+ set_thread(worker_id, new_worker);
+ return new_worker;
+}
+
+void AbstractWorkGang::add_workers(bool initializing) {
+
os::ThreadType worker_type;
if (are_ConcurrentGC_threads()) {
worker_type = os::cgc_thread;
} else {
worker_type = os::pgc_thread;
}
- for (uint worker = 0; worker < total_workers(); worker += 1) {
- AbstractGangWorker* new_worker = allocate_worker(worker);
- assert(new_worker != NULL, "Failed to allocate GangWorker");
- _workers[worker] = new_worker;
- if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) {
- vm_exit_out_of_memory(0, OOM_MALLOC_ERROR,
- "Cannot create worker GC thread. Out of system resources.");
- return false;
- }
- if (!DisableStartThread) {
- os::start_thread(new_worker);
- }
- }
- return true;
+
+ _created_workers = WorkerManager::add_workers(this,
+ _active_workers,
+ _total_workers,
+ _created_workers,
+ worker_type,
+ initializing);
+ _active_workers = MIN2(_created_workers, _active_workers);
}
AbstractGangWorker* AbstractWorkGang::worker(uint i) const {
@@ -79,7 +88,7 @@ AbstractGangWorker* AbstractWorkGang::worker(uint i) const {
}
void AbstractWorkGang::print_worker_threads_on(outputStream* st) const {
- uint workers = total_workers();
+ uint workers = created_workers();
for (uint i = 0; i < workers; i++) {
worker(i)->print_on(st);
st->cr();
@@ -88,7 +97,7 @@ void AbstractWorkGang::print_worker_threads_on(outputStream* st) const {
void AbstractWorkGang::threads_do(ThreadClosure* tc) const {
assert(tc != NULL, "Null ThreadClosure");
- uint workers = total_workers();
+ uint workers = created_workers();
for (uint i = 0; i < workers; i++) {
tc->do_thread(worker(i));
}
diff --git a/hotspot/src/share/vm/gc/shared/workgroup.hpp b/hotspot/src/share/vm/gc/shared/workgroup.hpp
index 657b00c9a21..388909168be 100644
--- a/hotspot/src/share/vm/gc/shared/workgroup.hpp
+++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp
@@ -112,6 +112,8 @@ class AbstractWorkGang : public CHeapObj {
uint _total_workers;
// The currently active workers in this gang.
uint _active_workers;
+ // The count of created workers in the gang.
+ uint _created_workers;
// Printing support.
const char* _name;
@@ -120,23 +122,32 @@ class AbstractWorkGang : public CHeapObj {
const bool _are_GC_task_threads;
const bool _are_ConcurrentGC_threads;
+ void set_thread(uint worker_id, AbstractGangWorker* worker) {
+ _workers[worker_id] = worker;
+ }
+
public:
AbstractWorkGang(const char* name, uint workers, bool are_GC_task_threads, bool are_ConcurrentGC_threads) :
_name(name),
_total_workers(workers),
_active_workers(UseDynamicNumberOfGCThreads ? 1U : workers),
+ _created_workers(0),
_are_GC_task_threads(are_GC_task_threads),
_are_ConcurrentGC_threads(are_ConcurrentGC_threads)
{ }
// Initialize workers in the gang. Return true if initialization succeeded.
- bool initialize_workers();
+ void initialize_workers();
bool are_GC_task_threads() const { return _are_GC_task_threads; }
bool are_ConcurrentGC_threads() const { return _are_ConcurrentGC_threads; }
uint total_workers() const { return _total_workers; }
+ uint created_workers() const {
+ return _created_workers;
+ }
+
virtual uint active_workers() const {
assert(_active_workers <= _total_workers,
"_active_workers: %u > _total_workers: %u", _active_workers, _total_workers);
@@ -144,22 +155,29 @@ class AbstractWorkGang : public CHeapObj {
"Unless dynamic should use total workers");
return _active_workers;
}
+
void set_active_workers(uint v) {
assert(v <= _total_workers,
"Trying to set more workers active than there are");
_active_workers = MIN2(v, _total_workers);
+ add_workers(false /* exit_on_failure */);
assert(v != 0, "Trying to set active workers to 0");
- _active_workers = MAX2(1U, _active_workers);
assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
"Unless dynamic should use total workers");
log_info(gc, task)("GC Workers: using %d out of %d", _active_workers, _total_workers);
}
+ // Add GC workers as needed.
+ void add_workers(bool initializing);
+
// Return the Ith worker.
AbstractGangWorker* worker(uint i) const;
void threads_do(ThreadClosure* tc) const;
+ // Create a GC worker and install it into the work gang.
+ virtual AbstractGangWorker* install_worker(uint which);
+
// Debugging.
const char* name() const { return _name; }
From 72f951e112562a5dcc0c06fd745e93e9d48a80b6 Mon Sep 17 00:00:00 2001
From: Alex Henrie
Date: Tue, 17 Nov 2015 23:10:30 -0700
Subject: [PATCH 007/381] 8145278: Fix memory leak in splitPathList
Reviewed-by: sspitsyn, dsamersoff, dcubed
---
.../share/native/libinstrument/InvocationAdapter.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c b/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c
index 0c57f8b289d..a74b2b725ba 100644
--- a/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c
+++ b/jdk/src/java.instrument/share/native/libinstrument/InvocationAdapter.c
@@ -518,18 +518,22 @@ static void
splitPathList(const char* str, int* pathCount, char*** paths) {
int count = 0;
char** segments = NULL;
+ char** new_segments;
char* c = (char*) str;
while (*c != '\0') {
while (*c == ' ') c++; /* skip leading spaces */
if (*c == '\0') {
break;
}
- if (segments == NULL) {
- segments = (char**)malloc( sizeof(char**) );
- } else {
- segments = (char**)realloc( segments, (count+1)*sizeof(char**) );
+ new_segments = (char**)realloc(segments, (count+1)*sizeof(char*));
+ if (new_segments == NULL) {
+ jplis_assert(0);
+ free(segments);
+ count = 0;
+ segments = NULL;
+ break;
}
- jplis_assert(segments != (char**)NULL);
+ segments = new_segments;
segments[count++] = c;
c = strchr(c, ' ');
if (c == NULL) {
From 34abb0688722c725998916cf5b61d7660c24e0c4 Mon Sep 17 00:00:00 2001
From: Gil Tene
Date: Wed, 30 Mar 2016 17:04:09 +0200
Subject: [PATCH 008/381] 8147844: new method j.l.Thread.onSpinWait() and the
corresponding x86 hotspot instrinsic
See JEP-285 for details
Co-authored-by: Ivan Krylov
Reviewed-by: psandoz, alanb, dholmes
---
.../share/classes/java/lang/Thread.java | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java
index eb47a05427d..972815e16c7 100644
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java
@@ -340,6 +340,45 @@ class Thread implements Runnable {
sleep(millis);
}
+ /**
+ * Indicates that the caller is momentarily unable to progress, until the
+ * occurrence of one or more actions on the part of other activities. By
+ * invoking this method within each iteration of a spin-wait loop construct,
+ * the calling thread indicates to the runtime that it is busy-waiting.
+ * The runtime may take action to improve the performance of invoking
+ * spin-wait loop constructions.
+ *
+ * @apiNote
+ * As an example consider a method in a class that spins in a loop until
+ * some flag is set outside of that method. A call to the {@code onSpinWait}
+ * method should be placed inside the spin loop.
+ *
{@code
+ * class EventHandler {
+ * volatile boolean eventNotificationNotReceived;
+ * void waitForEventAndHandleIt() {
+ * while ( eventNotificationNotReceived ) {
+ * java.lang.Thread.onSpinWait();
+ * }
+ * readAndProcessEvent();
+ * }
+ *
+ * void readAndProcessEvent() {
+ * // Read event from some source and process it
+ * . . .
+ * }
+ * }
+ * }
+ *
+ * The code above would remain correct even if the {@code onSpinWait}
+ * method was not called at all. However on some architectures the Java
+ * Virtual Machine may issue the processor instructions to address such
+ * code patterns in a more beneficial way.
+ *
+ * @since 9
+ */
+ @HotSpotIntrinsicCandidate
+ public static void onSpinWait() {}
+
/**
* Initializes a Thread with the current AccessControlContext.
* @see #init(ThreadGroup,Runnable,String,long,AccessControlContext,boolean)
From fd6507d3538a451cdeb8b31ea2ea8633d66c466e Mon Sep 17 00:00:00 2001
From: Stefan Karlsson
Date: Wed, 20 Apr 2016 09:57:01 +0200
Subject: [PATCH 009/381] 8072921: -Xincgc should be removed from output
Reviewed-by: alanb
---
.../share/classes/sun/launcher/resources/launcher.properties | 1 -
1 file changed, 1 deletion(-)
diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
index 52d621b414d..f678ba37057 100644
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
@@ -99,7 +99,6 @@ java.launcher.X.usage=\
\ -Xdiag show additional diagnostic messages\n\
\ -Xdiag:resolver show resolver diagnostic messages\n\
\ -Xnoclassgc disable class garbage collection\n\
-\ -Xincgc enable incremental garbage collection\n\
\ -Xloggc: log GC status to a file with time stamps\n\
\ -Xbatch disable background compilation\n\
\ -Xms set initial Java heap size\n\
From 3f6fc8998db487dbf80789d6ae78b07d3aed2933 Mon Sep 17 00:00:00 2001
From: Dmitry Samersoff
Date: Wed, 20 Apr 2016 18:01:02 +0300
Subject: [PATCH 010/381] 8152847: JDI use of sun.boot.class.path needs to be
updated for Jigsaw
Remove references to bootclasspath
Reviewed-by: alanb, sspitsyn
---
.../share/classes/com/sun/tools/example/debug/tty/Commands.java | 1 -
.../classes/com/sun/tools/example/debug/tty/TTYResources.java | 1 -
.../com/sun/tools/example/debug/tty/TTYResources_ja.java | 1 -
.../com/sun/tools/example/debug/tty/TTYResources_zh_CN.java | 1 -
.../share/classes/com/sun/tools/jdi/VirtualMachineImpl.java | 2 +-
5 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java
index 61823822d0e..11a376e0f22 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/Commands.java
@@ -1534,7 +1534,6 @@ class Commands {
PathSearchingVirtualMachine vm = (PathSearchingVirtualMachine)Env.vm();
MessageOutput.println("base directory:", vm.baseDirectory());
MessageOutput.println("classpath:", vm.classPath().toString());
- MessageOutput.println("bootclasspath:", vm.bootClassPath().toString());
} else {
MessageOutput.println("The VM does not use paths");
}
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java
index c412743c4b6..39e703d88b8 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources.java
@@ -74,7 +74,6 @@ public class TTYResources extends java.util.ListResourceBundle {
{"Array element is not a method", "Array element is not a method"},
{"Array index must be a integer type", "Array index must be a integer type"},
{"base directory:", "base directory: {0}"},
- {"bootclasspath:", "bootclasspath: {0}"},
{"Breakpoint hit:", "Breakpoint hit: "},
{"breakpoint", "breakpoint {0}"},
{"Breakpoints set:", "Breakpoints set:"},
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java
index 1cb6d231d50..b3562226398 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_ja.java
@@ -74,7 +74,6 @@ public class TTYResources_ja extends java.util.ListResourceBundle {
{"Array element is not a method", "\u914D\u5217\u8981\u7D20\u306F\u30E1\u30BD\u30C3\u30C9\u3067\u306F\u3042\u308A\u307E\u305B\u3093"},
{"Array index must be a integer type", "\u914D\u5217\u306E\u6DFB\u3048\u5B57\u306F\u6574\u6570\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
{"base directory:", "\u30D9\u30FC\u30B9\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA: {0}"},
- {"bootclasspath:", "\u30D6\u30FC\u30C8\u30FB\u30AF\u30E9\u30B9\u30D1\u30B9: {0}"},
{"Breakpoint hit:", "\u30D2\u30C3\u30C8\u3057\u305F\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8: "},
{"breakpoint", "\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8{0}"},
{"Breakpoints set:", "\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u30D6\u30EC\u30FC\u30AF\u30DD\u30A4\u30F3\u30C8:"},
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java
index 50790cb9d72..79dc9268da0 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTYResources_zh_CN.java
@@ -74,7 +74,6 @@ public class TTYResources_zh_CN extends java.util.ListResourceBundle {
{"Array element is not a method", "\u6570\u7EC4\u5143\u7D20\u4E0D\u662F\u65B9\u6CD5"},
{"Array index must be a integer type", "\u6570\u7EC4\u7D22\u5F15\u5FC5\u987B\u4E3A\u6574\u6570\u7C7B\u578B"},
{"base directory:", "\u57FA\u76EE\u5F55: {0}"},
- {"bootclasspath:", "\u5F15\u5BFC\u7C7B\u8DEF\u5F84: {0}"},
{"Breakpoint hit:", "\u65AD\u70B9\u547D\u4E2D: "},
{"breakpoint", "\u65AD\u70B9{0}"},
{"Breakpoints set:", "\u65AD\u70B9\u96C6:"},
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
index 47e743483e3..28c3dfbfa3c 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
@@ -1439,7 +1439,7 @@ class VirtualMachineImpl extends MirrorImpl
}
public List bootClassPath() {
- return Arrays.asList(getClasspath().bootclasspaths);
+ return Collections.emptyList();
}
public String baseDirectory() {
From ebbecb1b63493e47e7ad3a4d49698564ae1ac99a Mon Sep 17 00:00:00 2001
From: Dmitry Samersoff
Date: Thu, 21 Apr 2016 13:18:46 +0300
Subject: [PATCH 011/381] 8143921:
nsk/jdi/ObjectReference/waitingThreads/waitingthreads003 fails with
JVMTI_ERROR_INVALID_CLASS
Skip invalid classes
Reviewed-by: sspitsyn
---
.../share/native/libjdwp/VirtualMachineImpl.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
index 2718ad1e3a4..8e1639c5e2e 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
@@ -126,7 +126,7 @@ classesForSignature(PacketInputStream *in, PacketOutputStream *out)
int writtenCount = 0;
int i;
- for (i=0; i
Date: Mon, 25 Apr 2016 15:32:35 +0200
Subject: [PATCH 012/381] 8154529: some places in the invoke.c that use
InvokeRequest* not protected with invokerLock
Reviewed-by: sspitsyn
---
.../share/native/libjdwp/invoker.c | 21 +++++++------------
.../share/native/libjdwp/invoker.h | 1 -
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
index cd1cd2f7dc0..3baf486c233 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c
@@ -277,12 +277,14 @@ invoker_enableInvokeRequests(jthread thread)
JDI_ASSERT(thread);
+ debugMonitorEnter(invokerLock);
request = threadControl_getInvokeRequest(thread);
if (request == NULL) {
EXIT_ERROR(AGENT_ERROR_INVALID_THREAD, "getting thread invoke request");
}
request->available = JNI_TRUE;
+ debugMonitorExit(invokerLock);
}
jvmtiError
@@ -738,30 +740,21 @@ invoker_completeInvokeRequest(jthread thread)
}
}
-jboolean
-invoker_isPending(jthread thread)
-{
- InvokeRequest *request;
-
- JDI_ASSERT(thread);
- request = threadControl_getInvokeRequest(thread);
- if (request == NULL) {
- EXIT_ERROR(AGENT_ERROR_INVALID_THREAD, "getting thread invoke request");
- }
- return request->pending;
-}
-
jboolean
invoker_isEnabled(jthread thread)
{
InvokeRequest *request;
+ jboolean isEnabled;
JDI_ASSERT(thread);
+ debugMonitorEnter(invokerLock);
request = threadControl_getInvokeRequest(thread);
if (request == NULL) {
EXIT_ERROR(AGENT_ERROR_INVALID_THREAD, "getting thread invoke request");
}
- return request->available;
+ isEnabled = request->available;
+ debugMonitorExit(invokerLock);
+ return isEnabled;
}
void
diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h
index 29ecdb5d59c..e004ce6ef8e 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.h
@@ -67,7 +67,6 @@ jvmtiError invoker_requestInvoke(jbyte invokeType, jbyte options, jint id,
jboolean invoker_doInvoke(jthread thread);
void invoker_completeInvokeRequest(jthread thread);
-jboolean invoker_isPending(jthread thread);
jboolean invoker_isEnabled(jthread thread);
void invoker_detach(InvokeRequest *request);
From af802cb54114616dc74217ac91a65ecdb15d144f Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov
Date: Mon, 25 Apr 2016 19:14:30 +0300
Subject: [PATCH 013/381] 7124381: DragSourceListener.dragDropEnd() never been
called on completion of dnd operation
Reviewed-by: yan, ssadetsky
---
.../dnd/Button2DragTest/Button2DragTest.html | 45 ----------
.../dnd/Button2DragTest/Button2DragTest.java | 82 +++++++++----------
2 files changed, 41 insertions(+), 86 deletions(-)
delete mode 100644 jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.html
diff --git a/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.html b/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.html
deleted file mode 100644
index 91dcf4f413d..00000000000
--- a/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
-
-
-
-
Button2DragTest Bug ID: 4955110
-
-
This is an AUTOMATIC test, simply wait for completion
-
-
-
-
diff --git a/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java b/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java
index 33bb5058706..c5045ed7fa7 100644
--- a/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java
+++ b/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,45 +21,52 @@
* questions.
*/
-/*
- test
- @bug 4955110
- @summary tests that a drag ends on button2 release
- @author Alexander.Gerasimov area=dnd
- @library ../../regtesthelpers
- @build Util
- @run applet/othervm Button2DragTest.html
-*/
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.datatransfer.StringSelection;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragSourceAdapter;
+import java.awt.dnd.DragSourceDropEvent;
+import java.awt.dnd.DragSourceListener;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetAdapter;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.event.InputEvent;
-
-/**
- * Button2DragTest.java
- *
- * summary: tests that DragSourceDragEvent.getDropAction() accords to its new spec
- * (does not depend on the user drop action)
- *
- */
-
-import java.applet.Applet;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.datatransfer.*;
-import java.awt.dnd.*;
import test.java.awt.regtesthelpers.Util;
-
-public class Button2DragTest extends Applet {
+/**
+ * @test
+ * @bug 4955110
+ * @summary tests that DragSourceDragEvent.getDropAction() accords to its new
+ * spec (does not depend on the user drop action)
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main/othervm Button2DragTest
+ * @author Alexander.Gerasimov area=dnd
+ */
+public final class Button2DragTest {
private volatile boolean dropSuccess;
- private Frame frame;
+ private static Frame frame;
+ public static void main(final String[] args) {
+ Button2DragTest test = new Button2DragTest();
+ try {
+ test.run();
+ } finally {
+ if (frame != null) {
+ frame.dispose();
+ }
+ }
+ }
- public void init() {
- // Set up the environment -- set the layout manager, add
- // buttons, etc.
- setLayout(new BorderLayout());
-
+ public void run() {
frame = new Frame();
final DragSourceListener dragSourceListener = new DragSourceAdapter() {
@@ -84,20 +91,13 @@ public class Button2DragTest extends Applet {
}
};
new DropTarget(frame, dropTargetListener);
- }
-
-
- public void start() {
- //Get things going. Request focus, set size, et cetera
- setSize(200,200);
- setVisible(true);
- validate();
//What would normally go into main() will probably go here.
//Use System.out.println for diagnostic messages that you want
//to read after the test is done.
-
+ frame.setUndecorated(true);
frame.setBounds(100, 100, 200, 200);
+ frame.setLocationRelativeTo(null);
frame.setVisible(true);
Robot robot = Util.createRobot();
From 5874c487963e3aaf423b2c43cd18b8f1a290347e Mon Sep 17 00:00:00 2001
From: Avik Niyogi
Date: Wed, 27 Apr 2016 12:08:37 +0400
Subject: [PATCH 014/381] 8152492: [macosx swing] double key event actions when
using Mac menubar
Reviewed-by: serb, mhalder, alexsch
---
.../native/libawt_lwawt/awt/CMenuItem.m | 113 ++++++------------
.../ActionListenerCalledTwiceTest.java | 33 +++--
2 files changed, 59 insertions(+), 87 deletions(-)
diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m
index 28e4f386d78..e6b7e21bccb 100644
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m
@@ -25,7 +25,6 @@
#import
#include
-
#import "CMenuItem.h"
#import "CMenu.h"
#import "AWTEvent.h"
@@ -64,42 +63,6 @@
- (BOOL) worksWhenModal {
return YES;
}
-// This is a method written using Carbon framework methods to remove
-// All modifiers including "Shift" modifier.
-// Example 1: Shortcut set is "Command Shift m" returns "m"
-// Example 2: Shortcut set is "Command m" returns "m"
-// Example 3: Shortcut set is "Alt Shift ," returns ","
-
-CFStringRef createStringForKey(CGKeyCode keyCode)
-{
- TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
-// currentKeyboard now contains the current input source
- CFDataRef layoutData =
- TISGetInputSourceProperty(currentKeyboard,
- kTISPropertyUnicodeKeyLayoutData);
-// the UNICODE keyLayout is fetched from currentKeyboard in layoutData
- const UCKeyboardLayout *keyboardLayout =
- (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData);
-// A read-only data pointer is fetched from layoutData
- UInt32 keysDown = 0;
- UniChar chars[4];
- UniCharCount realLength;
-
- UCKeyTranslate(keyboardLayout,
- keyCode,
- kUCKeyActionDisplay,
- 0,
- LMGetKbdType(),
- kUCKeyTranslateNoDeadKeysBit,
- &keysDown,
- sizeof(chars) / sizeof(chars[0]),
- &realLength,
- chars);
- CFRelease(currentKeyboard);
-// Converts keyCode, modifier and dead-key state into UNICODE characters
- return CFStringCreateWithCharacters(kCFAllocatorDefault, chars, 1);
-}
-
// Events
- (void)handleAction:(NSMenuItem *)sender {
AWT_ASSERT_APPKIT_THREAD;
@@ -116,35 +79,6 @@ CFStringRef createStringForKey(CGKeyCode keyCode)
// from this "frameless" menu, because there are no active windows. This
// means we have to handle it here.
NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent];
- if ([currEvent type] == NSKeyDown) {
- NSString *menuKey = [sender keyEquivalent];
-// If shortcut is "Command Shift ," the menuKey gets the value ","
-// But [currEvent charactersIgnoringModifiers]; returns "<" and not ","
-// because the charactersIgnoreingModifiers does not ignore "Shift"
-// So a shortcut like "Command Shift m" will return "M" where as the
-// MenuKey will have the value "m". To remove this issue the below
-// createStringForKey is used.
- NSString *eventKey = createStringForKey([currEvent keyCode]);
-
-// Apple uses characters from private Unicode range for some of the
-// keys, so we need to do the same translation here that we do
-// for the regular key down events
- if ([eventKey length] == 1) {
- unichar origChar = [eventKey characterAtIndex:0];
- unichar newChar = NsCharToJavaChar(origChar, 0);
- if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) {
- newChar = origChar;
- }
-
- eventKey = [NSString stringWithCharacters: &newChar length: 1];
- }
-
- NSWindow *keyWindow = [NSApp keyWindow];
- if ([menuKey isEqualToString:eventKey] && keyWindow != nil) {
- return;
- }
- }
-
if (fIsCheckbox) {
static JNF_CLASS_CACHE(jc_CCheckboxMenuItem, "sun/lwawt/macosx/CCheckboxMenuItem");
static JNF_MEMBER_CACHE(jm_ckHandleAction, jc_CCheckboxMenuItem, "handleAction", "(Z)V");
@@ -154,16 +88,47 @@ CFStringRef createStringForKey(CGKeyCode keyCode)
NSInteger state = [sender state];
jboolean newState = (state == NSOnState ? JNI_FALSE : JNI_TRUE);
JNFCallVoidMethod(env, fPeer, jm_ckHandleAction, newState);
- } else {
- static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem");
- static JNF_MEMBER_CACHE(jm_handleAction, jc_CMenuItem, "handleAction", "(JI)V"); // AWT_THREADING Safe (event)
-
- NSUInteger modifiers = [currEvent modifierFlags];
- jint javaModifiers = NsKeyModifiersToJavaModifiers(modifiers, NO);
-
- JNFCallVoidMethod(env, fPeer, jm_handleAction, UTC(currEvent), javaModifiers); // AWT_THREADING Safe (event)
+ }
+ else {
+ if ([currEvent type] == NSKeyDown) {
+
+ // Event available through sender variable hence NSApplication
+ // not needed for checking the keyboard input sans the modifier keys
+ // Also, the method used to fetch eventKey earlier would be locale dependent
+ // With earlier implementation, if MenuKey: e EventKey: ा ; if input method
+ // is not U.S. (Devanagari in this case)
+ // With current implementation, EventKey = MenuKey = e irrespective of
+ // input method
+
+ NSString *eventKey = [sender keyEquivalent];
+ // Apple uses characters from private Unicode range for some of the
+ // keys, so we need to do the same translation here that we do
+ // for the regular key down events
+ if ([eventKey length] == 1) {
+ unichar origChar = [eventKey characterAtIndex:0];
+ unichar newChar = NsCharToJavaChar(origChar, 0);
+ if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) {
+ newChar = origChar;
+ }
+ eventKey = [NSString stringWithCharacters: &newChar length: 1];
+ }
+ NSWindow *keyWindow = [NSApp keyWindow];
+ if (keyWindow != nil) {
+ return;
+ }
+ else {
+ static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem");
+ static JNF_MEMBER_CACHE(jm_handleAction, jc_CMenuItem, "handleAction", "(JI)V"); // AWT_THREADING Safe (event)
+
+ NSUInteger modifiers = [currEvent modifierFlags];
+ jint javaModifiers = NsKeyModifiersToJavaModifiers(modifiers, NO);
+
+ JNFCallVoidMethod(env, fPeer, jm_handleAction, UTC(currEvent), javaModifiers); // AWT_THREADING Safe (event)
+ }
+ }
}
JNF_COCOA_EXIT(env);
+
}
- (void) setJavaLabel:(NSString *)theLabel shortcut:(NSString *)theKeyEquivalent modifierMask:(jint)modifiers {
diff --git a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java
index 1a9f42120e2..589bb9b5744 100644
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java
@@ -21,23 +21,23 @@
* questions.
*/
-/*
+ /*
* @test
- * @bug 7160951
+ * @bug 7160951 8152492
* @summary [macosx] ActionListener called twice for JMenuItem using ScreenMenuBar
* @author vera.akulova@oracle.com
* @library ../../../../lib/testlibrary
* @build jdk.testlibrary.OSInfo
* @run main ActionListenerCalledTwiceTest
*/
-
import jdk.testlibrary.OSInfo;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ActionListenerCalledTwiceTest {
- static String menuItems[] = { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6" };
+
+ static String menuItems[] = {"Item1", "Item2", "Item3", "Item4", "Item5", "Item6"};
static KeyStroke keyStrokes[] = {
KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
@@ -46,8 +46,10 @@ public class ActionListenerCalledTwiceTest {
KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.META_MASK)
};
-
+ static JMenu menu;
+ static JFrame frame;
static volatile int listenerCallCounter = 0;
+
public static void main(String[] args) throws Exception {
if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
@@ -82,33 +84,38 @@ public class ActionListenerCalledTwiceTest {
robot.waitForIdle();
if (listenerCallCounter != 1) {
- throw new Exception("Test failed: ActionListener for " + menuItems[i] +
- " called " + listenerCallCounter + " times instead of 1!");
+ throw new Exception("Test failed: ActionListener for " + menuItems[i]
+ + " called " + listenerCallCounter + " times instead of 1!");
}
listenerCallCounter = 0;
}
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ }
+ });
}
private static void createAndShowGUI() {
- JMenu menu = new JMenu("Menu");
+ menu = new JMenu("Menu");
for (int i = 0; i < menuItems.length; ++i) {
JMenuItem newItem = new JMenuItem(menuItems[i]);
newItem.setAccelerator(keyStrokes[i]);
newItem.addActionListener(
- new ActionListener(){
- public void actionPerformed(ActionEvent e) {
- listenerCallCounter++;
- }
+ new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ listenerCallCounter++;
}
+ }
);
menu.add(newItem);
}
JMenuBar bar = new JMenuBar();
bar.add(menu);
- JFrame frame = new JFrame("Test");
+ frame = new JFrame("Test");
frame.setJMenuBar(bar);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
From eb3750d326afb8d965fe737ac92c7562010b8aef Mon Sep 17 00:00:00 2001
From: Manajit Halder
Date: Wed, 27 Apr 2016 13:09:58 +0300
Subject: [PATCH 015/381] 8151136: [macosx] According to the description, the
case is failed
Reviewed-by: ssadetsky, aniyogi
---
.../macosx/native/libawt_lwawt/awt/AWTEvent.m | 28 +++++++++++++++----
.../AltGraphModifierTest.java | 13 +++++----
2 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m
index 9b8e370a938..e57074ee74c 100644
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -282,11 +282,19 @@ const nsKeyToJavaModifierTable[] =
//kCGSFlagsMaskAppleLeftAlternateKey,
//kCGSFlagsMaskAppleRightAlternateKey,
58,
- 61,
+ 0,
java_awt_event_InputEvent_ALT_DOWN_MASK,
java_awt_event_InputEvent_ALT_MASK,
java_awt_event_KeyEvent_VK_ALT
},
+ {
+ NSAlternateKeyMask,
+ 0,
+ 61,
+ java_awt_event_InputEvent_ALT_DOWN_MASK | java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK,
+ java_awt_event_InputEvent_ALT_MASK | java_awt_event_InputEvent_ALT_GRAPH_MASK,
+ java_awt_event_KeyEvent_VK_ALT
+ },
{
NSCommandKeyMask,
//kCGSFlagsMaskAppleLeftCommandKey,
@@ -310,6 +318,8 @@ const nsKeyToJavaModifierTable[] =
{0, 0, 0, 0, 0, 0}
};
+static BOOL leftAltKeyPressed;
+
/*
* Almost all unicode characters just go from NS to Java with no translation.
* For the few exceptions, we handle it here with this small table.
@@ -523,13 +533,17 @@ NsKeyModifiersToJavaKeyInfo(NSUInteger nsFlags, unsigned short eventKeyCode,
// *javaKeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_RIGHT;
//}
if (eventKeyCode == cur->leftKeyCode) {
+ leftAltKeyPressed = YES;
*javaKeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_LEFT;
} else if (eventKeyCode == cur->rightKeyCode) {
*javaKeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_RIGHT;
+ } else if (cur->nsMask == NSAlternateKeyMask) {
+ leftAltKeyPressed = NO;
+ continue;
}
*javaKeyType = (cur->nsMask & nsFlags) ?
- java_awt_event_KeyEvent_KEY_PRESSED :
- java_awt_event_KeyEvent_KEY_RELEASED;
+ java_awt_event_KeyEvent_KEY_PRESSED :
+ java_awt_event_KeyEvent_KEY_RELEASED;
break;
}
}
@@ -545,7 +559,11 @@ jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods)
for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
if ((cur->nsMask & nsFlags) != 0) {
- javaModifiers |= isExtMods? cur->javaExtMask : cur->javaMask;
+ javaModifiers |= isExtMods ? cur->javaExtMask : cur->javaMask;
+ if (cur->nsMask == NSAlternateKeyMask && leftAltKeyPressed == NO) {
+ continue;
+ }
+ break;
}
}
diff --git a/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java b/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java
index 92dcc214376..00c471ad7f4 100644
--- a/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java
+++ b/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ public class AltGraphModifierTest {
"3. If Alt-Gr key is not present, press Ctrl+Alt keys &",
" perform mouse click on the TestWindow.",
"4. Test will exit by itself with appropriate result.",
- "",
+ " ",
"Linux :-",
"1. Please check if Alt-Gr key is present on keyboard.",
"2. If present, press the Alt-Gr key and perform",
@@ -63,10 +63,11 @@ public class AltGraphModifierTest {
"6. Press Right Alt Key & perform mouse click on the",
" TestWindow",
"7. Test will exit by itself with appropriate result.",
- "",
+ " ",
"Mac :-",
- " Mac fix is under progress, & will be fixed soon.",
- " Please click Fail"
+ "1. Press Right Option key on the keyboard and mouse click",
+ " on the TestWindow",
+ "3. Test will exit by itself with appropriate result.",
};
Sysout.createDialog();
@@ -77,7 +78,7 @@ public class AltGraphModifierTest {
public static void initTestWindow() {
mainFrame = new Frame();
mainFrame.setTitle("TestWindow");
- mainFrame.setSize(300, 200);
+ mainFrame.setBounds(700, 10, 300, 300);
mainFrame.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
From 8f5fb772b45cce20bdb89917d931c22dc078c034 Mon Sep 17 00:00:00 2001
From: Serguei Spitsyn
Date: Thu, 28 Apr 2016 00:38:21 -0700
Subject: [PATCH 016/381] 8153749: New capability
can_generate_early_class_hook_events
Add new capability
Reviewed-by: alanb, dsamersoff
---
jdk/src/java.base/share/native/include/jvmti.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/jdk/src/java.base/share/native/include/jvmti.h b/jdk/src/java.base/share/native/include/jvmti.h
index 684fd2d7046..5f8835c0baa 100644
--- a/jdk/src/java.base/share/native/include/jvmti.h
+++ b/jdk/src/java.base/share/native/include/jvmti.h
@@ -704,7 +704,8 @@ typedef struct {
unsigned int can_generate_resource_exhaustion_heap_events : 1;
unsigned int can_generate_resource_exhaustion_threads_events : 1;
unsigned int can_generate_early_vmstart : 1;
- unsigned int : 6;
+ unsigned int can_generate_early_class_hook_events : 1;
+ unsigned int : 5;
unsigned int : 16;
unsigned int : 16;
unsigned int : 16;
From 0a29c9196258f080fa24e7bac2febfbce479e072 Mon Sep 17 00:00:00 2001
From: Alexander Stepanov
Date: Thu, 28 Apr 2016 19:35:09 +0300
Subject: [PATCH 017/381] 8155021: [TEST] create one more inheritance test for
@BeanProperty
Reviewed-by: serb
---
.../AnonymousClassBeanPropertyTest.java | 218 ++-
.../beans/Introspector/BeanPropertyTest.java | 85 +-
.../InheritanceBeanPropertyTest.java | 1281 +++++++++++++++++
3 files changed, 1552 insertions(+), 32 deletions(-)
create mode 100644 jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java
diff --git a/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java b/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java
index a8ec7d49188..b5fc3667b94 100644
--- a/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java
+++ b/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java
@@ -33,7 +33,7 @@ import java.util.Arrays;
/**
* @test
- * @bug 8132973 8132732 8155013
+ * @bug 8132973 8132732 8155013 8154958
* @summary Some check for BeanProperty annotation
* @author a.stepanov
* @run main AnonymousClassBeanPropertyTest
@@ -62,6 +62,10 @@ public class AnonymousClassBeanPropertyTest {
// ---------- test cases (interfaces) ----------
+ public interface IPublic {
+ double getX();
+ }
+
private interface IGet {
double getX();
}
@@ -113,6 +117,10 @@ public class AnonymousClassBeanPropertyTest {
void setX(double a[]);
}
+ private interface IIs {
+ boolean isX();
+ }
+
// ---------- checks ----------
@@ -124,7 +132,7 @@ public class AnonymousClassBeanPropertyTest {
return ok;
}
- private static boolean checkInfo(Class> c, String what) {
+ private static boolean checkInfo(Class> c, String what, boolean checkVals) {
BeanInfo i;
try { i = Introspector.getBeanInfo(c, Object.class); }
@@ -154,6 +162,8 @@ public class AnonymousClassBeanPropertyTest {
ok &= check("visualUpdate",
(boolean) d.getValue("visualUpdate"), UPDATE);
+ if (!checkVals) { return ok; }
+
Object vals[] = (Object[]) d.getValue("enumerationValues");
if (vals == null) {
System.out.println("null enumerationValues");
@@ -210,8 +220,10 @@ public class AnonymousClassBeanPropertyTest {
(boolean) d.getValue("visualUpdate"), !UPDATE);
Object vals[] = (Object[]) d.getValue("enumerationValues");
- if (vals != null || vals.length > 0) {
- System.out.println("non-empty enumerationValues");
+ if (vals != null && vals.length > 0) {
+ System.out.println("non-empty enumerationValues:");
+ for (Object v: vals) { System.out.print(v.toString()); }
+ System.out.println();
return false;
}
@@ -228,6 +240,31 @@ public class AnonymousClassBeanPropertyTest {
//----------------------------------------------------------------------
+ // TODO: please uncomment/update after 8154958 fix
+ /*
+ IPublic testPublic = new IPublic() {
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testPublic.getClass(), "IPublic", true);
+ System.out.println("OK = " + ok);
+ passed = passed && ok;
+ */
+
+ //----------------------------------------------------------------------
+
IGet testGet = new IGet() {
@BeanProperty(
description = DESCRIPTION,
@@ -244,7 +281,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGet.getClass(), "IGet");
+ ok = checkInfo(testGet.getClass(), "IGet", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -269,7 +306,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSet.getClass(), "ISet");
+ ok = checkInfo(testSet.getClass(), "ISet", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -294,7 +331,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetByIndex.getClass(), "IGetByIndex");
+ ok = checkInfo(testGetByIndex.getClass(), "IGetByIndex", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -319,7 +356,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetByIndex.getClass(), "ISetByIndex");
+ ok = checkInfo(testSetByIndex.getClass(), "ISetByIndex", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -346,7 +383,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetArray.getClass(), "IGetArray");
+ ok = checkInfo(testGetArray.getClass(), "IGetArray", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -374,7 +411,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetArray.getClass(), "ISetArray");
+ ok = checkInfo(testSetArray.getClass(), "ISetArray", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -402,7 +439,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetBoth_1.getClass(), "IGetBoth-1");
+ ok = checkInfo(testGetBoth_1.getClass(), "IGetBoth-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -429,7 +466,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetBoth_2.getClass(), "IGetBoth-2");
+ ok = checkInfo(testGetBoth_2.getClass(), "IGetBoth-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -465,11 +502,11 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetBoth_3.getClass(), "IGetBoth-3");
+ ok = checkInfo(testGetBoth_3.getClass(), "IGetBoth-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(testGetBoth_3.getClass(), "IGetBoth-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -495,7 +532,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetBoth_1.getClass(), "ISetBoth-1");
+ ok = checkInfo(testSetBoth_1.getClass(), "ISetBoth-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -522,7 +559,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetBoth_2.getClass(), "ISetBoth-2");
+ ok = checkInfo(testSetBoth_2.getClass(), "ISetBoth-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -558,11 +595,11 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetBoth_3.getClass(), "ISetBoth-3");
+ ok = checkInfo(testSetBoth_3.getClass(), "ISetBoth-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(testSetBoth_3.getClass(), "ISetBoth-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -588,7 +625,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSet_1.getClass(), "IGetSet-1");
+ ok = checkInfo(testGetSet_1.getClass(), "IGetSet-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -614,7 +651,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSet_2.getClass(), "IGetSet-2");
+ ok = checkInfo(testGetSet_2.getClass(), "IGetSet-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -649,11 +686,11 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSet_3.getClass(), "IGetSet-3");
+ ok = checkInfo(testGetSet_3.getClass(), "IGetSet-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(testGetSet_3.getClass(), "IGetSet-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -679,7 +716,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetByIndex_1.getClass(), "IGetSetByIndex-1");
+ ok = checkInfo(testGetSetByIndex_1.getClass(), "IGetSetByIndex-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -705,7 +742,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetByIndex_2.getClass(), "IGetSetByIndex-2");
+ ok = checkInfo(testGetSetByIndex_2.getClass(), "IGetSetByIndex-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -744,12 +781,12 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetByIndex_3.getClass(), "IGetSetByIndex-3");
+ ok = checkInfo(testGetSetByIndex_3.getClass(), "IGetSetByIndex-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(
testGetSetByIndex_3.getClass(), "IGetSetByIndex-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -781,7 +818,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetBoth_1.getClass(), "IGetSetBoth-1");
+ ok = checkInfo(testGetSetBoth_1.getClass(), "IGetSetBoth-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -813,7 +850,7 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetBoth_2.getClass(), "IGetSetBoth-2");
+ ok = checkInfo(testGetSetBoth_2.getClass(), "IGetSetBoth-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -853,14 +890,135 @@ public class AnonymousClassBeanPropertyTest {
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetBoth_3.getClass(), "IGetSetBoth-3");
+ ok = checkInfo(testGetSetBoth_3.getClass(), "IGetSetBoth-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(
testGetSetBoth_3.getClass(), "IGetSetBoth-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
+ //----------------------------------------------------------------------
+
+ IIs testIs_1 = new IIs() {
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_1.getClass(), "IIs-1", false);
+ System.out.println("OK = " + ok);
+ passed = passed && ok;
+
+
+ IIs testIs_2 = new IIs() {
+
+ private boolean b;
+
+ @Override
+ public boolean isX() { return b; }
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public void setX(boolean v) { b = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_2.getClass(), "IIs-2", false);
+ System.out.println("OK = " + ok);
+ passed = passed && ok;
+
+
+ IIs testIs_3 = new IIs() {
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return false; }
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean getX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_3.getClass(), "IIs-3", false);
+ System.out.println("OK = " + ok);
+ ok2 = checkAlternativeInfo(testIs_3.getClass(), "IIs-3");
+ System.out.println("OK = " + ok2);
+ passed = passed && (ok || ok2);
+
+ // TODO: please uncomment/update after 8132973 fix
+ /*
+ IIs testIs_4 = new IIs() {
+
+ private boolean b;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return b; }
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public void setX(boolean v) { b = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_4.getClass(), "IIs-4", false);
+ System.out.println("OK = " + ok);
+ ok2 = checkAlternativeInfo(testIs_4.getClass(), "IIs-4");
+ System.out.println("OK = " + ok2);
+ passed = passed && (ok || ok2);
+ */
+
+
+ //----------------------------------------------------------------------
+
+
if (!passed) { throw new RuntimeException("test failed"); }
System.out.println("\ntest passed");
}
diff --git a/jdk/test/java/beans/Introspector/BeanPropertyTest.java b/jdk/test/java/beans/Introspector/BeanPropertyTest.java
index 6f957074c6e..5e84aaaed4e 100644
--- a/jdk/test/java/beans/Introspector/BeanPropertyTest.java
+++ b/jdk/test/java/beans/Introspector/BeanPropertyTest.java
@@ -33,7 +33,7 @@ import java.util.Arrays;
/**
* @test
- * @bug 8132703 8132163 8132732 8132973 8154756 8132888
+ * @bug 8132703 8132163 8132732 8132973 8154756 8132888 8155103
* @summary Some check for BeanProperty annotation
* @author a.stepanov
* @run main BeanPropertyTest
@@ -853,6 +853,64 @@ public class BeanPropertyTest {
public void removePropertyChangeListener(PropertyChangeListener l) {}
}
+ // JDK-8155103
+ public static enum E {
+
+ ONE,
+ TWO {
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(int v) {}
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(int v) {}
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+
+ }
+
+ private static enum EB {
+
+ TRUE(true), FALSE(false);
+
+ private boolean b;
+ private EB(boolean v) { b = v; }
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public boolean isTrue() { return true; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+
+ }
+
// ---------- checks ----------
@@ -953,7 +1011,7 @@ public class BeanPropertyTest {
}
private static boolean ignoreVals(Class> c) {
- return (c.equals(Self.class) || c.equals(SelfArr.class));
+ return (c.equals(Self.class) || c.equals(SelfArr.class)) || c.equals(EB.class);
}
@@ -1003,6 +1061,29 @@ public class BeanPropertyTest {
passed = passed && ok;
}
+ // enums
+
+ Class> enumCases[] = {
+
+ // TODO: uncomment/update after 8155103 fix
+ //E.class, E.TWO.getClass(), EB.class
+ };
+
+ int ne = 1;
+ for (Class> c: enumCases) {
+
+ System.out.println("\nEnum-" + ne + ":");
+ ne++;
+
+ BeanInfo i;
+ try { i = Introspector.getBeanInfo(c, Object.class); }
+ catch (IntrospectionException e) { throw new RuntimeException(e); }
+ boolean ok = checkInfo(i, !ignoreVals(c));
+ System.out.println(ok ? "OK" : "NOK");
+ passed = passed && ok;
+ }
+
+
if (!passed) { throw new RuntimeException("test failed"); }
System.out.println("\ntest passed");
}
diff --git a/jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java b/jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java
new file mode 100644
index 00000000000..e42fa6228f3
--- /dev/null
+++ b/jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java
@@ -0,0 +1,1281 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.beans.BeanInfo;
+import java.beans.BeanProperty;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyDescriptor;
+
+import java.util.Arrays;
+
+
+/**
+ * @test
+ * @bug 8132565 8155013
+ * @summary Some inheritance check for BeanProperty annotation
+ * @author a.stepanov
+ * @run main InheritanceBeanPropertyTest
+ */
+
+
+public class InheritanceBeanPropertyTest {
+
+ private final static String DESCRIPTION = "TEST";
+ private final static boolean BOUND = true;
+ private final static boolean EXPERT = false;
+ private final static boolean HIDDEN = true;
+ private final static boolean PREFERRED = false;
+ private final static boolean REQUIRED = true;
+ private final static boolean UPDATE = false;
+
+ private final static double X = java.lang.Math.PI;
+
+ private final static String
+ V_NAME = "java.lang.Math.PI",
+ V_SHORT = "PI",
+ V = Double.toString(X);
+
+ private final static String DESCRIPTION_2 = "XYZ";
+
+
+ // ---------- test cases ----------
+
+ public static class BaseGet {
+
+ private final static String TESTCASE = "base getter";
+
+ public double getX() { return X; }
+ }
+
+ public static class OverloadGet extends BaseGet {
+
+ private final static String TESTCASE = "overload getter";
+
+ private final double x[] = {X, X, X};
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX(int i) { return x[i]; } // indexed
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BaseSet {
+
+ private final static String TESTCASE = "base setter";
+
+ double u;
+ public void setX(double v) { u = v; }
+ }
+
+ public static class OverloadSet extends BaseSet {
+
+ private final static String TESTCASE = "overload setter";
+
+ private final double x[] = {X, X, X};
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(int i, double v) { x[i] = v; } // indexed
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BaseIGet {
+
+ protected final double x[] = {X, X, X};
+ public double[] getX() { return x; }
+ }
+
+ public static class OverloadIGet extends BaseIGet {
+
+ private final static String TESTCASE = "overload indexed getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX(int i) { return x[i]; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BaseISet {
+
+ protected double x[] = {X, X, X};
+ public void setX(double a[]) { x = Arrays.copyOf(a, a.length); }
+ }
+
+ public static class OverloadISet extends BaseISet {
+
+ private final static String TESTCASE = "overload indexed setter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(int i, double v) { x[i] = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BoolGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean getX() { return false; }
+ }
+
+ public static class BoolGetIs extends BoolGet {
+
+ private final static String TESTCASE = "base boolean getter + is";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public boolean isX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+ // ----------
+
+ public static class BoolIs {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean isX() { return false; }
+ }
+
+ public static class BoolIsGet extends BoolIs {
+
+ private final static String TESTCASE = "base is + boolean getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public boolean getX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class AnnotatedGet {
+
+ private final static String TESTCASE = "annotated super getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX() { return 0.; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class OverrideAnnotatedGet extends AnnotatedGet {
+
+ private final static String TESTCASE = "override annotated getter";
+
+ @Override
+ public double getX() { return X; }
+ }
+
+ // ----------
+
+ public static class AnnotatedIs {
+
+ private final static String TESTCASE = "annotated super is";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public boolean isX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class OverrideAnnotatedIs extends AnnotatedIs {
+
+ private final static String TESTCASE = "override annotated is";
+
+ @Override
+ public boolean isX() { return false; }
+ }
+
+ // ----------
+
+ public static class AnnotatedSet {
+
+ private final static String TESTCASE = "annotated super set";
+
+ protected double x;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(double v) { x = -v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class OverrideAnnotatedSet extends AnnotatedSet {
+
+ private final static String TESTCASE = "override annotated setter";
+
+ @Override
+ public void setX(double v) { x = v; }
+ }
+
+ // ----------
+
+ public static class AnnotatedGet2 {
+
+ protected double x;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public double getX() { return 0.; }
+ }
+
+ public static class OverrideAnnotatedGet2 extends AnnotatedGet2 {
+
+ private final static String TESTCASE = "override annotated getter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class AnnotatedGet2Ext extends AnnotatedGet2 {
+
+ private final static String TESTCASE = "extend annotated getter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class AnnotatedIs2 {
+
+ protected boolean b = false;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean isX() { return false; }
+ }
+
+ public static class OverrideAnnotatedIs2 extends AnnotatedIs2 {
+
+ private final static String TESTCASE = "override annotated is - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return b; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class AnnotatedIs2Ext extends AnnotatedIs2 {
+
+ private final static String TESTCASE = "extend annotated is - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public void setX(boolean v) { b = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class AnnotatedSet2 {
+
+ protected double x;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public void setX(double v) { x = -v; }
+ }
+
+ public static class OverrideAnnotatedSet2 extends AnnotatedSet2 {
+
+ private final static String TESTCASE = "override annotated setter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class AnnotatedSet2Ext extends AnnotatedSet2 {
+
+ private final static String TESTCASE = "extend annotated setter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX() { return x; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public abstract static class AbstractGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract double getX();
+ }
+
+ public static class OverrideAbstractGet extends AbstractGet {
+
+ private final static String TESTCASE =
+ "override abstract annotated getter";
+
+ @Override
+ public double getX() { return X; }
+ }
+
+ public static class OverrideAbstractGet2 extends AbstractGet {
+
+ private final static String TESTCASE =
+ "override abstract annotated getter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class AbstractGetExt extends AbstractGet {
+
+ private final static String TESTCASE =
+ "extend abstract annotated getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract void setX(double v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public abstract static class AbstractIs {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract boolean isX();
+ }
+
+ public static class OverrideAbstractIs extends AbstractIs {
+
+ private final static String TESTCASE =
+ "override abstract annotated is";
+
+ @Override
+ public boolean isX() { return true; }
+ }
+
+ public static class OverrideAbstractIs2 extends AbstractIs {
+
+ private final static String TESTCASE =
+ "override abstract annotated is - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return true; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+
+ public abstract static class AbstractIsExt extends AbstractIs {
+
+ private final static String TESTCASE =
+ "extend abstract annotated is";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public abstract boolean getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public abstract static class AbstractSet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract void setX(double v);
+ }
+
+ public static class OverrideAbstractSet extends AbstractSet {
+
+ private final static String TESTCASE =
+ "override abstract annotated setter";
+
+ private double x;
+
+ @Override
+ public void setX(double v) { x = v; }
+ }
+
+ public static class OverrideAbstractSet2 extends AbstractSet {
+
+ private final static String TESTCASE =
+ "override abstract annotated setter - 2";
+
+ private double x;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class AbstractSetExt extends AbstractSet {
+
+ private final static String TESTCASE =
+ "extend abstract annotated setter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract void setX(double v[]);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static abstract class AbstractGet2 {
+
+ private final static String TESTCASE = "abstract super getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract double getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static abstract class AbstractGet2Ext extends AbstractGet2 {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract void setX(double a[]);
+ }
+
+ // ----------
+
+ public static interface IGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ double getX();
+ }
+
+ public static class IGetImpl implements IGet {
+
+ private final static String TESTCASE = "implement getter interface";
+
+ @Override
+ public double getX() { return X; }
+ }
+
+ public static class IGetImpl2 implements IGet {
+
+ private final static String TESTCASE = "implement getter interface - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class IGetImpl3 implements IGet {
+
+ private final static String TESTCASE = "implement getter interface - 3";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract void setX(double v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface IIs {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean isX();
+ }
+
+ public static class IIsImpl implements IIs {
+
+ private final static String TESTCASE = "implement is interface";
+
+ @Override
+ public boolean isX() { return true; }
+ }
+
+ public static class IIsImpl2 implements IIs {
+
+ private final static String TESTCASE = "implement is interface - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return true; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class IIsImpl3 implements IIs {
+
+ private final static String TESTCASE = "implement is interface - 3";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public abstract void setX(boolean v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface ISet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public void setX(double v);
+ }
+
+ public static class ISetImpl implements ISet {
+
+ private final static String TESTCASE = "implement getter interface";
+
+ private double x;
+
+ @Override
+ public void setX(double v) { x = v; }
+ }
+
+ public static class ISetImpl2 implements ISet {
+
+ private final static String TESTCASE = "implement getter interface - 2";
+
+ private double x;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class ISetImpl3 implements ISet {
+
+ private final static String TESTCASE = "implement getter interface - 3";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract double getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface ISet2 {
+
+ final static String TESTCASE = "super interface - setter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(double v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l);
+ public void removePropertyChangeListener(PropertyChangeListener l);
+ }
+
+ public static class ISet2Impl implements ISet2 {
+
+ private double x;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ @Override
+ public void setX(double v) { x = v; }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface IGet2 {
+
+ final static String TESTCASE = "super interface - indexed getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double[] getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l);
+ public void removePropertyChangeListener(PropertyChangeListener l);
+ }
+
+ public static class IGet2Impl implements IGet2 {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ @Override
+ public double[] getX() { return new double[]{X, X}; }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class ProtectedGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ protected double getX() { return 0.; }
+ }
+
+ public static class OverrideProtectedGet extends ProtectedGet {
+
+ final static String TESTCASE = "override protected getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ // static getter - see also JDK-8154938
+ public static class StaticGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public static double getProp() { return 0.; }
+ }
+
+ public static class HideStaticGet extends StaticGet {
+
+ final static String TESTCASE = "hide static getter";
+
+ public double getX() { return X; } // add to get the "default" info
+ public static double getProp() { return X; }
+ }
+
+ // TODO: if 8154938 is considered to be a real issue,
+ // create one more test case "HideStaticGet2 extends StaticGet" with an
+ // annotated getter and check the correctness of the corresponding bean info
+
+ // ---------- checks ----------
+
+ private static boolean check(String what, boolean v, boolean ref) {
+
+ boolean ok = (v == ref);
+ if (!ok) { System.out.println(
+ "invalid " + what + ": " + v + ", expected: " + ref); }
+ return ok;
+ }
+
+ private static boolean checkInfo(BeanInfo i, boolean ignoreValsCheck) {
+
+ System.out.println("checking info...");
+
+ PropertyDescriptor descriptors[] = i.getPropertyDescriptors();
+ int nd = descriptors.length;
+ if (nd != 1) {
+ System.out.println("invalid number of descriptors: " + nd);
+ return false;
+ }
+
+ PropertyDescriptor d = descriptors[0];
+
+ String descr = d.getShortDescription();
+ boolean ok = descr.equals(DESCRIPTION);
+ if (!ok) { System.out.println("invalid description: " + descr +
+ ", expected: " + DESCRIPTION); }
+
+ ok &= check("isBound", d.isBound(), BOUND);
+ ok &= check("isExpert", d.isExpert(), EXPERT);
+ ok &= check("isHidden", d.isHidden(), HIDDEN);
+ ok &= check("isPreferred", d.isPreferred(), PREFERRED);
+ ok &= check("required", (boolean) d.getValue("required"), REQUIRED);
+ ok &= check("visualUpdate",
+ (boolean) d.getValue("visualUpdate"), UPDATE);
+
+ if (ignoreValsCheck) { return ok; }
+
+ Object vals[] = (Object[]) d.getValue("enumerationValues");
+ if (vals == null) {
+ System.out.println("null enumerationValues");
+ return false;
+ }
+
+ boolean okVals = (
+ (vals.length == 3) &&
+ vals[0].toString().equals(V_SHORT) &&
+ vals[1].toString().equals(V) &&
+ vals[2].toString().equals(V_NAME));
+
+ if (!okVals) { System.out.println("invalid enumerationValues"); }
+
+ return (ok && okVals);
+ }
+
+ private static boolean checkDefault(BeanInfo i) {
+
+ System.out.println("checking default info...");
+
+ PropertyDescriptor descriptors[] = i.getPropertyDescriptors();
+ int nd = descriptors.length;
+ if (nd != 1) {
+ System.out.println("invalid number of descriptors: " + nd);
+ return false;
+ }
+
+ PropertyDescriptor d = descriptors[0];
+
+ String descr = d.getShortDescription();
+ boolean ok = descr.equals("x");
+ if (!ok) { System.out.println("invalid description: " + descr +
+ ", expected: x"); }
+
+ ok &= check("isBound", d.isBound(), false);
+ ok &= check("isExpert", d.isExpert(), false);
+ ok &= check("isHidden", d.isHidden(), false);
+ ok &= check("isPreferred", d.isPreferred(), false);
+ ok &= check("required", (boolean) d.getValue("required"), false);
+ ok &= check("visualUpdate",
+ (boolean) d.getValue("visualUpdate"), false);
+
+ Object vals[] = (Object[]) d.getValue("enumerationValues");
+ if (vals != null && vals.length > 0) {
+ System.out.println("non-empty enumerationValues");
+ ok = false;
+ }
+
+ return ok;
+ }
+
+ // do not check enumerationValues for these classes
+ private static boolean ignoreVals(Class> c) {
+ return (
+ c.equals(BoolGetIs.class) ||
+ c.equals(BoolIsGet.class) ||
+ c.equals(AnnotatedIs.class) ||
+ c.equals(OverrideAnnotatedIs2.class) ||
+ c.equals(AnnotatedIs2Ext.class) ||
+ c.equals(OverrideAbstractIs.class) ||
+ c.equals(OverrideAbstractIs2.class) ||
+ c.equals(AbstractIsExt.class) ||
+ c.equals(OverrideAbstractIs.class) ||
+ c.equals(IIsImpl.class) ||
+ c.equals(IIsImpl2.class) ||
+ c.equals(IIsImpl3.class)
+ );
+ }
+
+ // default property descriptor data are expected for these classes
+ private static boolean isDefault(Class> c) {
+ return (
+ c.equals(OverrideAnnotatedGet.class) ||
+ c.equals(OverrideAnnotatedIs.class ) ||
+ c.equals(OverrideAnnotatedSet.class) ||
+ c.equals(OverrideAbstractGet.class) ||
+ c.equals(OverrideAbstractIs.class) ||
+ c.equals(OverrideAbstractSet.class) ||
+ c.equals(IGetImpl.class) ||
+ c.equals(IIsImpl.class) ||
+ c.equals(ISetImpl.class) ||
+ c.equals(BaseGet.class) ||
+ c.equals(BaseSet.class) ||
+ c.equals(HideStaticGet.class)
+ );
+ }
+
+
+ // ---------- run test ----------
+
+ public static void main(String[] args) throws Exception {
+
+ Class>
+ ic1 = ISet2Impl.class.getInterfaces()[0],
+ ic2 = IGet2Impl.class.getInterfaces()[0];
+
+ Class> cases[] = {
+
+ OverloadGet.class,
+ OverloadGet.class.getSuperclass(),
+ OverloadSet.class,
+ OverloadSet.class.getSuperclass(),
+ OverloadIGet.class,
+ OverloadISet.class,
+
+ // TODO: uncomment/update after 8132565 fix
+ //BoolGetIs.class,
+ //BoolIsGet.class,
+ //OverrideAnnotatedGet.class,
+ //OverrideAnnotatedIs.class,
+ //OverrideAnnotatedSet.class,
+ //OverrideAnnotatedGet2.class,
+ //AnnotatedGet2Ext.class,
+ //OverrideAnnotatedIs2.class
+ //AnnotatedIs2Ext.class,
+ //OverrideAnnotatedSet2.class,
+ //AnnotatedSet2Ext.class,
+
+ OverrideAnnotatedGet.class.getSuperclass(),
+ OverrideAnnotatedIs.class.getSuperclass(),
+ OverrideAnnotatedSet.class.getSuperclass(),
+
+ // TODO: uncomment/update after 8132565 fix
+ //OverrideAbstractGet.class,
+ //OverrideAbstractGet2.class,
+ //AbstractGetExt.class,
+ //OverrideAbstractIs.class,
+ //OverrideAbstractIs2.class,
+ //AbstractIsExt.class
+ //OverrideAbstractSet.class,
+ //OverrideAbstractSet2.class,
+ //AbstractSetExt.class,
+
+ AbstractGet2Ext.class.getSuperclass(),
+ IGetImpl.class,
+ IGetImpl2.class,
+ IGetImpl3.class,
+ IIsImpl.class,
+ IIsImpl2.class,
+ IIsImpl3.class,
+ ISetImpl.class,
+ ISetImpl2.class,
+ ISetImpl3.class,
+ ic1,
+ // ic2, // TODO: uncomment/update after 8155013 fix
+ OverrideProtectedGet.class,
+ HideStaticGet.class
+ };
+
+ boolean passed = true;
+
+ for (Class> c: cases) {
+
+ java.lang.reflect.Field f = c.getDeclaredField("TESTCASE");
+ f.setAccessible(true);
+ String descr = f.get(c).toString();
+
+ System.out.println("\n" + c.getSimpleName() + " (" + descr + "):");
+ BeanInfo i;
+ try {
+ i = Introspector.getBeanInfo(c,
+ (c.equals(ic1) || c.equals(ic2)) ? null : Object.class);
+ }
+ catch (IntrospectionException e) { throw new RuntimeException(e); }
+
+ boolean ok;
+
+ if (isDefault(c)) {
+ ok = checkDefault(i);
+ } else {
+ ok = checkInfo(i, ignoreVals(c));
+ }
+ System.out.println(ok ? "OK" : "NOK");
+ passed = passed && ok;
+ }
+
+ if (!passed) { throw new RuntimeException("test failed"); }
+ System.out.println("\ntest passed");
+ }
+}
From 8499a7a0b3f0c80504025ce37b58d1026b7a9b4d Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy
Date: Thu, 28 Apr 2016 23:48:37 +0400
Subject: [PATCH 018/381] 8152677: [macosx] All files filter can't be selected
in JFileChooser
Reviewed-by: serb
---
.../com/apple/laf/AquaFileChooserUI.java | 13 ++-
.../8152677/SelectAllFilesFilterTest.java | 108 ++++++++++++++++++
2 files changed, 118 insertions(+), 3 deletions(-)
create mode 100644 jdk/test/javax/swing/JFileChooser/8152677/SelectAllFilesFilterTest.java
diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
index 91e1e4e8c39..eaade120e04 100644
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
@@ -112,7 +112,7 @@ public class AquaFileChooserUI extends FileChooserUI {
private AncestorListener ancestorListener = null;
private DropTarget dragAndDropTarget = null;
- private final AcceptAllFileFilter acceptAllFileFilter = new AcceptAllFileFilter();
+ private static final AcceptAllFileFilter acceptAllFileFilter = new AcceptAllFileFilter();
private AquaFileSystemModel model;
@@ -997,7 +997,7 @@ public class AquaFileChooserUI extends FileChooserUI {
// *****************************************
// ***** default AcceptAll file filter *****
// *****************************************
- protected class AcceptAllFileFilter extends FileFilter {
+ private static class AcceptAllFileFilter extends FileFilter {
public AcceptAllFileFilter() {
}
@@ -1305,6 +1305,8 @@ public class AquaFileChooserUI extends FileChooserUI {
protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel,
PropertyChangeListener {
protected FileFilter[] filters;
+ Object oldFileFilter = getFileChooser().getFileFilter();
+
protected FilterComboBoxModel() {
super();
filters = getFileChooser().getChoosableFileFilters();
@@ -1321,12 +1323,17 @@ public class AquaFileChooserUI extends FileChooserUI {
}
public void setSelectedItem(Object filter) {
- if (filter != null && !containsFileFilter(filter)) {
+ if (filter != null && !isSelectedFileFilterInModel(filter)) {
+ oldFileFilter = filter;
getFileChooser().setFileFilter((FileFilter) filter);
fireContentsChanged(this, -1, -1);
}
}
+ private boolean isSelectedFileFilterInModel(Object filter) {
+ return Objects.equals(filter, oldFileFilter);
+ }
+
public Object getSelectedItem() {
// Ensure that the current filter is in the list.
// NOTE: we shouldnt' have to do this, since JFileChooser adds
diff --git a/jdk/test/javax/swing/JFileChooser/8152677/SelectAllFilesFilterTest.java b/jdk/test/javax/swing/JFileChooser/8152677/SelectAllFilesFilterTest.java
new file mode 100644
index 00000000000..bc17b04a306
--- /dev/null
+++ b/jdk/test/javax/swing/JFileChooser/8152677/SelectAllFilesFilterTest.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.awt.Component;
+import java.awt.Container;
+import java.awt.Robot;
+import javax.swing.JComboBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileNameExtensionFilter;
+
+/*
+ * @test
+ * @bug 8152677
+ * @requires (os.family == "mac")
+ * @summary [macosx] All files filter can't be selected in JFileChooser
+ * @run main SelectAllFilesFilterTest
+ */
+
+public class SelectAllFilesFilterTest {
+
+ private static final String LABEL_TEXT = "File Format:";
+ private static volatile JFileChooser fileChooser;
+ private static JComboBox comboBox;
+
+ public static void main(String[] args) throws Exception {
+
+ SwingUtilities.invokeLater(SelectAllFilesFilterTest::createAndShowGUI);
+
+ while (fileChooser == null) {
+ Thread.sleep(100);
+ }
+
+ Robot robot = new Robot();
+ robot.waitForIdle();
+
+ SwingUtilities.invokeAndWait(() -> {
+ comboBox = findComboBox(fileChooser);
+ comboBox.setSelectedIndex(0);
+ });
+ robot.waitForIdle();
+
+ SwingUtilities.invokeAndWait(() -> {
+ int selectedIndex = comboBox.getSelectedIndex();
+ fileChooser.setVisible(false);
+
+ if (selectedIndex != 0) {
+ throw new RuntimeException("Select All file filter is not selected!");
+ }
+ });
+ }
+
+ private static void createAndShowGUI() {
+ fileChooser = new JFileChooser();
+ fileChooser.setAcceptAllFileFilterUsed(true);
+ fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
+
+ FileFilter txtFilter = new FileNameExtensionFilter("Text files", "txt");
+ fileChooser.addChoosableFileFilter(txtFilter);
+ fileChooser.setFileFilter(txtFilter);
+ fileChooser.showOpenDialog(null);
+ }
+
+ private static JComboBox findComboBox(Component comp) {
+
+ if (comp instanceof JLabel) {
+ JLabel label = (JLabel) comp;
+ if (LABEL_TEXT.equals(label.getText())) {
+ return (JComboBox) label.getLabelFor();
+ }
+ }
+
+ if (comp instanceof Container) {
+ Container cont = (Container) comp;
+ for (int i = 0; i < cont.getComponentCount(); i++) {
+
+ JComboBox result = findComboBox(cont.getComponent(i));
+ if (result != null) {
+ return result;
+ }
+ }
+ }
+
+ return null;
+ }
+}
From c7f8bb25dda6a009f279ea160a6d255fb4140fcb Mon Sep 17 00:00:00 2001
From: Nils Eliasson
Date: Fri, 29 Apr 2016 09:40:08 +0200
Subject: [PATCH 019/381] 8142464: PlatformLoggerTest.java throws
java.lang.RuntimeException: Logger test.logger.bar does not exist
Test doesn't keep strong references to loggers
Reviewed-by: kvn
---
jdk/test/sun/util/logging/PlatformLoggerTest.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/jdk/test/sun/util/logging/PlatformLoggerTest.java b/jdk/test/sun/util/logging/PlatformLoggerTest.java
index 0bf94d64a5a..913390161e4 100644
--- a/jdk/test/sun/util/logging/PlatformLoggerTest.java
+++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java
@@ -31,7 +31,6 @@
*
* @modules java.base/sun.util.logging
* java.logging/sun.util.logging.internal
- * @compile -XDignore.symbol.file PlatformLoggerTest.java
* @run main/othervm PlatformLoggerTest
*/
@@ -42,25 +41,31 @@ import sun.util.logging.PlatformLogger;
import static sun.util.logging.PlatformLogger.Level.*;
public class PlatformLoggerTest {
+
+ static Logger logger;
+ static PlatformLogger bar;
+ static PlatformLogger goo;
+ static PlatformLogger foo;
+
public static void main(String[] args) throws Exception {
final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo";
final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar";
final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo";
final String BAR_LOGGER = "test.logger.bar";
- PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
+ goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER);
// test the PlatformLogger methods
testLogMethods(goo);
// Create a platform logger using the default
- PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
+ foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER);
checkPlatformLogger(foo, FOO_PLATFORM_LOGGER);
// create a java.util.logging.Logger
// now java.util.logging.Logger should be created for each platform logger
- Logger logger = Logger.getLogger(BAR_LOGGER);
+ logger = Logger.getLogger(BAR_LOGGER);
logger.setLevel(Level.WARNING);
- PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
+ bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER);
checkPlatformLogger(bar, BAR_PLATFORM_LOGGER);
// test the PlatformLogger methods
From a94f4aafd20dafa1ac27e3e0e7a5a1f18e2c750b Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov
Date: Fri, 29 Apr 2016 15:44:04 +0300
Subject: [PATCH 020/381] 8143346: Broken link in java.beans.XMLEncoder
Reviewed-by: prr
---
jdk/src/demo/share/jvmti/index.html | 2 +-
.../libawt_lwawt/awt/JavaComponentAccessibility.m | 4 ++--
.../share/classes/java/awt/Toolkit.java | 2 +-
.../share/classes/java/beans/XMLDecoder.java | 7 ++++---
.../share/classes/java/beans/XMLEncoder.java | 7 ++++---
.../share/classes/javax/swing/JRootPane.java | 2 +-
.../classes/javax/swing/colorchooser/package.html | 8 ++++----
.../share/classes/javax/swing/event/package.html | 8 ++++----
.../classes/javax/swing/filechooser/package.html | 8 ++++----
.../share/classes/javax/swing/package.html | 14 +++++++-------
.../classes/javax/swing/plaf/basic/package.html | 6 +++---
.../classes/javax/swing/plaf/metal/package.html | 6 +++---
.../swing/plaf/multi/doc-files/multi_tsc.html | 6 +++---
.../classes/javax/swing/plaf/multi/package.html | 6 +++---
.../classes/javax/swing/plaf/nimbus/package.html | 4 ++--
.../share/classes/javax/swing/plaf/package.html | 6 +++---
.../plaf/synth/doc-files/synthFileFormat.html | 2 +-
.../share/classes/javax/swing/table/package.html | 8 ++++----
.../share/classes/javax/swing/text/Document.java | 2 +-
.../classes/javax/swing/text/html/package.html | 6 +++---
.../javax/swing/text/html/parser/package.html | 6 +++---
.../share/classes/javax/swing/text/package.html | 8 ++++----
.../classes/javax/swing/text/rtf/package.html | 6 +++---
.../share/classes/javax/swing/tree/package.html | 8 ++++----
.../share/classes/javax/swing/undo/package.html | 8 ++++----
25 files changed, 76 insertions(+), 74 deletions(-)
diff --git a/jdk/src/demo/share/jvmti/index.html b/jdk/src/demo/share/jvmti/index.html
index 25440a104d9..5791b8b046f 100644
--- a/jdk/src/demo/share/jvmti/index.html
+++ b/jdk/src/demo/share/jvmti/index.html
@@ -415,7 +415,7 @@ Additional information can also be found by doing a search on "jvmti" at
Various technical articles are also available through this website.
And don't forget the
Java Tutorials at
-http://java.sun.com/docs/books/tutorial
+http://docs.oracle.com/javase/tutorial
for getting a quick start on all the various interfaces.
Comments and Feedback
diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m
index 1b3ec43a9fe..e7b229f00e1 100644
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m
@@ -25,7 +25,7 @@
// External Java Accessibility links:
//
-//
+//
//
// (Sun's mailing list for Java accessibility)
@@ -973,7 +973,7 @@ static NSObject *sAttributeNamesLOCK = nil;
// Element's value (id)
// note that the appKit meaning of "accessibilityValue" is different from the java
// meaning of "accessibleValue", which is specific to numerical values
-// (http://java.sun.com/j2se/1.3/docs/api/javax/accessibility/AccessibleValue.html#setCurrentAccessibleValue(java.lang.Number))
+// (https://docs.oracle.com/javase/8/docs/api/javax/accessibility/AccessibleValue.html#setCurrentAccessibleValue-java.lang.Number-)
- (id)accessibilityValueAttribute
{
static JNF_STATIC_MEMBER_CACHE(jm_getCurrentAccessibleValue, sjc_CAccessibility, "getCurrentAccessibleValue", "(Ljavax/accessibility/AccessibleValue;Ljava/awt/Component;)Ljava/lang/Number;");
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
index 9e7646fd320..bed5149c08a 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
@@ -89,7 +89,7 @@ import javax.accessibility.AccessibilityProvider;
* For more information, see
* Timing
* Focus Transfers, a section in
- * The Swing
+ * The Swing
* Tutorial.
*
*
Making a top-level container visible.
diff --git a/jdk/src/java.desktop/share/classes/java/beans/XMLDecoder.java b/jdk/src/java.desktop/share/classes/java/beans/XMLDecoder.java
index d86ecfaf6bd..daae045316b 100644
--- a/jdk/src/java.desktop/share/classes/java/beans/XMLDecoder.java
+++ b/jdk/src/java.desktop/share/classes/java/beans/XMLDecoder.java
@@ -53,8 +53,8 @@ import org.xml.sax.helpers.DefaultHandler;
*
*
* For more information you might also want to check out
- * Long Term Persistence of JavaBeans Components: XML Schema,
+ *
+ * Long Term Persistence of JavaBeans Components: XML Schema,
* an article in The Swing Connection.
* @see XMLEncoder
* @see java.io.ObjectInputStream
@@ -284,7 +284,8 @@ public class XMLDecoder implements AutoCloseable {
* The {@code null} value may cause illegal parsing in such case.
* The same problem may occur, if the {@code owner} class
* does not contain expected method to call. See details here.
+ * href="http://www.oracle.com/technetwork/java/persistence3-139471.html">
+ * here.
*
* @param owner the owner of the default handler
* that can be used as a value of <java> element
diff --git a/jdk/src/java.desktop/share/classes/java/beans/XMLEncoder.java b/jdk/src/java.desktop/share/classes/java/beans/XMLEncoder.java
index ac4ab411ce4..7deaea30622 100644
--- a/jdk/src/java.desktop/share/classes/java/beans/XMLEncoder.java
+++ b/jdk/src/java.desktop/share/classes/java/beans/XMLEncoder.java
@@ -193,8 +193,8 @@ import java.nio.charset.UnsupportedCharsetException;
*
*
* For more information you might also want to check out
- * Using XMLEncoder,
+ *
+ * Using XMLEncoder,
* an article in The Swing Connection.
* @see XMLDecoder
* @see java.io.ObjectOutputStream
@@ -438,7 +438,8 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
*
* For more information about using resource bundles with the
* XMLEncoder, see
- * http://java.sun.com/products/jfc/tsc/articles/persistence4/#i18n
+ *
+ * Creating Internationalized Applications,
*
* @param oldExp The expression that will be written
* to the stream.
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java
index 4061f2e2471..80dfb2954b4 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java
@@ -194,7 +194,7 @@ import sun.security.action.GetBooleanAction;
* @see JComponent
* @see BoxLayout
*
- * @see
+ * @see
* Mixing Heavy and Light Components
*
* @author David Kloba
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/package.html b/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/package.html
index cb8030258c3..43ff5ee8739 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/colorchooser/package.html
@@ -37,10 +37,10 @@ component.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@@ -49,7 +49,7 @@ target="_top">The Java Tutorial.
This document forms the complete API specification. For overviews, tutorials,
examples, guides, and tool documentation, please see:
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/filechooser/package.html b/jdk/src/java.desktop/share/classes/javax/swing/filechooser/package.html
index d850fc5b19e..fa06236262c 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/filechooser/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/filechooser/package.html
@@ -37,10 +37,10 @@ Contains classes and interfaces used by the JFileChooser component.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@@ -49,7 +49,7 @@ target="_top">The Java Tutorial.
This document forms the complete API specification. For overviews, tutorials,
examples, guides, and tool documentation, please see:
Internationalization Documentation
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/package.html b/jdk/src/java.desktop/share/classes/javax/swing/package.html
index 8050000ae91..934bb9025da 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/package.html
@@ -38,7 +38,7 @@ questions.
(all-Java language) components that,
to the maximum degree possible, work the same on all platforms.
For a programmer's guide to using these components, see
-Creating
a GUI with JFC/Swing, a trail in The Java Tutorial.
For other resources, see
@@ -123,9 +123,9 @@ input. Refer to {@link javax.swing.SwingWorker} for the preferred way to do such
processing when working with Swing.
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/package.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/package.html
index d02593c7455..347fc7cf9c8 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/package.html
@@ -55,10 +55,10 @@ encouraged.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@since 1.2
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/package.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/package.html
index 1c41e7f9577..db16ddda090 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/package.html
@@ -51,10 +51,10 @@ encouraged.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@since 1.2
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html
index 512b1a581ea..343db5479e2 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html
@@ -18,7 +18,7 @@ Using the Multiplexing Look and Feel
This document is based on an article
originally published in
-The Swing
+The Swing
Connection.
@@ -65,12 +65,12 @@ This document has the following sections:
Before reading further, you should be familiar
with the concept of pluggable look and feels.
For basic information, see
-How to Set the Look and Feel,
+How to Set the Look and Feel,
a section in
The Java Tutorial.
For architectural details, you can read
Pluggable look-and-feel architecture, a section within
+href="http://www.oracle.com/technetwork/java/architecture-142923.html#pluggable">Pluggable look-and-feel architecture, a section within
a Swing Connection article.
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/package.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/package.html
index 65d1aeafcfc..32b0d6b21af 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/package.html
@@ -53,10 +53,10 @@ the Multiplexing Look and Feel.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@since 1.2
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/package.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/package.html
index 14cac304214..f91d73781fd 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/package.html
@@ -88,10 +88,10 @@ encouraged.
Note:
Most of the Swing API is not thread safe.
For details, see
-Concurrency in Swing,
a section in
-The Java Tutorial.
@since 1.7
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/package.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/package.html
index c207c89b103..0fc8c538143 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/package.html
@@ -44,10 +44,10 @@ by the javax.swing.plaf.basic and
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@since 1.2
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html
index 202283049b5..0936b2951d3 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/doc-files/synthFileFormat.html
@@ -950,7 +950,7 @@ div.example {
Beans persistance can be used to embed any Object. This is
typically used for embedding your own Painters, but can be used
for other arbritrary objects as well. Refer to http://java.sun.com/products/jfc/tsc/articles/persistence3/ for details on beans persistance.
+ href="http://www.oracle.com/technetwork/java/persistence3-139471.html">http://www.oracle.com/technetwork/java/persistence3-139471.html for details on beans persistance.
Backing Style
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/table/package.html b/jdk/src/java.desktop/share/classes/javax/swing/table/package.html
index f3fd20c8bb1..cf944823e91 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/package.html
@@ -43,10 +43,10 @@ with the tables are viewed and managed.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@@ -54,7 +54,7 @@ target="_top">The Java Tutorial.
For overviews, tutorials, examples, guides, and tool documentation, please see:
For more information on the Document class, see
- * The Swing Connection
+ * The Swing Connection
* and most particularly the article,
*
* The Element Interface.
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/package.html b/jdk/src/java.desktop/share/classes/javax/swing/text/html/package.html
index e0ab0354d53..c9c41b8cc22 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/package.html
@@ -37,10 +37,10 @@ for creating HTML text editors.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
Package Specification
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/package.html b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/package.html
index d503bc741e7..05c53989142 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/parser/package.html
@@ -40,10 +40,10 @@ the HTMLEditorKit.ParserCallback interface.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@see javax.swing.text.html.HTMLEditorKit.ParserCallback
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/package.html b/jdk/src/java.desktop/share/classes/javax/swing/text/package.html
index 4aa7804f544..1c38c251066 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/package.html
@@ -41,17 +41,17 @@ and key mapping.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
Related Documentation
For overviews, tutorials, examples, guides, and tool documentation, please see:
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/package.html b/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/package.html
index aa83e9fa502..9b62f229a93 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/package.html
@@ -38,10 +38,10 @@ text editors.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@since 1.2
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/tree/package.html b/jdk/src/java.desktop/share/classes/javax/swing/tree/package.html
index b6b58bbdabe..e820b3cb364 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/tree/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/tree/package.html
@@ -39,10 +39,10 @@ as how data associated with the tree nodes are viewed and managed.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
@@ -50,7 +50,7 @@ target="_top">The Java Tutorial.
For overviews, tutorials, examples, guides, and tool documentation, please see:
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/undo/package.html b/jdk/src/java.desktop/share/classes/javax/swing/undo/package.html
index f4ae62d7b16..bf6d809fafb 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/undo/package.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/undo/package.html
@@ -37,17 +37,17 @@ in applications such as text editors.
Most of the Swing API is not thread safe.
For details, see
Threads and Swing,
+href="http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html"
+target="_top">Concurrency in Swing,
a section in
-The Java Tutorial.
Related Documentation
For overviews, tutorials, examples, guides, and tool documentation, please see:
From 4b793fa7ffa88cbba91575494aa0a573504e2f4a Mon Sep 17 00:00:00 2001
From: Phil Race
Date: Fri, 29 Apr 2016 09:16:06 -0700
Subject: [PATCH 021/381] 8039444: Swing applications not being displayed
properly
Reviewed-by: serb, vadim
---
.../native/libawt/java2d/d3d/D3DBadHardware.h | 129 +-----------------
1 file changed, 3 insertions(+), 126 deletions(-)
diff --git a/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBadHardware.h b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBadHardware.h
index 91ee7b358a4..115626c857c 100644
--- a/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBadHardware.h
+++ b/jdk/src/java.desktop/windows/native/libawt/java2d/d3d/D3DBadHardware.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,131 +51,8 @@ typedef struct ADAPTER_INFO {
static const ADAPTER_INFO badHardware[] = {
- // Intel HD
- // Clarkdale (Desktop) GMA HD Lines
- { 0x8086, 0x0042, NO_VERSION, OS_ALL },
- // Arrandale (Mobile) GMA HD Lines
- { 0x8086, 0x0046, NO_VERSION, OS_ALL },
-
- // Sandy Bridge HD Graphics 3000/2000
- { 0x8086, 0x0102, NO_VERSION, OS_ALL },
- { 0x8086, 0x0106, NO_VERSION, OS_ALL },
- { 0x8086, 0x0112, NO_VERSION, OS_ALL },
- { 0x8086, 0x0116, NO_VERSION, OS_ALL },
- { 0x8086, 0x0122, NO_VERSION, OS_ALL },
- { 0x8086, 0x0126, NO_VERSION, OS_ALL },
- { 0x8086, 0x010A, NO_VERSION, OS_ALL },
-
- // Ivy Bridge
- { 0x8086, 0x0162, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0162, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0166, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0166, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x016A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x016A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0152, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0152, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0156, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0156, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x015A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x015A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-
- // Haswell
- { 0x8086, 0x0402, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0402, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0406, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0406, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0412, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0412, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0416, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0416, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x041E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x041E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x040A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x040A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x041A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x041A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0A06, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0A06, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0A16, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0A16, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0A26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0A26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0A2E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0A2E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0A1E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0A1E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0A0E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0A0E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0D26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0D26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
- { 0x8086, 0x0D22, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
- { 0x8086, 0x0D22, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
-
- // Reason: workaround for 6620073, 6612195
- // Intel 740
- { 0x8086, 0x7800, NO_VERSION, OS_ALL },
- { 0x8086, 0x1240, NO_VERSION, OS_ALL },
- { 0x8086, 0x7121, NO_VERSION, OS_ALL },
- { 0x8086, 0x7123, NO_VERSION, OS_ALL },
- { 0x8086, 0x7125, NO_VERSION, OS_ALL },
- { 0x8086, 0x1132, NO_VERSION, OS_ALL },
- // IEG
- { 0x8086, 0x2562, NO_VERSION, OS_ALL },
- { 0x8086, 0x3577, NO_VERSION, OS_ALL },
- { 0x8086, 0x2572, NO_VERSION, OS_ALL },
- { 0x8086, 0x3582, NO_VERSION, OS_ALL },
- { 0x8086, 0x358E, NO_VERSION, OS_ALL },
- // GMA
- { 0x8086, 0x2582, NO_VERSION, OS_ALL },
- { 0x8086, 0x2782, NO_VERSION, OS_ALL },
- { 0x8086, 0x2592, NO_VERSION, OS_ALL },
- { 0x8086, 0x2792, NO_VERSION, OS_ALL },
- { 0x8086, 0x2772, NO_VERSION, OS_ALL },
- { 0x8086, 0x2776, NO_VERSION, OS_ALL },
- { 0x8086, 0x27A2, NO_VERSION, OS_ALL },
- { 0x8086, 0x27A6, NO_VERSION, OS_ALL },
- { 0x8086, 0x27AE, NO_VERSION, OS_ALL },
- { 0x8086, 0x29D2, NO_VERSION, OS_ALL },
- { 0x8086, 0x29D3, NO_VERSION, OS_ALL },
- { 0x8086, 0x29B2, NO_VERSION, OS_ALL },
- { 0x8086, 0x29B3, NO_VERSION, OS_ALL },
- { 0x8086, 0x29C2, NO_VERSION, OS_ALL },
- { 0x8086, 0x29C3, NO_VERSION, OS_ALL },
- { 0x8086, 0xA001, NO_VERSION, OS_ALL },
- { 0x8086, 0xA002, NO_VERSION, OS_ALL },
- { 0x8086, 0xA011, NO_VERSION, OS_ALL },
- { 0x8086, 0xA012, NO_VERSION, OS_ALL },
- // GMA
- { 0x8086, 0x2972, NO_VERSION, OS_ALL },
- { 0x8086, 0x2973, NO_VERSION, OS_ALL },
- { 0x8086, 0x2992, NO_VERSION, OS_ALL },
- { 0x8086, 0x2993, NO_VERSION, OS_ALL },
- { 0x8086, 0x29A2, NO_VERSION, OS_ALL },
- { 0x8086, 0x29A3, NO_VERSION, OS_ALL },
- { 0x8086, 0x2982, NO_VERSION, OS_ALL },
- { 0x8086, 0x2983, NO_VERSION, OS_ALL },
- { 0x8086, 0x2A02, NO_VERSION, OS_ALL },
- { 0x8086, 0x2A03, NO_VERSION, OS_ALL },
- { 0x8086, 0x2A12, NO_VERSION, OS_ALL },
- { 0x8086, 0x2A13, NO_VERSION, OS_ALL },
-
- // Eaglelake (Desktop) GMA 4500 Lines
- { 0x8086, 0x2E42, NO_VERSION, OS_ALL },
- { 0x8086, 0x2E43, NO_VERSION, OS_ALL },
- { 0x8086, 0x2E92, NO_VERSION, OS_ALL },
- { 0x8086, 0x2E93, NO_VERSION, OS_ALL },
- { 0x8086, 0x2E12, NO_VERSION, OS_ALL },
- { 0x8086, 0x2E13, NO_VERSION, OS_ALL },
- // Eaglelake (Desktop) GMA X4500 Lines
- { 0x8086, 0x2E32, NO_VERSION, OS_ALL },
- { 0x8086, 0x2E33, NO_VERSION, OS_ALL },
- { 0x8086, 0x2E22, NO_VERSION, OS_ALL },
- // Eaglelake (Desktop) GMA X4500HD Lines
- { 0x8086, 0x2E23, NO_VERSION, OS_ALL },
- // Cantiga (Mobile) GMA 4500MHD Lines
- { 0x8086, 0x2A42, NO_VERSION, OS_ALL },
- { 0x8086, 0x2A43, NO_VERSION, OS_ALL },
+ // All Intel Chips.
+ { 0x8086, ALL_DEVICEIDS, NO_VERSION, OS_ALL },
// ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350
// Reason: workaround for 6613066, 6687166
From bf6b990945a035ad0f5bc76987be75f2bbc6819b Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy
Date: Fri, 29 Apr 2016 21:59:47 +0400
Subject: [PATCH 022/381] 8017112: JTabbedPane components have inconsistent
accessibility tree
Reviewed-by: ptbrunet, serb
---
.../share/classes/java/awt/Component.java | 27 +++++---
.../8017112/AccessibleIndexInParentTest.java | 68 +++++++++++++++++++
2 files changed, 84 insertions(+), 11 deletions(-)
create mode 100644 jdk/test/javax/accessibility/8017112/AccessibleIndexInParentTest.java
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Component.java b/jdk/src/java.desktop/share/classes/java/awt/Component.java
index b2b51e08559..c2a021fd595 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java
@@ -9739,19 +9739,24 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/
int getAccessibleIndexInParent() {
synchronized (getTreeLock()) {
- int index = -1;
- Container parent = this.getParent();
- if (parent != null && parent instanceof Accessible) {
- Component ca[] = parent.getComponents();
- for (int i = 0; i < ca.length; i++) {
- if (ca[i] instanceof Accessible) {
- index++;
- }
- if (this.equals(ca[i])) {
- return index;
- }
+
+ AccessibleContext accContext = getAccessibleContext();
+ if (accContext == null) {
+ return -1;
+ }
+
+ Accessible parent = accContext.getAccessibleParent();
+ if (parent == null) {
+ return -1;
+ }
+
+ accContext = parent.getAccessibleContext();
+ for (int i = 0; i < accContext.getAccessibleChildrenCount(); i++) {
+ if (this.equals(accContext.getAccessibleChild(i))) {
+ return i;
}
}
+
return -1;
}
}
diff --git a/jdk/test/javax/accessibility/8017112/AccessibleIndexInParentTest.java b/jdk/test/javax/accessibility/8017112/AccessibleIndexInParentTest.java
new file mode 100644
index 00000000000..87f35b40da9
--- /dev/null
+++ b/jdk/test/javax/accessibility/8017112/AccessibleIndexInParentTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.awt.Component;
+import javax.swing.JLabel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+/*
+ * @test
+ * @bug 8017112
+ * @summary JTabbedPane components have inconsistent accessibility tree
+ * @run main AccessibleIndexInParentTest
+ */
+
+public class AccessibleIndexInParentTest {
+
+ public static void main(String[] args) throws Exception {
+ SwingUtilities.invokeAndWait(AccessibleIndexInParentTest::test);
+ }
+
+ private static void test() {
+
+ int N = 5;
+ JTabbedPane tabbedPane = new JTabbedPane();
+
+ for (int i = 0; i < N; i++) {
+ tabbedPane.addTab("Title: " + i, new JLabel("Component: " + i));
+ }
+
+ for (int i = 0; i < tabbedPane.getTabCount(); i++) {
+ Component child = tabbedPane.getComponentAt(i);
+
+ AccessibleContext ac = child.getAccessibleContext();
+ if (ac == null) {
+ throw new RuntimeException("Accessible Context is null!");
+ }
+
+ int index = ac.getAccessibleIndexInParent();
+ Accessible parent = ac.getAccessibleParent();
+
+ if (parent.getAccessibleContext().getAccessibleChild(index) != child) {
+ throw new RuntimeException("Wrong getAccessibleIndexInParent!");
+ }
+ }
+ }
+}
\ No newline at end of file
From 6a55291a23f5116c16c27c7a7f152bcf8e45adb3 Mon Sep 17 00:00:00 2001
From: Brian Burkhalter
Date: Fri, 29 Apr 2016 11:14:56 -0700
Subject: [PATCH 023/381] 8151323: GeoTIFFTagSet#"ModelTiePointTag" name case
does not match GeoTIFF specification
Change occurrences of "ModelTiePoint" to "ModelTiepoint."
Reviewed-by: prr
---
.../classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java
index 28ee56abd3c..58adc761f29 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java
@@ -87,9 +87,9 @@ public class GeoTIFFTagSet extends TIFFTagSet {
}
}
- static class ModelTiePoint extends TIFFTag {
- public ModelTiePoint() {
- super("ModelTiePointTag",
+ static class ModelTiepoint extends TIFFTag {
+ public ModelTiepoint() {
+ super("ModelTiepointTag",
TAG_MODEL_TIE_POINT,
1 << TIFFTag.TIFF_DOUBLE);
}
@@ -126,7 +126,7 @@ public class GeoTIFFTagSet extends TIFFTagSet {
tags.add(new GeoTIFFTagSet.ModelPixelScale());
tags.add(new GeoTIFFTagSet.ModelTransformation());
- tags.add(new GeoTIFFTagSet.ModelTiePoint());
+ tags.add(new GeoTIFFTagSet.ModelTiepoint());
tags.add(new GeoTIFFTagSet.GeoKeyDirectory());
tags.add(new GeoTIFFTagSet.GeoDoubleParams());
tags.add(new GeoTIFFTagSet.GeoAsciiParams());
From 528b2cc81a583705fd00075aa465256cd306be09 Mon Sep 17 00:00:00 2001
From: Harold Seigel
Date: Fri, 29 Apr 2016 15:17:46 -0400
Subject: [PATCH 024/381] 8155727:
java/util/concurrent/locks/Lock/TimedAcquireLeak.java timeouts
Fix regex pattern to handle possible (module@version) text
Reviewed-by: ctornqvi, martin
---
.../java/util/concurrent/locks/Lock/TimedAcquireLeak.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java b/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java
index 7d6da0b255e..630f3796b8c 100644
--- a/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java
+++ b/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -167,7 +167,7 @@ public class TimedAcquireLeak {
final String childPid,
final String className) {
final String regex =
- "(?m)^ *[0-9]+: +([0-9]+) +[0-9]+ +\\Q"+className+"\\E$";
+ "(?m)^ *[0-9]+: +([0-9]+) +[0-9]+ +\\Q"+className+"\\E(?:$| )";
final Callable objectsInUse =
new Callable() { public Integer call() {
Integer i = Integer.parseInt(
From fed3d6ceac50ab9e33fcdf74ab4a8d6e26348200 Mon Sep 17 00:00:00 2001
From: Brian Burkhalter
Date: Fri, 29 Apr 2016 14:50:50 -0700
Subject: [PATCH 025/381] 8149810: TIFFField#getAsLong throws
ClassCastException when data is type TIFFTag.TIFF_DOUBLE or TIFFTag.FLOAT
Expand the getAsLong() specification and handle the TIFF_DOUBLE and TIFF_FLOAT cases.
Reviewed-by: prr
---
.../javax/imageio/plugins/tiff/TIFFField.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
index 336f81550b7..168e6b17328 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java
@@ -1089,6 +1089,15 @@ public class TIFFField implements Cloneable {
* {@code TIFF_SBYTE} data will be returned in the range
* [-128, 127].
*
+ *
Data in {@code TIFF_FLOAT} and {@code TIFF_DOUBLE} are
+ * simply cast to {@code long} and may suffer from truncation.
+ *
+ *
Data in {@code TIFF_SRATIONAL} or
+ * {@code TIFF_RATIONAL} format are evaluated by dividing the
+ * numerator into the denominator using double-precision
+ * arithmetic and then casting to {@code long}. Loss of
+ * precision and truncation may occur.
+ *
*
Data in {@code TIFF_ASCII} format will be parsed as by
* the {@code Double.parseDouble} method, with the result
* cast to {@code long}.
@@ -1112,6 +1121,10 @@ public class TIFFField implements Cloneable {
case TIFFTag.TIFF_LONG:
case TIFFTag.TIFF_IFD_POINTER:
return ((long[])data)[index];
+ case TIFFTag.TIFF_FLOAT:
+ return (long)((float[])data)[index];
+ case TIFFTag.TIFF_DOUBLE:
+ return (long)((double[])data)[index];
case TIFFTag.TIFF_SRATIONAL:
int[] ivalue = getAsSRational(index);
return (long)((double)ivalue[0]/ivalue[1]);
From 5dda2fc113cd2a7c2c252f2726d200213f18bd8d Mon Sep 17 00:00:00 2001
From: Phil Race
Date: Fri, 29 Apr 2016 16:37:02 -0700
Subject: [PATCH 026/381] 8155772: gtk3_interface.c compilation error on Ubuntu
12.10
Reviewed-by: serb, kcr
---
.../java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c
index 6a188fb3598..060b082e53b 100644
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c
@@ -2547,14 +2547,14 @@ static jobject get_string_property(JNIEnv *env, GtkSettings* settings,
static jobject get_integer_property(JNIEnv *env, GtkSettings* settings,
const gchar* key) {
- gint intval = NULL;
+ gint intval = 0;
(*fp_g_object_get)(settings, key, &intval, NULL);
return create_Integer(env, intval);
}
static jobject get_boolean_property(JNIEnv *env, GtkSettings* settings,
const gchar* key) {
- gint intval = NULL;
+ gint intval = 0;
(*fp_g_object_get)(settings, key, &intval, NULL);
return create_Boolean(env, intval);
}
From 3dfed24a479db9972f0ba9324ca27a9586fe2a45 Mon Sep 17 00:00:00 2001
From: Max Ockner
Date: Fri, 29 Apr 2016 22:39:44 -0400
Subject: [PATCH 027/381] 8154110: Update class* and safepoint* logging
subsystems
Refactored logging tags in class and safepoint subsystems.
Reviewed-by: coleenp, rehn, hseigel
---
jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh | 2 +-
jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh | 2 +-
.../instrument/appendToClassLoaderSearch/ClassUnloadTest.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh b/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh
index 3872f813ffd..a00c14077d6 100644
--- a/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh
+++ b/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh
@@ -106,7 +106,7 @@ done
# run test
${TESTJAVA}${FS}bin${FS}java \
${TESTVMOPTS} \
- -verbose:class -Xlog:classload -cp . \
+ -verbose:class -Xlog:class+load -cp . \
-Dtest.classes=${TESTCLASSES} \
Starter cross
# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
diff --git a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh
index 198cd70827a..1289b4c861e 100644
--- a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh
+++ b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh
@@ -102,7 +102,7 @@ done
# run test
${TESTJAVA}${FS}bin${FS}java \
${TESTVMOPTS} \
- -verbose:class -Xlog:classload -cp . \
+ -verbose:class -Xlog:class+load -cp . \
-Dtest.classes=${TESTCLASSES} \
Starter one-way
# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
diff --git a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh
index f5bb3b83179..b428a59bb28 100644
--- a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh
+++ b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh
@@ -80,5 +80,5 @@ $JAR ${TESTTOOLVMOPTS} -cfm "${TESTCLASSES}"/ClassUnloadTest.jar "${MANIFEST}" \
# Finally we run the test
(cd "${TESTCLASSES}"; \
- $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:classunload \
+ $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:class+unload \
-javaagent:ClassUnloadTest.jar ClassUnloadTest "${OTHERDIR}" Bar.jar)
From 1f092412dccc3eeb353c0ef4ab360a5999f2e050 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov
Date: Mon, 2 May 2016 12:01:39 +0300
Subject: [PATCH 028/381] 8154493: AppletViewer should emit its deprecation
warning to standard error
Reviewed-by: smarks
---
jdk/src/java.desktop/share/classes/sun/applet/Main.java | 3 ++-
.../DeprecatedAppletViewer/DeprecatedAppletViewer.java | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/jdk/src/java.desktop/share/classes/sun/applet/Main.java b/jdk/src/java.desktop/share/classes/sun/applet/Main.java
index 086b1113614..6c28c8f9d11 100644
--- a/jdk/src/java.desktop/share/classes/sun/applet/Main.java
+++ b/jdk/src/java.desktop/share/classes/sun/applet/Main.java
@@ -104,7 +104,8 @@ public class Main {
private int run(String [] args) {
// DECODE ARGS
try {
- System.out.println(lookup("deprecated"));
+ System.err.println(lookup("deprecated"));
+ System.err.flush();
if (args.length == 0) {
usage();
return 0;
diff --git a/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java b/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java
index f3b43f83eee..3c491011794 100644
--- a/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java
+++ b/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java
@@ -35,14 +35,14 @@ public final class DeprecatedAppletViewer {
private static final String TEXT = "AppletViewer is deprecated.";
public static void main(final String[] args) {
- final PrintStream old = System.out;
+ final PrintStream old = System.err;
final ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
final PrintStream ps = new PrintStream(baos);
try {
- System.setOut(ps);
+ System.setErr(ps);
sun.applet.Main.main(new String[]{});
} finally {
- System.setOut(old);
+ System.setErr(old);
}
final String text = new String(baos.toByteArray());
From 36865021a112e983a33d495d4a1ab0d4490ae2b0 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov
Date: Mon, 2 May 2016 12:08:59 +0300
Subject: [PATCH 029/381] 8027324: The spec for Toolkit.setDynamicLayout() and
Toolkit.isDynamicLayoutActive() needs to be clarified
Reviewed-by: alexsch, prr
---
.../share/classes/java/awt/Toolkit.java | 52 ++++++++++---------
.../awt/Toolkit/DynamicLayout/bug7172833.java | 22 +++++++-
2 files changed, 48 insertions(+), 26 deletions(-)
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
index bed5149c08a..b45dd39a717 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -207,30 +207,34 @@ public abstract class Toolkit {
}
/**
- * Returns whether dynamic layout of Containers on resize is
- * currently active (both set in program
- *( {@code isDynamicLayoutSet()} )
- *, and supported
- * by the underlying operating system and/or window manager).
- * If dynamic layout is currently inactive then Containers
- * re-layout their components when resizing is completed. As a result
- * the {@code Component.validate()} method will be invoked only
- * once per resize.
- * If dynamic layout is currently active then Containers
- * re-layout their components on every native resize event and
- * the {@code validate()} method will be invoked each time.
- * The OS/WM support can be queried using
- * the getDesktopProperty("awt.dynamicLayoutSupported") method.
+ * Returns whether dynamic layout of Containers on resize is currently
+ * enabled on the underlying operating system and/or window manager). If the
+ * platform supports it, {@code setDynamicLayout(boolean)} may be used to
+ * programmatically enable or disable platform dynamic layout. Regardless of
+ * whether that toggling is supported, or whether {@code true} or {@code
+ * false} is specified as an argument, or has never been called at all, this
+ * method will return the active current platform behavior and which will be
+ * followed by the JDK in determining layout policy during resizing.
+ *
+ * If dynamic layout is currently inactive then Containers re-layout their
+ * components when resizing is completed. As a result the
+ * {@code Component.validate()} method will be invoked only once per resize.
+ * If dynamic layout is currently active then Containers re-layout their
+ * components on every native resize event and the {@code validate()} method
+ * will be invoked each time. The OS/WM support can be queried using the
+ * getDesktopProperty("awt.dynamicLayoutSupported") method. This property
+ * will reflect the platform capability but is not sufficient to tell if it
+ * is presently enabled.
*
- * @return true if dynamic layout of Containers on resize is
- * currently active, false otherwise.
- * @exception HeadlessException if the GraphicsEnvironment.isHeadless()
- * method returns true
- * @see #setDynamicLayout(boolean dynamic)
- * @see #isDynamicLayoutSet()
- * @see #getDesktopProperty(String propertyName)
- * @see java.awt.GraphicsEnvironment#isHeadless
- * @since 1.4
+ * @return true if dynamic layout of Containers on resize is currently
+ * active, false otherwise.
+ * @throws HeadlessException if the GraphicsEnvironment.isHeadless() method
+ * returns true
+ * @see #setDynamicLayout(boolean dynamic)
+ * @see #isDynamicLayoutSet()
+ * @see #getDesktopProperty(String propertyName)
+ * @see java.awt.GraphicsEnvironment#isHeadless
+ * @since 1.4
*/
public boolean isDynamicLayoutActive()
throws HeadlessException {
diff --git a/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java b/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java
index 7c61804892b..2c4f04147b8 100644
--- a/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.java
+++ b/jdk/test/java/awt/Toolkit/DynamicLayout/bug7172833.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
@@ -45,16 +45,34 @@ public final class bug7172833 {
public static void main(final String[] args) throws Exception {
final StubbedToolkit t = new StubbedToolkit();
-
+ final Boolean dynamicLayoutSupported
+ = (Boolean) t.getDesktopProperty("awt.dynamicLayoutSupported");
t.setDynamicLayout(true);
if(!t.isDynamicLayoutSet()){
throw new RuntimeException("'true' expected but 'false' returned");
}
+ if (dynamicLayoutSupported) {
+ if (!t.isDynamicLayoutActive()) {
+ throw new RuntimeException("is inactive but set+supported");
+ }
+ } else {
+ if (t.isDynamicLayoutActive()) {
+ throw new RuntimeException("is active but unsupported");
+ }
+ }
t.setDynamicLayout(false);
if(t.isDynamicLayoutSet()){
throw new RuntimeException("'false' expected but 'true' returned");
}
+ if (dynamicLayoutSupported) {
+ // Layout is supported and was set to false, cannot verifym because
+ // the native system is free to ignore our request.
+ } else {
+ if (t.isDynamicLayoutActive()) {
+ throw new RuntimeException("is active but unset+unsupported");
+ }
+ }
}
static final class StubbedToolkit extends Toolkit {
From 4f53885343025864dedb15af3c22156242809e17 Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev
Date: Wed, 4 May 2016 17:17:28 +0300
Subject: [PATCH 030/381] 8155739: [TESTBUG] VarHandles/Unsafe tests for
weakCAS should allow spurious failures
Reviewed-by: psandoz, vlivanov, simonis
---
.../invoke/VarHandles/VarHandleBaseTest.java | 3 +-
.../VarHandleTestAccessBoolean.java | 1 -
.../VarHandles/VarHandleTestAccessByte.java | 1 -
.../VarHandles/VarHandleTestAccessChar.java | 1 -
.../VarHandles/VarHandleTestAccessDouble.java | 1 -
.../VarHandles/VarHandleTestAccessFloat.java | 1 -
.../VarHandles/VarHandleTestAccessInt.java | 64 +++++++++++++------
.../VarHandles/VarHandleTestAccessLong.java | 64 +++++++++++++------
.../VarHandles/VarHandleTestAccessShort.java | 1 -
.../VarHandles/VarHandleTestAccessString.java | 64 +++++++++++++------
.../VarHandleTestByteArrayAsChar.java | 1 -
.../VarHandleTestByteArrayAsDouble.java | 43 +++++++++----
.../VarHandleTestByteArrayAsFloat.java | 43 +++++++++----
.../VarHandleTestByteArrayAsInt.java | 43 +++++++++----
.../VarHandleTestByteArrayAsLong.java | 43 +++++++++----
.../VarHandleTestByteArrayAsShort.java | 1 -
.../VarHandleTestMethodHandleAccessInt.java | 63 ++++++++++++------
.../VarHandleTestMethodHandleAccessLong.java | 63 ++++++++++++------
...VarHandleTestMethodHandleAccessString.java | 63 ++++++++++++------
.../X-VarHandleTestAccess.java.template | 63 ++++++++++++------
...X-VarHandleTestByteArrayView.java.template | 42 ++++++++----
...HandleTestMethodHandleAccess.java.template | 63 ++++++++++++------
22 files changed, 512 insertions(+), 220 deletions(-)
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java
index 241d821c00a..ee6205d1ed7 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java
@@ -40,6 +40,7 @@ import static org.testng.Assert.*;
abstract class VarHandleBaseTest {
static final int ITERS = Integer.getInteger("iters", 1);
+ static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10);
interface ThrowingRunnable {
void run() throws Throwable;
@@ -474,4 +475,4 @@ abstract class VarHandleBaseTest {
assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType());
}
}
-}
\ No newline at end of file
+}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
index 5590984e493..b22fc3e182a 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
index f9c9d4fc31e..088a519e920 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
index bd1174efc5a..18ff6542615 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
index d8732d239b4..36c84e2f753 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
index 9976102d027..2ea2d9617be 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
index c78e5cb7199..25683af1097 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
@@ -402,22 +401,31 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(recv, 1, 2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(recv, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) vh.get(recv);
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(recv, 2, 1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(recv, 2, 1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) vh.get(recv);
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = vh.weakCompareAndSetRelease(recv, 1, 2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(recv, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) vh.get(recv);
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
@@ -536,22 +544,31 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
}
{
- boolean r = (boolean) vh.weakCompareAndSet(1, 2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) vh.get();
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = (boolean) vh.weakCompareAndSetAcquire(2, 1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(2, 1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) vh.get();
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = (boolean) vh.weakCompareAndSetRelease( 1, 2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) vh.get();
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
@@ -673,22 +690,31 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, 1, 2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) vh.get(array, i);
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, 2, 1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, 2, 1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) vh.get(array, i);
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, 1, 2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) vh.get(array, i);
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
index f82ee67960e..2b44b4793f7 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
@@ -402,22 +401,31 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(recv, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(recv, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) vh.get(recv);
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(recv, 2L, 1L);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(recv, 2L, 1L);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) vh.get(recv);
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = vh.weakCompareAndSetRelease(recv, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(recv, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) vh.get(recv);
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
@@ -536,22 +544,31 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
}
{
- boolean r = (boolean) vh.weakCompareAndSet(1L, 2L);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) vh.get();
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = (boolean) vh.weakCompareAndSetAcquire(2L, 1L);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(2L, 1L);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) vh.get();
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = (boolean) vh.weakCompareAndSetRelease( 1L, 2L);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) vh.get();
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
@@ -673,22 +690,31 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) vh.get(array, i);
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, 2L, 1L);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, 2L, 1L);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) vh.get(array, i);
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) vh.get(array, i);
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
index d235e03a7bf..4ff25cc4a5f 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
index 61e3690447c..1e876059a69 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java
@@ -106,7 +106,6 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
@@ -416,22 +415,31 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(recv, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSet String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(recv, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSet String");
String x = (String) vh.get(recv);
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(recv, "bar", "foo");
- assertEquals(r, true, "weakCompareAndSetAcquire String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(recv, "bar", "foo");
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire String");
String x = (String) vh.get(recv);
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = vh.weakCompareAndSetRelease(recv, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSetRelease String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(recv, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease String");
String x = (String) vh.get(recv);
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
@@ -548,22 +556,31 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
}
{
- boolean r = (boolean) vh.weakCompareAndSet("foo", "bar");
- assertEquals(r, true, "weakCompareAndSet String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet("foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSet String");
String x = (String) vh.get();
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = (boolean) vh.weakCompareAndSetAcquire("bar", "foo");
- assertEquals(r, true, "weakCompareAndSetAcquire String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire("bar", "foo");
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire String");
String x = (String) vh.get();
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = (boolean) vh.weakCompareAndSetRelease( "foo", "bar");
- assertEquals(r, true, "weakCompareAndSetRelease String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease("foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease String");
String x = (String) vh.get();
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
@@ -683,22 +700,31 @@ public class VarHandleTestAccessString extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSet String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSet String");
String x = (String) vh.get(array, i);
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, "bar", "foo");
- assertEquals(r, true, "weakCompareAndSetAcquire String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, "bar", "foo");
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire String");
String x = (String) vh.get(array, i);
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSetRelease String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease String");
String x = (String) vh.get(array, i);
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
index e6941f5fa3c..842a9f55327 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java
@@ -93,7 +93,6 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
index ec4b843b2aa..57635e95474 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java
@@ -93,7 +93,6 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
@@ -678,22 +677,31 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet double");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet double");
double x = (double) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet double value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire double");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire double");
double x = (double) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire double");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease double");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease double");
double x = (double) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease double");
}
@@ -811,22 +819,31 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet double");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet double");
double x = (double) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet double value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire double");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire double");
double x = (double) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire double");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease double");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease double");
double x = (double) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease double");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
index 57d37cbe523..23d5072e274 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java
@@ -93,7 +93,6 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
@@ -678,22 +677,31 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet float");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet float");
float x = (float) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet float value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire float");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire float");
float x = (float) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire float");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease float");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease float");
float x = (float) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease float");
}
@@ -811,22 +819,31 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet float");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet float");
float x = (float) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet float value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire float");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire float");
float x = (float) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire float");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease float");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease float");
float x = (float) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease float");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
index ae66477d3b6..91eee4f4775 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java
@@ -93,7 +93,6 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
@@ -692,22 +691,31 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet int value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire int");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease int");
}
@@ -834,22 +842,31 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet int value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire int");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease int");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
index ac08db2af5c..8adaf2b3428 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java
@@ -93,7 +93,6 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
@@ -692,22 +691,31 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet long value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire long");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease long");
}
@@ -834,22 +842,31 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet long value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire long");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease long");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
index 9742fbd2522..f554fb35058 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java
@@ -93,7 +93,6 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest {
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD));
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
index 4e8de0c3bc8..4985136f2fd 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
@@ -208,22 +208,31 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1, 2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2, 1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2, 1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1, 2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
@@ -342,22 +351,31 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1, 2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2, 1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2, 1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( 1, 2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
@@ -479,22 +497,31 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1, 2);
- assertEquals(r, true, "weakCompareAndSet int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSet int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "weakCompareAndSet int value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2, 1);
- assertEquals(r, true, "weakCompareAndSetAcquire int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2, 1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1, "weakCompareAndSetAcquire int");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1, 2);
- assertEquals(r, true, "weakCompareAndSetRelease int");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1, 2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease int");
int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2, "weakCompareAndSetRelease int");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
index 05efd70079b..59a3941c4db 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java
@@ -208,22 +208,31 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2L, 1L);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2L, 1L);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
@@ -342,22 +351,31 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1L, 2L);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2L, 1L);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2L, 1L);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( 1L, 2L);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
@@ -479,22 +497,31 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSet long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSet long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "weakCompareAndSet long value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2L, 1L);
- assertEquals(r, true, "weakCompareAndSetAcquire long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2L, 1L);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 1L, "weakCompareAndSetAcquire long");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1L, 2L);
- assertEquals(r, true, "weakCompareAndSetRelease long");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1L, 2L);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease long");
long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, 2L, "weakCompareAndSetRelease long");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
index 62ef4ae7f37..eb2ed9d3c08 100644
--- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
+++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java
@@ -208,22 +208,31 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSet String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSet String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "foo");
- assertEquals(r, true, "weakCompareAndSetAcquire String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "foo");
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSetRelease String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
@@ -338,22 +347,31 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar");
- assertEquals(r, true, "weakCompareAndSet String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSet String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "foo");
- assertEquals(r, true, "weakCompareAndSetAcquire String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "foo");
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( "foo", "bar");
- assertEquals(r, true, "weakCompareAndSetRelease String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact("foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
@@ -471,22 +489,31 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSet String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSet String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "weakCompareAndSet String value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "foo");
- assertEquals(r, true, "weakCompareAndSetAcquire String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "foo");
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "foo", "weakCompareAndSetAcquire String");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, "foo", "bar");
- assertEquals(r, true, "weakCompareAndSetRelease String");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, "foo", "bar");
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease String");
String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, "bar", "weakCompareAndSetRelease String");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
index fb44c8bbb2b..dbee4cbb347 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template
@@ -494,22 +494,31 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(recv, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get(recv);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(recv, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(recv, $value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get(recv);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get(recv);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
@@ -670,22 +679,31 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
}
{
- boolean r = (boolean) vh.weakCompareAndSet($value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet($value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get();
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) vh.weakCompareAndSetAcquire($value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire($value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get();
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) vh.weakCompareAndSetRelease( $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease($value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get();
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
@@ -849,22 +867,31 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, $value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
index 1c323e2f195..12a0fcef8ad 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template
@@ -848,22 +848,31 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease $type$");
}
@@ -994,22 +1003,31 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest {
}
{
- boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, VALUE_1, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, VALUE_2, "weakCompareAndSetRelease $type$");
}
diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
index 8e40761a4f3..a3b3aa5c43f 100644
--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template
@@ -209,22 +209,31 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
@@ -373,22 +382,31 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact( $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact($value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact();
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
@@ -540,22 +558,31 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest {
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
From 182152c38568d5f73b469d37e7b663677620d50d Mon Sep 17 00:00:00 2001
From: Harsha Wardhana B
Date: Thu, 5 May 2016 01:52:03 -0700
Subject: [PATCH 031/381] 8154166:
java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java fails with
RuntimeException
Fix the RuntimeException issue
Reviewed-by: jbachorik
---
.../management/MemoryMXBean/ResetPeakMemoryUsage.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
index b1f6e781044..dc85eb6bb03 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java
@@ -36,9 +36,13 @@
* @modules java.management
* @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
* @run main ResetPeakMemoryUsage
+ * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
+ * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true"
+ * @requires vm.opt.DisableExplicitGC != "true"
*/
import java.lang.management.*;
+import java.lang.ref.WeakReference;
import java.util.*;
public class ResetPeakMemoryUsage {
@@ -100,6 +104,7 @@ public class ResetPeakMemoryUsage {
printMemoryUsage(usage0, peak0);
obj = new Object[largeArraySize];
+ WeakReference