src/hotspot/share/memory/metaspace/metaspaceEnums.hpp
author stuefe
Tue, 26 Nov 2019 16:21:29 +0100
branchstuefe-new-metaspace-branch
changeset 59272 54750b448264
parent 58063 bdf136b8ae0e
permissions -rw-r--r--
Metadatatype back to metaspace.hpp to reduce patch size
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     1
/*
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     2
 * Copyright (c) 2019, SAP SE. All rights reserved.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     3
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     5
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     8
 * published by the Free Software Foundation.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
     9
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    14
 * accompanied this code).
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    15
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    19
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    22
 * questions.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    23
 *
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    24
 */
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    25
#ifndef SHARE_MEMORY_METASPACEENUMS_HPP
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    26
#define SHARE_MEMORY_METASPACEENUMS_HPP
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    27
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    28
#include "memory/metaspace.hpp"
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    29
#include "utilities/debug.hpp"
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    30
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    31
// MetadataType and MetaspaceType, as well as some convenience functions surrounding them.
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    32
namespace metaspace {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    33
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    34
///////////////////////
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    35
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    36
/* Moved to metaspace.hpp to keep diff in non-metaspace coding
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    37
 * small. Would like to have this here and in metaspace:: namespace,
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    38
 * eventually.
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    39
 *
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    40
 * enum MetadataType {
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    41
 *  ClassType,
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    42
 *  NonClassType,
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    43
 *  MetadataTypeCount
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    44
 * };
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    45
 */
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    46
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    47
inline bool is_class(Metaspace::MetadataType md) { return md == Metaspace::ClassType; }
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    48
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    49
inline Metaspace::MetadataType mdtype_from_bool(bool is_class) { return is_class ? Metaspace::ClassType : Metaspace::NonClassType; }
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    50
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    51
const char* describe_mdtype(Metaspace::MetadataType md);
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    52
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    53
#ifdef ASSERT
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    54
inline bool is_valid_mdtype(Metaspace::MetadataType md) {
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    55
  return (int)md >= 0 && (int)md < Metaspace::MetadataTypeCount;
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    56
}
59272
54750b448264 Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents: 58063
diff changeset
    57
inline void check_valid_mdtype(Metaspace::MetadataType md) {
58063
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    58
  assert(is_valid_mdtype(md), "Wrong value for MetadataType: %d", (int) md);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    59
}
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    60
#endif // ASSERT
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    61
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    62
///////////////////////
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    63
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    64
enum MetaspaceType {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    65
  ZeroMetaspaceType = 0,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    66
  StandardMetaspaceType = ZeroMetaspaceType,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    67
  BootMetaspaceType = StandardMetaspaceType + 1,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    68
  UnsafeAnonymousMetaspaceType = BootMetaspaceType + 1,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    69
  ReflectionMetaspaceType = UnsafeAnonymousMetaspaceType + 1,
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    70
  MetaspaceTypeCount
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    71
};
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    72
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    73
const char* describe_spacetype(MetaspaceType st);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    74
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    75
#ifdef ASSERT
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    76
inline bool is_valid_spacetype(MetaspaceType st) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    77
  return (int)st >= 0 && (int)st < MetaspaceTypeCount;
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    78
}
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    79
inline void check_valid_spacetype(MetaspaceType st) {
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    80
  assert(is_valid_spacetype(st), "Wrong value for MetaspaceType: %d", (int) st);
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    81
}
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    82
#endif
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    83
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    84
} // namespace metaspace
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    85
bdf136b8ae0e Initial changes for new metaspace. Only tested for Linux x64.
stuefe
parents:
diff changeset
    86
#endif // SHARE_MEMORY_METASPACEENUMS_HPP