diff --git a/src/os/bsd/vm/os_bsd.cpp b/src/os/bsd/vm/os_bsd.cpp index 1bc86d13bcef8840760828b32e1e64c6764195f9..fdf5772a764ce34fa6939e6e995dde1d528f669f 100644 --- a/src/os/bsd/vm/os_bsd.cpp +++ b/src/os/bsd/vm/os_bsd.cpp @@ -2695,7 +2695,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) { assert(thread->is_VM_thread(), "Must be VMThread"); // read current suspend action int action = osthread->sr.suspend_action(); - if (action == SR_SUSPEND) { + if (action == os::Bsd::SuspendResume::SR_SUSPEND) { suspend_save_context(osthread, siginfo, context); // Notify the suspend action is about to be completed. do_suspend() @@ -2717,12 +2717,12 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) { do { sigsuspend(&suspend_set); // ignore all returns until we get a resume signal - } while (osthread->sr.suspend_action() != SR_CONTINUE); + } while (osthread->sr.suspend_action() != os::Bsd::SuspendResume::SR_CONTINUE); resume_clear_context(osthread); } else { - assert(action == SR_CONTINUE, "unexpected sr action"); + assert(action == os::Bsd::SuspendResume::SR_CONTINUE, "unexpected sr action"); // nothing special to do - just leave the handler } @@ -2776,7 +2776,7 @@ static int SR_finalize() { // but this seems the normal response to library errors static bool do_suspend(OSThread* osthread) { // mark as suspended and send signal - osthread->sr.set_suspend_action(SR_SUSPEND); + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_SUSPEND); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); @@ -2785,18 +2785,18 @@ static bool do_suspend(OSThread* osthread) { for (int i = 0; !osthread->sr.is_suspended(); i++) { os::yield_all(i); } - osthread->sr.set_suspend_action(SR_NONE); + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_NONE); return true; } else { - osthread->sr.set_suspend_action(SR_NONE); + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_NONE); return false; } } static void do_resume(OSThread* osthread) { assert(osthread->sr.is_suspended(), "thread should be suspended"); - osthread->sr.set_suspend_action(SR_CONTINUE); + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_CONTINUE); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); @@ -2806,7 +2806,7 @@ static void do_resume(OSThread* osthread) { os::yield_all(i); } } - osthread->sr.set_suspend_action(SR_NONE); + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_NONE); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/os/bsd/vm/os_bsd.hpp b/src/os/bsd/vm/os_bsd.hpp index ebdbdc22a037fe7c6a5ef0d504c1f846aa1e1fe3..81562b4f8d397e373329fef193d540ae67c45562 100644 --- a/src/os/bsd/vm/os_bsd.hpp +++ b/src/os/bsd/vm/os_bsd.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,36 +151,25 @@ class Bsd { // for BsdThreads are no longer needed. class SuspendResume { private: - volatile int _suspend_action; - // values for suspend_action: - #define SR_NONE (0x00) - #define SR_SUSPEND (0x01) // suspend request - #define SR_CONTINUE (0x02) // resume request - + volatile int _suspend_action; volatile jint _state; - // values for _state: + SR_NONE - #define SR_SUSPENDED (0x20) public: + // values for suspend_action: + enum { + SR_NONE = 0x00, + SR_SUSPEND = 0x01, // suspend request + SR_CONTINUE = 0x02, // resume request + SR_SUSPENDED = 0x20 // values for _state: + SR_NONE + }; + SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } int suspend_action() const { return _suspend_action; } void set_suspend_action(int x) { _suspend_action = x; } // atomic updates for _state - void set_suspended() { - jint temp, temp2; - do { - temp = _state; - temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); - } while (temp2 != temp); - } - void clear_suspended() { - jint temp, temp2; - do { - temp = _state; - temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); - } while (temp2 != temp); - } + inline void set_suspended(); + inline void clear_suspended(); bool is_suspended() { return _state & SR_SUSPENDED; } #undef SR_SUSPENDED diff --git a/src/os/bsd/vm/os_bsd.inline.hpp b/src/os/bsd/vm/os_bsd.inline.hpp index 8fc3c2b0878301b6d50378a80b33739f0ef6af85..723543efe92cac4f43754a5c8107574828a0df03 100644 --- a/src/os/bsd/vm/os_bsd.inline.hpp +++ b/src/os/bsd/vm/os_bsd.inline.hpp @@ -25,7 +25,6 @@ #ifndef OS_BSD_VM_OS_BSD_INLINE_HPP #define OS_BSD_VM_OS_BSD_INLINE_HPP -#include "runtime/atomic.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/os.hpp" @@ -286,4 +285,21 @@ inline int os::set_sock_opt(int fd, int level, int optname, const char* optval, socklen_t optlen) { return ::setsockopt(fd, level, optname, optval, optlen); } + +inline void os::Bsd::SuspendResume::set_suspended() { + jint temp, temp2; + do { + temp = _state; + temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); + } while (temp2 != temp); +} + +inline void os::Bsd::SuspendResume::clear_suspended() { + jint temp, temp2; + do { + temp = _state; + temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); + } while (temp2 != temp); +} + #endif // OS_BSD_VM_OS_BSD_INLINE_HPP diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp index 9f09507e67b9e02871b47478beab963a178d1d91..b14615e58e80aa938a5d387105fed0aee2d76ffb 100644 --- a/src/os/linux/vm/os_linux.cpp +++ b/src/os/linux/vm/os_linux.cpp @@ -3461,7 +3461,7 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) { assert(thread->is_VM_thread(), "Must be VMThread"); // read current suspend action int action = osthread->sr.suspend_action(); - if (action == SR_SUSPEND) { + if (action == os::Linux::SuspendResume::SR_SUSPEND) { suspend_save_context(osthread, siginfo, context); // Notify the suspend action is about to be completed. do_suspend() @@ -3483,12 +3483,12 @@ static void SR_handler(int sig, siginfo_t* siginfo, ucontext_t* context) { do { sigsuspend(&suspend_set); // ignore all returns until we get a resume signal - } while (osthread->sr.suspend_action() != SR_CONTINUE); + } while (osthread->sr.suspend_action() != os::Linux::SuspendResume::SR_CONTINUE); resume_clear_context(osthread); } else { - assert(action == SR_CONTINUE, "unexpected sr action"); + assert(action == os::Linux::SuspendResume::SR_CONTINUE, "unexpected sr action"); // nothing special to do - just leave the handler } @@ -3542,7 +3542,7 @@ static int SR_finalize() { // but this seems the normal response to library errors static bool do_suspend(OSThread* osthread) { // mark as suspended and send signal - osthread->sr.set_suspend_action(SR_SUSPEND); + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_SUSPEND); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); @@ -3551,18 +3551,18 @@ static bool do_suspend(OSThread* osthread) { for (int i = 0; !osthread->sr.is_suspended(); i++) { os::yield_all(i); } - osthread->sr.set_suspend_action(SR_NONE); + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); return true; } else { - osthread->sr.set_suspend_action(SR_NONE); + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); return false; } } static void do_resume(OSThread* osthread) { assert(osthread->sr.is_suspended(), "thread should be suspended"); - osthread->sr.set_suspend_action(SR_CONTINUE); + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_CONTINUE); int status = pthread_kill(osthread->pthread_id(), SR_signum); assert_status(status == 0, status, "pthread_kill"); @@ -3572,7 +3572,7 @@ static void do_resume(OSThread* osthread) { os::yield_all(i); } } - osthread->sr.set_suspend_action(SR_NONE); + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/os/linux/vm/os_linux.hpp b/src/os/linux/vm/os_linux.hpp index 7bbc041ed9033cef9c31c939eef27dee06c5bde4..414ccd976fc14b4094e6e770954005c1392358ec 100644 --- a/src/os/linux/vm/os_linux.hpp +++ b/src/os/linux/vm/os_linux.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -209,39 +209,27 @@ class Linux { // for LinuxThreads are no longer needed. class SuspendResume { private: - volatile int _suspend_action; - // values for suspend_action: - #define SR_NONE (0x00) - #define SR_SUSPEND (0x01) // suspend request - #define SR_CONTINUE (0x02) // resume request - + volatile int _suspend_action; volatile jint _state; - // values for _state: + SR_NONE - #define SR_SUSPENDED (0x20) public: + // values for suspend_action: + enum { + SR_NONE = 0x00, + SR_SUSPEND = 0x01, // suspend request + SR_CONTINUE = 0x02, // resume request + SR_SUSPENDED = 0x20 // values for _state: + SR_NONE + }; + SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } int suspend_action() const { return _suspend_action; } void set_suspend_action(int x) { _suspend_action = x; } // atomic updates for _state - void set_suspended() { - jint temp, temp2; - do { - temp = _state; - temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); - } while (temp2 != temp); - } - void clear_suspended() { - jint temp, temp2; - do { - temp = _state; - temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); - } while (temp2 != temp); - } + inline void set_suspended(); + inline void clear_suspended(); bool is_suspended() { return _state & SR_SUSPENDED; } - #undef SR_SUSPENDED }; private: diff --git a/src/os/linux/vm/os_linux.inline.hpp b/src/os/linux/vm/os_linux.inline.hpp index 3a8d8d97d9bad8ebb01a7ac007d9598073a0e65a..87494dfd96fc986c4ff6d1e1637bb27a30d67868 100644 --- a/src/os/linux/vm/os_linux.inline.hpp +++ b/src/os/linux/vm/os_linux.inline.hpp @@ -25,7 +25,6 @@ #ifndef OS_LINUX_VM_OS_LINUX_INLINE_HPP #define OS_LINUX_VM_OS_LINUX_INLINE_HPP -#include "runtime/atomic.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/os.hpp" @@ -288,4 +287,21 @@ inline int os::set_sock_opt(int fd, int level, int optname, const char* optval, socklen_t optlen) { return ::setsockopt(fd, level, optname, optval, optlen); } + +inline void os::Linux::SuspendResume::set_suspended() { + jint temp, temp2; + do { + temp = _state; + temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); + } while (temp2 != temp); +} + +inline void os::Linux::SuspendResume::clear_suspended() { + jint temp, temp2; + do { + temp = _state; + temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); + } while (temp2 != temp); +} + #endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP diff --git a/src/os/solaris/vm/os_solaris.inline.hpp b/src/os/solaris/vm/os_solaris.inline.hpp index 61691fd384a58005532be35853f5c5d717360dde..64515d93b91e0065b697e0ba76502fef29043ee1 100644 --- a/src/os/solaris/vm/os_solaris.inline.hpp +++ b/src/os/solaris/vm/os_solaris.inline.hpp @@ -25,7 +25,6 @@ #ifndef OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP #define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP -#include "runtime/atomic.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/os.hpp" diff --git a/src/os/windows/vm/decoder_windows.cpp b/src/os/windows/vm/decoder_windows.cpp index 2b4682728a2a142af7a7a1e5072c09eee47df16a..326d328802031814c0d33e21d3cae1fe409960f8 100644 --- a/src/os/windows/vm/decoder_windows.cpp +++ b/src/os/windows/vm/decoder_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "prims/jvm.h" +#include "runtime/arguments.hpp" #include "decoder_windows.hpp" WindowsDecoder::WindowsDecoder() { diff --git a/src/os/windows/vm/os_windows.inline.hpp b/src/os/windows/vm/os_windows.inline.hpp index 1df8694d9dd773c8f57a77a3b3b57c736d2942a0..5b1c46dfc59959c8b5deb5cee98eb3a056180e43 100644 --- a/src/os/windows/vm/os_windows.inline.hpp +++ b/src/os/windows/vm/os_windows.inline.hpp @@ -25,7 +25,6 @@ #ifndef OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP #define OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP -#include "runtime/atomic.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/os.hpp" diff --git a/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp b/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp index aa47196191a88e02eabb09ecf3e38d6cddd9024d..ab7fab3dd13a6bd8964e3a38cb37c6841f758201 100644 --- a/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp +++ b/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ #ifndef OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP #define OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP -#include "orderAccess_bsd_x86.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_x86.hpp" diff --git a/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp b/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp index eaecd9cd32fc9e3ac0f6ecfbbd151889c16df788..0ac6d3093f8241128d71bd6925847c1855bec494 100644 --- a/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp +++ b/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,9 @@ #ifndef OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP #define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP -#include "runtime/atomic.hpp" +#include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" +#include "runtime/os.hpp" #include "vm_version_x86.hpp" // Implementation of class OrderAccess. diff --git a/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp b/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp index 19027bd150b4d8577a7006b1150a55df26577b11..4ed2934463b8c6573575e6e225cb8c7dbc00c052 100644 --- a/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp +++ b/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -26,7 +26,6 @@ #ifndef OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP #define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP -#include "orderAccess_bsd_zero.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_zero.hpp" diff --git a/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp b/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp index a409f27b4223729224db87b1f2d185fd67593253..fa31a50c3278ba60552c371c65b0d800e12980ab 100644 --- a/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp +++ b/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ #ifndef OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP #define OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP -#include "orderAccess_linux_sparc.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_sparc.hpp" diff --git a/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp b/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp index 7ec3dace4b14244c58e833250217728c62692163..2d0d51973444ff5c65c7ae4ae3371517d8de2f40 100644 --- a/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp +++ b/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ #ifndef OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP #define OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP -#include "orderAccess_linux_x86.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_x86.hpp" diff --git a/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp b/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp index 6f33e12e0816ebbaa0990bb7a02dc25ecf5b41d9..7a9fd1a44133bab5246dc7962c3117b850514792 100644 --- a/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp +++ b/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,9 @@ #ifndef OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP #define OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP -#include "runtime/atomic.hpp" +#include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" +#include "runtime/os.hpp" #include "vm_version_x86.hpp" // Implementation of class OrderAccess. diff --git a/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp b/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp index 9bee2332f870b7b19fdfae12fdc038631f21a008..33ce50dc73f9bd7115f7ef3d77d87e2da4a748bc 100644 --- a/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp +++ b/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -26,7 +26,6 @@ #ifndef OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP #define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP -#include "orderAccess_linux_zero.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_zero.hpp" diff --git a/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp b/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp index 0d91eb967d523291e1e805e30b331224f32da29b..b91214748c2b77110ea46c6aba0f2d8cc9aecc40 100644 --- a/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp +++ b/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ #ifndef OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP #define OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP -#include "orderAccess_solaris_sparc.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_sparc.hpp" diff --git a/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp b/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp index 8f3e781e67478dfaa66663aacf7ca8d0a372c23c..7e633fd95cbbe82bef0d18eb3c2cfe812df76b20 100644 --- a/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp +++ b/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #ifndef OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP #define OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP +#include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" #include "vm_version_sparc.hpp" diff --git a/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp b/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp index d91812db9c6d4b20133ace44129b9bf020aae3fc..27c0d396b723cb5b091d6eef77a1e7babd3c8ee9 100644 --- a/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp +++ b/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ #ifndef OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP #define OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP -#include "orderAccess_solaris_x86.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_x86.hpp" diff --git a/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp b/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp index 5b5445da51217fee08ec0a087ac22bdd83d93c03..c02d98ed991bca69280f1bfcb758eebcefe38490 100644 --- a/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp +++ b/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #ifndef OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP #define OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP -#include "runtime/atomic.hpp" +#include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" #include "vm_version_x86.hpp" diff --git a/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp b/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp index 37d2879662e9c349f1b5d68b117f6402411e1e3a..7ba00f7aaebd60716cde4f79dcb55cc5af40e020 100644 --- a/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp +++ b/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ #ifndef OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP #define OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP -#include "orderAccess_windows_x86.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/os.hpp" #include "vm_version_x86.hpp" diff --git a/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp b/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp index 682990dc6b7d84269713875f54a158248f27240f..639b8ad9d9d85158ed542f0f442a7c715e61a73e 100644 --- a/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp +++ b/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ #ifndef OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP #define OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP -#include "runtime/atomic.hpp" +#include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.hpp" +#include "runtime/os.hpp" #include "vm_version_x86.hpp" -#pragma warning(disable: 4035) // Disables warnings reporting missing return statement - // Implementation of class OrderAccess. inline void OrderAccess::loadload() { acquire(); } @@ -214,6 +213,4 @@ inline void OrderAccess::release_store_ptr_fence(volatile void* p, void* #endif // AMD64 } -#pragma warning(default: 4035) // Enables warnings reporting missing return statement - #endif // OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP diff --git a/src/share/vm/memory/allocation.inline.hpp b/src/share/vm/memory/allocation.inline.hpp index ead6fb12b214d8a3193d7316ca178a8b27d9e063..6c236e17b7a2c3f131b4c34786ca844b927f7e43 100644 --- a/src/share/vm/memory/allocation.inline.hpp +++ b/src/share/vm/memory/allocation.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #ifndef SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP #define SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP +#include "runtime/atomic.inline.hpp" #include "runtime/os.hpp" // Explicit C-heap memory management diff --git a/src/share/vm/oops/symbol.cpp b/src/share/vm/oops/symbol.cpp index 54601899287f676bbc3939bb7f1b4d13c304f7aa..b3c71813bdb5375aaa5ebc9678c20825b263ad37 100644 --- a/src/share/vm/oops/symbol.cpp +++ b/src/share/vm/oops/symbol.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ #include "classfile/altHashing.hpp" #include "classfile/classLoaderData.hpp" #include "oops/symbol.hpp" +#include "runtime/atomic.inline.hpp" #include "runtime/os.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" @@ -210,6 +211,28 @@ unsigned int Symbol::new_hash(jint seed) { return AltHashing::murmur3_32(seed, (const jbyte*)as_C_string(), utf8_length()); } +void Symbol::increment_refcount() { + // Only increment the refcount if positive. If negative either + // overflow has occurred or it is a permanent symbol in a read only + // shared archive. + if (_refcount >= 0) { + Atomic::inc(&_refcount); + NOT_PRODUCT(Atomic::inc(&_total_count);) + } +} + +void Symbol::decrement_refcount() { + if (_refcount >= 0) { + Atomic::dec(&_refcount); +#ifdef ASSERT + if (_refcount < 0) { + print(); + assert(false, "reference count underflow for symbol"); + } +#endif + } +} + void Symbol::print_on(outputStream* st) const { if (this == NULL) { st->print_cr("NULL"); diff --git a/src/share/vm/oops/symbol.hpp b/src/share/vm/oops/symbol.hpp index 55867d2b00753fcc77a741c555cf85b99d3eb097..d06edf052fc57bb7618380f9c882678ece5204bb 100644 --- a/src/share/vm/oops/symbol.hpp +++ b/src/share/vm/oops/symbol.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ #include "utilities/utf8.hpp" #include "memory/allocation.hpp" -#include "runtime/atomic.hpp" // A Symbol is a canonicalized string. // All Symbols reside in global SymbolTable and are reference counted. @@ -150,8 +149,8 @@ class Symbol : public MetaspaceObj { // Reference counting. See comments above this class for when to use. int refcount() const { return _refcount; } - inline void increment_refcount(); - inline void decrement_refcount(); + void increment_refcount(); + void decrement_refcount(); int byte_at(int index) const { assert(index >=0 && index < _length, "symbol index overflow"); @@ -232,26 +231,4 @@ int Symbol::fast_compare(Symbol* other) const { return (((uintptr_t)this < (uintptr_t)other) ? -1 : ((uintptr_t)this == (uintptr_t) other) ? 0 : 1); } - -inline void Symbol::increment_refcount() { - // Only increment the refcount if positive. If negative either - // overflow has occurred or it is a permanent symbol in a read only - // shared archive. - if (_refcount >= 0) { - Atomic::inc(&_refcount); - NOT_PRODUCT(Atomic::inc(&_total_count);) - } -} - -inline void Symbol::decrement_refcount() { - if (_refcount >= 0) { - Atomic::dec(&_refcount); -#ifdef ASSERT - if (_refcount < 0) { - print(); - assert(false, "reference count underflow for symbol"); - } -#endif - } -} #endif // SHARE_VM_OOPS_SYMBOL_HPP