vmStructs.cpp revision 989
553N/A * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 553N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A#
include "incls/_precompiled.incl" 0N/A// Note: the cross-product of (c1, c2, product, nonproduct, ...), 0N/A// (nonstatic, static), and (unchecked, checked) has not been taken. 0N/A// Only the macros currently needed have been defined. 0N/A// A field whose type is not checked is given a null string as the 0N/A// type name, indicating an "opaque" type to the serviceability agent. 0N/A// NOTE: there is an interdependency between this file and 0N/A// whole purpose of this function is to work around bug c++/27724 in gcc 4.1.1 0N/A// with optimization turned on it doesn't affect produced code 0N/A//-------------------------------------------------------------------------------- 0N/A// This list enumerates all of the fields the serviceability agent 0N/A// needs to know about. Be sure to see also the type table below this one. 0N/A// NOTE that there are platform-specific additions to this table in 0N/A// vmStructs_<os>_<cpu>.hpp. 0N/A /******************************************************************/ \
0N/A /* OopDesc and Klass hierarchies (NOTE: methodDataOop incomplete) */ \
0N/A /******************************************************************/ \
/***********************/ \
/* Constant Pool Cache */ \
/***********************/ \
/********************************/ \
/* MethodOop-related structures */ \
/********************************/ \
/**********************************************************************************/ \
/* Generation and Space hierarchies */ \
/**********************************************************************************/ \
/************************/ \
/* PerfMemory - jvmstat */ \
/************************/ \
/**************************/ \
/* ProctectionDomainEntry */ \
/**************************/ \
/*************************/ \
/* LoaderConstraintEntry */ \
/*************************/ \
/********************************/ \
/* CodeCache (NOTE: incomplete) */ \
/********************************/ \
/*******************************/ \
/* CodeHeap (NOTE: incomplete) */ \
/*******************************/ \
/**********************************/ \
/* Interpreter (NOTE: incomplete) */ \
/**********************************/ \
/****************************/ \
/* Stubs (NOTE: incomplete) */ \
/****************************/ \
/***********************************/ \
/* StubRoutines (NOTE: incomplete) */ \
/***********************************/ \
/***************************************/ \
/* PcDesc and other compiled code info */ \
/***************************************/ \
/***************************************************/ \
/* CodeBlobs (NOTE: incomplete, but only a little) */ \
/***************************************************/ \
/**************************************************/ \
/* NMethods (NOTE: incomplete, but only a little) */ \
/**************************************************/ \
/********************************/ \
/* JavaCalls (NOTE: incomplete) */ \
/********************************/ \
/********************************/ \
/* JavaFrameAnchor (NOTE: incomplete) */ \
/********************************/ \
/******************************/ \
/* Threads (NOTE: incomplete) */ \
/******************************/ \
/************************/ \
/* OopMap and OopMapSet */ \
/************************/ \
/*********************************/ \
/* JNIHandles and JNIHandleBlock */ \
/*********************************/ \
/*********************************/ \
/* VMRegImpl (NOTE: incomplete) */ \
/*********************************/ \
/*******************************/ \
/* Runtime1 (NOTE: incomplete) */ \
/*******************************/ \
/*********************/ \
/* Matcher (C2 only) */ \
/*********************/ \
/*********************/ \
/*********************/ \
/*************************/ \
/* JDK / VM version info */ \
/*************************/ \
/************************/ \
/* Miscellaneous fields */ \
/************************/ \
/* NOTE that we do not use the last_entry() macro here; it is used */ /* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must */ //-------------------------------------------------------------------------------- // This list must enumerate at least all of the types in the above // list. For the types in the above list, the entry below must have // exactly the same spacing since string comparisons are done in the // code which verifies the consistency of these tables (in the debug // In addition to the above types, this list is required to enumerate // the JNI's java types, which are used to indicate the size of Java // fields in this VM to the SA. Further, oop types are currently // distinguished by name (i.e., ends with "oop") over in the SA. // The declare_toplevel_type macro should be used to declare types // which do not have a superclass. // The declare_integer_type and declare_unsigned_integer_type macros // are required in order to properly identify C integer types over in // the SA. They should be used for any type which is otherwise opaque // and which it is necessary to coerce into an integer value. This // includes, for example, the type uintptr_t. Note that while they // will properly identify the type's size regardless of the platform, // since it is does not seem possible to deduce or check signedness at // compile time using the pointer comparison tricks, it is currently // required that the given types have the same signedness across all // NOTE that there are platform-specific additions to this table in // vmStructs_<os>_<cpu>.hpp. /*************************************************************/ \
/* Java primitive types -- required by the SA implementation */ \
/* in order to determine the size of Java fields in this VM */ \
/* (the implementation looks up these names specifically) */ \
/* NOTE: since we fetch these sizes from the remote VM, we */ \
/* have a bootstrapping sequence during which it is not */ \
/* valid to fetch Java values from the remote process, only */ \
/* C integer values (of known size). NOTE also that we do */ \
/* NOT include "Java unsigned" types like juint here; since */ \
/* Java does not have unsigned primitive types, those can */ \
/* not be mapped directly and are considered to be C integer */ \
/* types in this system (see the "other types" section, */ \
/*************************************************************/ \
/*********************************************************************/ \
/* C integer types. User-defined typedefs (like "size_t" or */ \
/* "intptr_t") are guaranteed to be present with the same names over */ \
/* in the SA's type database. Names like "unsigned short" are not */ \
/* guaranteed to be visible through the SA's type database lookup */ \
/* mechanism, though they will have a Type object created for them */ \
/* and are valid types for Fields. */ \
/*********************************************************************/ \
/* The compiler thinks this is a different type than */ \
/* unsigned short on Win32 */ \
/*****************************/ \
/* C primitive pointer types */ \
/*****************************/ \
/*******************************************************************/ \
/* Types which it will be handy to have available over in the SA */ \
/* in order to do platform-independent address -> integer coercion */ \
/* (note: these will be looked up by name) */ \
/*******************************************************************/ \
/*******************************************************************************/ \
/* OopDesc and Klass hierarchies (NOTE: missing methodDataOop-related classes) */ \
/*******************************************************************************/ \
/*************************************/ \
/* MethodOop-related data structures */ \
/*************************************/ \
/******************************************/ \
/* Generation and space hierarchies */ \
/* (needed for run-time type information) */ \
/******************************************/ \
/* Miscellaneous other GC types */ \
/* Pointers to Garbage Collection types */ \
/************************/ \
/* PerfMemory - jvmstat */ \
/************************/ \
/*********************************/ \
/* SymbolTable, SystemDictionary */ \
/*********************************/ \
/***********************************************************/ \
/* Thread hierarchy (needed for run-time type information) */ \
/***********************************************************/ \
/*************************************************************/ \
/* CodeBlob hierarchy (needed for run-time type information) */ \
/*************************************************************/ \
/***************************************/ \
/* PcDesc and other compiled code info */ \
/***************************************/ \
/************************/ \
/* OopMap and OopMapSet */ \
/************************/ \
/*********************************/ \
/* JNIHandles and JNIHandleBlock */ \
/*********************************/ \
/**********************/ \
/* Runtime1 (C1 only) */ \
/**********************/ \
/*********************/ \
/* Matcher (C2 only) */ \
/*********************/ \
/* NOTE: this is not really a toplevel type, but we only need */ \
/* this one -- FIXME later if necessary */ \
/*********************/ \
/* Adapter Blob Entries */ \
/*********************/ \
/* NOTE that we do not use the last_entry() macro here; it is used */ /* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must be */ //-------------------------------------------------------------------------------- // This table contains integer constants required over in the // serviceability agent. The "declare_constant" macro is used for all // enums, etc., while "declare_preprocessor_constant" must be used for // all #defined constants. /********************************************/ \
/* Generation and Space Hierarchy Constants */ \
/********************************************/ \
/* constants from Generation::Name enum */ \
/* constants from PermGen::Name enum */ \
/************************/ \
/* PerfMemory - jvmstat */ \
/************************/ \
/***********************************/ \
/* LoaderConstraintTable constants */ \
/***********************************/ \
/************************************************************/ \
/* HotSpot specific JVM_ACC constants from global anon enum */ \
/************************************************************/ \
/*****************************/ \
/* Thread::SuspendFlags enum */ \
/*****************************/ \
/******************************/ \
/* Klass misc. enum constants */ \
/******************************/ \
/********************************/ \
/* constMethodOopDesc anon-enum */ \
/********************************/ \
/*************************************/ \
/* instanceKlass FieldOffset enum */ \
/*************************************/ \
/************************************************/ \
/* instanceKlass InnerClassAttributeOffset enum */ \
/************************************************/ \
/*********************************/ \
/* instanceKlass ClassState enum */ \
/*********************************/ \
/*********************************/ \
/* symbolOop - symbol max length */ \
/*********************************/ \
/*********************************************/ \
/* ConstantPoolCacheEntry FlagBitValues enum */ \
/*********************************************/ \
/******************************************/ \
/* ConstantPoolCacheEntry FlagValues enum */ \
/******************************************/ \
/*********************************/ \
/* java_lang_Class field offsets */ \
/*********************************/ \
/***************************************/ \
/* java_lang_Thread::ThreadStatus enum */ \
/***************************************/ \
/******************************/ \
/******************************/ \
/* constants from Location::Type enum */ \
/* constants from Location::Where enum */ \
/*********************/ \
/* Matcher (C2 only) */ \
/*********************/ \
/*********************************************/ \
/*********************************************/ \
/**********************/ \
/* ObjectSynchronizer */ \
/**********************/ \
/********************************/ \
/* Calling convention constants */ \
/********************************/ \
/* NOTE that we do not use the last_entry() macro here; it is used */ /* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and */ /* must be present there) */ //-------------------------------------------------------------------------------- // This table contains long constants required over in the // serviceability agent. The "declare_constant" macro is used for all // enums, etc., while "declare_preprocessor_constant" must be used for // all #defined constants. /*********************/ \
/* MarkOop constants */ \
/*********************/ \
/* Note: some of these are declared as long constants just for */ \
/* consistency. The mask constants are the only ones requiring */ \
/* 64 bits (on 64-bit platforms). */ \
/* Constants in markOop used by CMS. */ \
/* NOTE that we do not use the last_entry() macro here; it is used */ /* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and */ /* must be present there) */ //-------------------------------------------------------------------------------- // Macros operating on the above lists //-------------------------------------------------------------------------------- // This utility macro quotes the passed string //-------------------------------------------------------------------------------- // This macro generates a VMStructEntry line for a nonstatic field // This macro generates a VMStructEntry line for a static field // This macro generates a VMStructEntry line for an unchecked // nonstatic field, in which the size of the type is also specified. // The type string is given as NULL, indicating an "opaque" type. // This macro generates a VMStructEntry line for an unchecked // static field, in which the size of the type is also specified. // The type string is given as NULL, indicating an "opaque" type. // This macro generates the sentinel value indicating the end of the list // This macro checks the type of a VMStructEntry by comparing pointer types // This macro checks the type of a volatile VMStructEntry by comparing pointer types // This macro checks the type of a VMStructEntry by comparing pointer types // This macro ensures the type of a field and its containing type are // present in the type table. The assertion string is shorter than // preferable because (incredibly) of a bug in Solstice NFS client // which seems to prevent very long lines from compiling. This assertion // means that an entry in VMStructs::localHotSpotVMStructs[] was not // found in VMStructs::localHotSpotVMTypes[]. // This is a no-op macro for unchecked fields // This is a no-op macro for the sentinel value // Build-specific macros: // Generate and check a nonstatic field in non-product builds // Generate and check a nonstatic field in C1 builds // Generate and check a nonstatic field in C2 builds // Generate but do not check a static field in C1 builds // Generate but do not check a static field in C2 builds //-------------------------------------------------------------------------------- // Build-specific macros: //-------------------------------------------------------------------------------- // VMIntConstantEntry macros // This macro generates the sentinel value indicating the end of the list // Generate an int constant for a C1 build // Generate an int constant for a C2 build //-------------------------------------------------------------------------------- // VMLongConstantEntry macros // This macro generates the sentinel value indicating the end of the list // Generate a long constant for a C1 build // Generate a long constant for a C2 build // Instantiation of VMStructEntries, VMTypeEntries and VMIntConstantEntries // These initializers are allowed to access private fields in classes // as long as class VMStructs is a friend // This is used both to check the types of referenced fields and, in // debug builds, to ensure that all of the field types are present. // Split VM_STRUCTS() invocation into two parts to allow MS VC++ 6.0 // to build with the source mounted over SNC3.2. Symptom was that // debug build failed with an internal compiler error. Has been seen // mounting sources from Solaris 2.6 and 2.7 hosts, but so far not // 2.8 hosts. Appears to occur because line is too long. // If an assertion failure is triggered here it means that an entry // in VMStructs::localHotSpotVMStructs[] was not found in // VMStructs::localHotSpotVMTypes[]. (The assertion itself had to be // made less descriptive because of this above bug -- see the // definition of ENSURE_FIELD_TYPE_PRESENT.) // NOTE: taken out because this was just not working on everyone's // Solstice NFS setup. If everyone switches to local workspaces on // Win32, we can put this back in. // see comments on cast_uint64_t at the top of this file