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 747 inline oop obj() const { return _obj; } 748 inline int index() const { return _index; } 749 750 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid. 751 752 private: 753 oop _obj; 754 int _index; 755 }; 756 757 #ifdef _MSC_VER 758 #pragma warning(pop) 759 #endif 760 761 typedef OverflowTaskQueue<StarTask> OopStarTaskQueue; 762 typedef GenericTaskQueueSet<OopStarTaskQueue> OopStarTaskQueueSet; 763 764 typedef OverflowTaskQueue<size_t> RegionTaskQueue; 765 typedef GenericTaskQueueSet<RegionTaskQueue> RegionTaskQueueSet; 766 | 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 #include "utilities/stack.hpp" 32 #ifdef TARGET_OS_ARCH_linux_x86 33 # include "orderAccess_linux_x86.inline.hpp" 34 #endif 35 #ifdef TARGET_OS_ARCH_linux_sparc 36 # include "orderAccess_linux_sparc.inline.hpp" 37 #endif 38 #ifdef TARGET_OS_ARCH_linux_zero 39 # include "orderAccess_linux_zero.inline.hpp" 40 #endif 41 #ifdef TARGET_OS_ARCH_solaris_x86 42 # include "orderAccess_solaris_x86.inline.hpp" 43 #endif 44 #ifdef TARGET_OS_ARCH_solaris_sparc 45 # include "orderAccess_solaris_sparc.inline.hpp" 46 #endif 47 #ifdef TARGET_OS_ARCH_windows_x86 48 # include "orderAccess_windows_x86.inline.hpp" 49 #endif 50 51 // Simple TaskQueue stats that are collected by default in debug builds. 52 53 #if !defined(TASKQUEUE_STATS) && defined(ASSERT) 54 #define TASKQUEUE_STATS 1 55 #elif !defined(TASKQUEUE_STATS) 56 #define TASKQUEUE_STATS 0 57 #endif 58 59 #if TASKQUEUE_STATS 60 #define TASKQUEUE_STATS_ONLY(code) code 61 #else 62 #define TASKQUEUE_STATS_ONLY(code) 63 #endif // TASKQUEUE_STATS 64 65 #if TASKQUEUE_STATS 66 class TaskQueueStats { 67 public: 68 enum StatId { 69 push, // number of taskqueue pushes 70 pop, // number of taskqueue pops 773 inline oop obj() const { return _obj; } 774 inline int index() const { return _index; } 775 776 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid. 777 778 private: 779 oop _obj; 780 int _index; 781 }; 782 783 #ifdef _MSC_VER 784 #pragma warning(pop) 785 #endif 786 787 typedef OverflowTaskQueue<StarTask> OopStarTaskQueue; 788 typedef GenericTaskQueueSet<OopStarTaskQueue> OopStarTaskQueueSet; 789 790 typedef OverflowTaskQueue<size_t> RegionTaskQueue; 791 typedef GenericTaskQueueSet<RegionTaskQueue> RegionTaskQueueSet; 792 793 794 #endif // SHARE_VM_UTILITIES_TASKQUEUE_HPP |