src/hotspot/share/runtime/vmStructs.hpp
author dholmes
Sat, 23 Jun 2018 01:32:41 -0400
changeset 50735 2f2af62dfac7
parent 47216 71c04702a3d5
child 51605 2ca553d34949
permissions -rw-r--r--
8010319: Implementation of JEP 181: Nest-Based Access Control Reviewed-by: alanb, psandoz, mchung, coleenp, acorn, mcimadamore, forax, jlahoda, sspitsyn, abuckley Contributed-by: alex.buckley@oracle.com, maurizio.mimadamore@oracle.com, mandy.chung@oracle.com, tobias.hartmann@oracle.com, david.holmes@oracle.com, vladimir.x.ivanov@oracle.com, karen.kinnear@oracle.com, vladimir.kozlov@oracle.com, john.r.rose@oracle.com, daniel.smith@oracle.com, serguei.spitsyn@oracle.com, kumardotsrinivasan@gmail.com, boris.ulasevich@bell-sw.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
46943
3cd94e2be178 8186443: Missing stdint.h for zero builds
glaubitz
parents: 46343
diff changeset
     2
 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_RUNTIME_VMSTRUCTS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_RUNTIME_VMSTRUCTS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "utilities/debug.hpp"
46943
3cd94e2be178 8186443: Missing stdint.h for zero builds
glaubitz
parents: 46343
diff changeset
    29
#include "utilities/globalDefinitions.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#ifdef COMPILER1
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "c1/c1_Runtime1.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// This table encapsulates the debugging information required by the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// serviceability agent in order to run. Specifically, we need to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// understand the layout of certain C data structures (offsets, in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// bytes, of their fields.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// There are alternatives for the design of this mechanism, including
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// parsing platform-specific debugging symbols from a debug build into
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// a program database. While this current mechanism can be considered
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// to be a workaround for the inability to debug arbitrary C and C++
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// programs at the present time, it does have certain advantages.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// First, it is platform-independent, which will vastly simplify the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// initial bringup of the system both now and on future platforms.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// Second, it is embedded within the VM, as opposed to being in a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// separate program database; experience has shown that whenever
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
// portions of a system are decoupled, version skew is problematic.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// Third, generating a program database, for example for a product
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// build, would probably require two builds to be done: the desired
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// product build as well as an intermediary build with the PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// flag turned on but also compiled with -g, leading to a doubling of
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// the time required to get a serviceability agent-debuggable product
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// build. Fourth, and very significantly, this table probably
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// preserves more information about field types than stabs do; for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// example, it preserves the fact that a field is a "jlong" rather
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// than transforming the type according to the typedef in jni_md.h,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// which allows the Java-side code to identify "Java-sized" fields in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
// C++ data structures. If the symbol parsing mechanism was redone
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
// using stabs, it might still be necessary to have a table somewhere
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// containing this information.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// Do not change the sizes or signedness of the integer values in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
// these data structures; they are fixed over in the serviceability
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
// agent's Java code (for bootstrapping).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
typedef struct {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  const char* typeName;            // The type name containing the given field (example: "Klass")
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  const char* fieldName;           // The field name within the type           (example: "_name")
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    70
  const char* typeString;          // Quoted name of the type of this field (example: "Symbol*";
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
                                   // parsed in Java to ensure type correctness
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  int32_t  isStatic;               // Indicates whether following field is an offset or an address
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  uint64_t offset;                 // Offset of field within structure; only used for nonstatic fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  void* address;                   // Address of field; only used for static fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
                                   // ("offset" can not be reused because of apparent SparcWorks compiler bug
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
                                   // in generation of initializer data)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
} VMStructEntry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
typedef struct {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    80
  const char* typeName;            // Type name (example: "Method")
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  const char* superclassName;      // Superclass name, or null if none (example: "oopDesc")
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    82
  int32_t isOopType;               // Does this type represent an oop typedef? (i.e., "Method*" or
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 8921
diff changeset
    83
                                   // "Klass*", but NOT "Method")
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  int32_t isIntegerType;           // Does this type represent an integer type (of arbitrary size)?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  int32_t isUnsigned;              // If so, is it unsigned?
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  uint64_t size;                   // Size, in bytes, of the type
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
} VMTypeEntry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
typedef struct {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  const char* name;                // Name of constant (example: "_thread_in_native")
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  int32_t value;                   // Value of constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
} VMIntConstantEntry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
typedef struct {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  const char* name;                // Name of constant (example: "_thread_in_native")
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  uint64_t value;                  // Value of constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
} VMLongConstantEntry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
    99
