Thu, 19 Jun 2014 13:31:14 +0200
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
Reviewed-by: jwilhelm, ehelin, tschatzl
brutisso@6904 | 1 | /* |
brutisso@6904 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
brutisso@6904 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
brutisso@6904 | 4 | * |
brutisso@6904 | 5 | * This code is free software; you can redistribute it and/or modify it |
brutisso@6904 | 6 | * under the terms of the GNU General Public License version 2 only, as |
brutisso@6904 | 7 | * published by the Free Software Foundation. |
brutisso@6904 | 8 | * |
brutisso@6904 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
brutisso@6904 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
brutisso@6904 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
brutisso@6904 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
brutisso@6904 | 13 | * accompanied this code). |
brutisso@6904 | 14 | * |
brutisso@6904 | 15 | * You should have received a copy of the GNU General Public License version |
brutisso@6904 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
brutisso@6904 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
brutisso@6904 | 18 | * |
brutisso@6904 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
brutisso@6904 | 20 | * or visit www.oracle.com if you need additional information or have any |
brutisso@6904 | 21 | * questions. |
brutisso@6904 | 22 | * |
brutisso@6904 | 23 | */ |
brutisso@6904 | 24 | |
brutisso@6904 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCID_HPP |
brutisso@6904 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCID_HPP |
brutisso@6904 | 27 | |
brutisso@6904 | 28 | #include "memory/allocation.hpp" |
brutisso@6904 | 29 | |
brutisso@6904 | 30 | class GCId VALUE_OBJ_CLASS_SPEC { |
brutisso@6904 | 31 | private: |
brutisso@6904 | 32 | uint _id; |
brutisso@6904 | 33 | GCId(uint id) : _id(id) {} |
brutisso@6904 | 34 | GCId() { } // Unused |
brutisso@6904 | 35 | |
brutisso@6904 | 36 | static uint _next_id; |
brutisso@6904 | 37 | static const uint UNDEFINED = (uint)-1; |
brutisso@6904 | 38 | |
brutisso@6904 | 39 | public: |
brutisso@6904 | 40 | uint id() const { |
brutisso@6904 | 41 | assert(_id != UNDEFINED, "Using undefined GC ID"); |
brutisso@6904 | 42 | return _id; |
brutisso@6904 | 43 | } |
brutisso@6904 | 44 | bool is_undefined() const; |
brutisso@6904 | 45 | |
brutisso@6904 | 46 | static const GCId create(); |
brutisso@6904 | 47 | static const GCId peek(); |
brutisso@6904 | 48 | static const GCId undefined(); |
brutisso@6904 | 49 | }; |
brutisso@6904 | 50 | |
brutisso@6904 | 51 | #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCID_HPP |