5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 // Simple TaskQueue stats that are collected by default in debug builds. 26 27 #if !defined(TASKQUEUE_STATS) && defined(ASSERT) 28 #define TASKQUEUE_STATS 1 29 #elif !defined(TASKQUEUE_STATS) 30 #define TASKQUEUE_STATS 0 31 #endif 32 33 #if TASKQUEUE_STATS 34 #define TASKQUEUE_STATS_ONLY(code) code 35 #else 36 #define TASKQUEUE_STATS_ONLY(code) 37 #endif // TASKQUEUE_STATS 38 39 #if TASKQUEUE_STATS 40 class TaskQueueStats { 41 public: 42 enum StatId { 43 push, // number of taskqueue pushes 44 pop, // number of taskqueue pops 765 766 inline oop obj() const { return _obj; } 767 inline int index() const { return _index; } 768 769 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid. 770 771 private: 772 oop _obj; 773 int _index; 774 }; 775 776 #ifdef _MSC_VER 777 #pragma warning(pop) 778 #endif 779 780 typedef OverflowTaskQueue<StarTask> OopStarTaskQueue; 781 typedef GenericTaskQueueSet<OopStarTaskQueue> OopStarTaskQueueSet; 782 783 typedef OverflowTaskQueue<size_t> RegionTaskQueue; 784 typedef GenericTaskQueueSet<RegionTaskQueue> RegionTaskQueueSet; | 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_UTILITIES_TASKQUEUE_HPP 26 #define SHARE_VM_UTILITIES_TASKQUEUE_HPP 27 28 #include "memory/allocation.hpp" 29 #include "memory/allocation.inline.hpp" 30 #include "runtime/mutex.hpp" 31 #ifdef TARGET_OS_ARCH_linux_x86 32 # include "orderAccess_linux_x86.inline.hpp" 33 #endif 34 #ifdef TARGET_OS_ARCH_linux_sparc 35 # include "orderAccess_linux_sparc.inline.hpp" 36 #endif 37 #ifdef TARGET_OS_ARCH_linux_zero 38 # include "orderAccess_linux_zero.inline.hpp" 39 #endif 40 #ifdef TARGET_OS_ARCH_solaris_x86 41 # include "orderAccess_solaris_x86.inline.hpp" 42 #endif 43 #ifdef TARGET_OS_ARCH_solaris_sparc 44 # include "orderAccess_solaris_sparc.inline.hpp" 45 #endif 46 #ifdef TARGET_OS_ARCH_windows_x86 47 # include "orderAccess_windows_x86.inline.hpp" 48 #endif 49 50 // Simple TaskQueue stats that are collected by default in debug builds. 51 52 #if !defined(TASKQUEUE_STATS) && defined(ASSERT) 53 #define TASKQUEUE_STATS 1 54 #elif !defined(TASKQUEUE_STATS) 55 #define TASKQUEUE_STATS 0 56 #endif 57 58 #if TASKQUEUE_STATS 59 #define TASKQUEUE_STATS_ONLY(code) code 60 #else 61 #define TASKQUEUE_STATS_ONLY(code) 62 #endif // TASKQUEUE_STATS 63 64 #if TASKQUEUE_STATS 65 class TaskQueueStats { 66 public: 67 enum StatId { 68 push, // number of taskqueue pushes 69 pop, // number of taskqueue pops 790 791 inline oop obj() const { return _obj; } 792 inline int index() const { return _index; } 793 794 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid. 795 796 private: 797 oop _obj; 798 int _index; 799 }; 800 801 #ifdef _MSC_VER 802 #pragma warning(pop) 803 #endif 804 805 typedef OverflowTaskQueue<StarTask> OopStarTaskQueue; 806 typedef GenericTaskQueueSet<OopStarTaskQueue> OopStarTaskQueueSet; 807 808 typedef OverflowTaskQueue<size_t> RegionTaskQueue; 809 typedef GenericTaskQueueSet<RegionTaskQueue> RegionTaskQueueSet; 810 811 #endif // SHARE_VM_UTILITIES_TASKQUEUE_HPP |