typedef struct {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   100
  const char* name;                // Name of address (example: "SharedRuntime::register_finalizer")
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   101
  void* value;                     // Value of address
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   102
} VMAddressEntry;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   103
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// This class is a friend of most classes, to be able to access
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// private fields
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
class VMStructs {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  // The last entry is identified over in the serviceability agent by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  // the fact that it has a NULL fieldName
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  static VMStructEntry localHotSpotVMStructs[];
46343
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   111
  // The function to get localHotSpotVMStructs length
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   112
  static size_t localHotSpotVMStructsLength();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // The last entry is identified over in the serviceability agent by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  // the fact that it has a NULL typeName
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  static VMTypeEntry   localHotSpotVMTypes[];
46343
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   117
  // The function to get localHotSpotVMTypes length
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   118
  static size_t localHotSpotVMTypesLength();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  // Table of integer constants required by the serviceability agent.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  // The last entry is identified over in the serviceability agent by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // the fact that it has a NULL typeName
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  static VMIntConstantEntry localHotSpotVMIntConstants[];
46343
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   124
  // The function to get localHotSpotVMIntConstants length
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   125
  static size_t localHotSpotVMIntConstantsLength();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // Table of long constants required by the serviceability agent.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // The last entry is identified over in the serviceability agent by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // the fact that it has a NULL typeName
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  static VMLongConstantEntry localHotSpotVMLongConstants[];
46343
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   131
  // The function to get localHotSpotVMIntConstants length
3c2650b86bf7 8171090: Convert VMStruct_test to GTest
kzhaldyb
parents: 35123
diff changeset
   132
  static size_t localHotSpotVMLongConstantsLength();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   134
  /**
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   135
   * Table of addresses.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   136
   */
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   137
  static VMAddressEntry localHotSpotVMAddresses[];
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 15432
diff changeset
   138
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // This is used to run any checking code necessary for validation of
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // the data structure (debug build only)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  static void init();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
14574
1193d3742872 8003879: Duplicate definitions in vmStructs
mikael
parents: 13728
diff changeset
   143
#ifndef PRODUCT
1193d3742872 8003879: Duplicate definitions in vmStructs
mikael
parents: 13728
diff changeset
   144
  // Execute unit tests
1193d3742872 8003879: Duplicate definitions in vmStructs
mikael
parents: 13728
diff changeset
   145
  static void test();
1193d3742872 8003879: Duplicate definitions in vmStructs
mikael
parents: 13728
diff changeset
   146
#endif
1193d3742872 8003879: Duplicate definitions in vmStructs
mikael
parents: 13728
diff changeset
   147
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  // Look up a type in localHotSpotVMTypes using strcmp() (debug build only).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  // Returns 1 if found, 0 if not.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  //  debug_only(static int findType(const char* typeName);)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  static int findType(const char* typeName);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   154
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   155
// This utility macro quotes the passed string
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   156
#define QUOTE(x) #x
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   157
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   158
//--------------------------------------------------------------------------------
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   159
// VMStructEntry macros
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   160
//
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   161
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   162
// This macro generates a VMStructEntry line for a nonstatic field
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   163
#define GENERATE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)              \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   164
 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 0, offset_of(typeName, fieldName), NULL },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   165
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   166
// This macro generates a VMStructEntry line for a static field
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   167
#define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                 \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   168
 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   169
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   170
// This macro generates a VMStructEntry line for a static pointer volatile field,
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   171
// e.g.: "static ObjectMonitor * volatile gBlockList;"
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   172
#define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type)    \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   173
 { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void *)&typeName::fieldName },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   174
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   175
// This macro generates a VMStructEntry line for an unchecked
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   176
// nonstatic field, in which the size of the type is also specified.
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   177
// The type string is given as NULL, indicating an "opaque" type.
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   178
#define GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, size)    \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   179
  { QUOTE(typeName), QUOTE(fieldName), NULL, 0, offset_of(typeName, fieldName), NULL },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   180
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   181
// This macro generates a VMStructEntry line for an unchecked
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   182
// static field, in which the size of the type is also specified.
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   183
// The type string is given as NULL, indicating an "opaque" type.
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   184
#define GENERATE_UNCHECKED_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, size)       \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   185
 { QUOTE(typeName), QUOTE(fieldName), NULL, 1, 0, (void*) &typeName::fieldName },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   186
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   187
// This macro generates the sentinel value indicating the end of the list
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   188
#define GENERATE_VM_STRUCT_LAST_ENTRY() \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   189
 { NULL, NULL, NULL, 0, 0, NULL }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   190
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   191
// This macro checks the type of a VMStructEntry by comparing pointer types
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   192
#define CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                 \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   193
 {typeName *dummyObj = NULL; type* dummy = &dummyObj->fieldName;                   \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   194
  assert(offset_of(typeName, fieldName) < sizeof(typeName), "Illegal nonstatic struct entry, field offset too large"); }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   195
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   196
// This macro checks the type of a volatile VMStructEntry by comparing pointer types
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   197
#define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)        \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   198
 {typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   199
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   200
// This macro checks the type of a static VMStructEntry by comparing pointer types
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   201
#define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                    \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   202
 {type* dummy = &typeName::fieldName; }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   203
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   204
// This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types,
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   205
// e.g.: "static ObjectMonitor * volatile gBlockList;"
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   206
#define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type)       \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   207
 {type volatile * dummy = &typeName::fieldName; }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   208
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   209
// This macro ensures the type of a field and its containing type are
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   210
// present in the type table. The assertion string is shorter than
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   211
// preferable because (incredibly) of a bug in Solstice NFS client
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   212
// which seems to prevent very long lines from compiling. This assertion
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   213
// means that an entry in VMStructs::localHotSpotVMStructs[] was not
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   214
// found in VMStructs::localHotSpotVMTypes[].
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   215
#define ENSURE_FIELD_TYPE_PRESENT(typeName, fieldName, type)                       \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   216
 { assert(findType(QUOTE(typeName)) != 0, "type \"" QUOTE(typeName) "\" not found in type table"); \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   217
   assert(findType(QUOTE(type)) != 0, "type \"" QUOTE(type) "\" not found in type table"); }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   218
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   219
// This is a no-op macro for unchecked fields
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   220
#define CHECK_NO_OP(a, b, c)
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   221
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   222
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   223
//--------------------------------------------------------------------------------
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   224
// VMTypeEntry macros
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   225
//
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   226
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   227
#define GENERATE_VM_TYPE_ENTRY(type, superclass) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   228
 { QUOTE(type), QUOTE(superclass), 0, 0, 0, sizeof(type) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   229
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   230
#define GENERATE_TOPLEVEL_VM_TYPE_ENTRY(type) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   231
 { QUOTE(type), NULL,              0, 0, 0, sizeof(type) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   232
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   233
#define GENERATE_OOP_VM_TYPE_ENTRY(type) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   234
 { QUOTE(type), NULL,              1, 0, 0, sizeof(type) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   235
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   236
#define GENERATE_INTEGER_VM_TYPE_ENTRY(type) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   237
 { QUOTE(type), NULL,              0, 1, 0, sizeof(type) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   238
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   239
#define GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY(type) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   240
 { QUOTE(type), NULL,              0, 1, 1, sizeof(type) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   241
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   242
#define GENERATE_VM_TYPE_LAST_ENTRY() \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   243
 { NULL, NULL, 0, 0, 0, 0 }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   244
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   245
#define CHECK_VM_TYPE_ENTRY(type, superclass) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   246
 { type* dummyObj = NULL; superclass* dummySuperObj = dummyObj; }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   247
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   248
#define CHECK_VM_TYPE_NO_OP(a)
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   249
#define CHECK_SINGLE_ARG_VM_TYPE_NO_OP(a)
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   250
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   251
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   252
//--------------------------------------------------------------------------------
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   253
// VMIntConstantEntry macros
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   254
//
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   255
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   256
#define GENERATE_VM_INT_CONSTANT_ENTRY(name) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   257
 { QUOTE(name), (int32_t) name },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   258
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   259
#define GENERATE_VM_INT_CONSTANT_WITH_VALUE_ENTRY(name, value) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   260
 { (name), (int32_t)(value) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   261
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   262
#define GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY(name, value) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   263
 { name, (int32_t) value },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   264
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   265
// This macro generates the sentinel value indicating the end of the list
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   266
#define GENERATE_VM_INT_CONSTANT_LAST_ENTRY() \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   267
 { NULL, 0 }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   268
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   269
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   270
//--------------------------------------------------------------------------------
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   271
// VMLongConstantEntry macros
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   272
//
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   273
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   274
#define GENERATE_VM_LONG_CONSTANT_ENTRY(name) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   275
  { QUOTE(name), name },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   276
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   277
#define GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY(name, value) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   278
  { name, value },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   279
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   280
// This macro generates the sentinel value indicating the end of the list
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   281
#define GENERATE_VM_LONG_CONSTANT_LAST_ENTRY() \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   282
 { NULL, 0 }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   283
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   284
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   285
//--------------------------------------------------------------------------------
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   286
// VMAddressEntry macros
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   287
//
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   288
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   289
#define GENERATE_VM_ADDRESS_ENTRY(name) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   290
  { QUOTE(name), (void*) (name) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   291
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   292
#define GENERATE_PREPROCESSOR_VM_ADDRESS_ENTRY(name, value) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   293
  { name, (void*) (value) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   294
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   295
#define GENERATE_VM_FUNCTION_ENTRY(name) \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   296
  { QUOTE(name), CAST_FROM_FN_PTR(void*, &(name)) },
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   297
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   298
// This macro generates the sentinel value indicating the end of the list
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   299
#define GENERATE_VM_ADDRESS_LAST_ENTRY() \
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   300
 { NULL, NULL }
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 33160
diff changeset
   301
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   302
#endif // SHARE_VM_RUNTIME_VMSTRUCTS_HPP