0N/A/*
4170N/A * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
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 *
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 *
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.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_RUNTIME_VMSTRUCTS_HPP
1879N/A#define SHARE_VM_RUNTIME_VMSTRUCTS_HPP
1879N/A
1879N/A#include "utilities/debug.hpp"
1879N/A#ifdef COMPILER1
1879N/A#include "c1/c1_Runtime1.hpp"
1879N/A#endif
1879N/A
0N/A// This table encapsulates the debugging information required by the
0N/A// serviceability agent in order to run. Specifically, we need to
0N/A// understand the layout of certain C data structures (offsets, in
0N/A// bytes, of their fields.)
0N/A//
0N/A// There are alternatives for the design of this mechanism, including
0N/A// parsing platform-specific debugging symbols from a debug build into
0N/A// a program database. While this current mechanism can be considered
0N/A// to be a workaround for the inability to debug arbitrary C and C++
0N/A// programs at the present time, it does have certain advantages.
0N/A// First, it is platform-independent, which will vastly simplify the
0N/A// initial bringup of the system both now and on future platforms.
0N/A// Second, it is embedded within the VM, as opposed to being in a
0N/A// separate program database; experience has shown that whenever
0N/A// portions of a system are decoupled, version skew is problematic.
0N/A// Third, generating a program database, for example for a product
0N/A// build, would probably require two builds to be done: the desired
0N/A// product build as well as an intermediary build with the PRODUCT
0N/A// flag turned on but also compiled with -g, leading to a doubling of
0N/A// the time required to get a serviceability agent-debuggable product
0N/A// build. Fourth, and very significantly, this table probably
0N/A// preserves more information about field types than stabs do; for
0N/A// example, it preserves the fact that a field is a "jlong" rather
0N/A// than transforming the type according to the typedef in jni_md.h,
0N/A// which allows the Java-side code to identify "Java-sized" fields in
0N/A// C++ data structures. If the symbol parsing mechanism was redone
0N/A// using stabs, it might still be necessary to have a table somewhere
0N/A// containing this information.
0N/A//
0N/A// Do not change the sizes or signedness of the integer values in
0N/A// these data structures; they are fixed over in the serviceability
0N/A// agent's Java code (for bootstrapping).
0N/A
0N/Atypedef struct {
0N/A const char* typeName; // The type name containing the given field (example: "Klass")
0N/A const char* fieldName; // The field name within the type (example: "_name")
2062N/A const char* typeString; // Quoted name of the type of this field (example: "Symbol*";
0N/A // parsed in Java to ensure type correctness
0N/A int32_t isStatic; // Indicates whether following field is an offset or an address
0N/A uint64_t offset; // Offset of field within structure; only used for nonstatic fields
0N/A void* address; // Address of field; only used for static fields
0N/A // ("offset" can not be reused because of apparent SparcWorks compiler bug
0N/A // in generation of initializer data)
0N/A} VMStructEntry;
0N/A
0N/Atypedef struct {
0N/A const char* typeName; // Type name (example: "methodOopDesc")
0N/A const char* superclassName; // Superclass name, or null if none (example: "oopDesc")
0N/A int32_t isOopType; // Does this type represent an oop typedef? (i.e., "methodOop" or
0N/A // "klassOop", but NOT "methodOopDesc")
0N/A int32_t isIntegerType; // Does this type represent an integer type (of arbitrary size)?
0N/A int32_t isUnsigned; // If so, is it unsigned?
0N/A uint64_t size; // Size, in bytes, of the type
0N/A} VMTypeEntry;
0N/A
0N/Atypedef struct {
0N/A const char* name; // Name of constant (example: "_thread_in_native")
0N/A int32_t value; // Value of constant
0N/A} VMIntConstantEntry;
0N/A
0N/Atypedef struct {
0N/A const char* name; // Name of constant (example: "_thread_in_native")
0N/A uint64_t value; // Value of constant
0N/A} VMLongConstantEntry;
0N/A
0N/A// This class is a friend of most classes, to be able to access
0N/A// private fields
0N/Aclass VMStructs {
0N/Apublic:
0N/A // The last entry is identified over in the serviceability agent by
0N/A // the fact that it has a NULL fieldName
0N/A static VMStructEntry localHotSpotVMStructs[];
0N/A
0N/A // The last entry is identified over in the serviceability agent by
0N/A // the fact that it has a NULL typeName
0N/A static VMTypeEntry localHotSpotVMTypes[];
0N/A
0N/A // Table of integer constants required by the serviceability agent.
0N/A // The last entry is identified over in the serviceability agent by
0N/A // the fact that it has a NULL typeName
0N/A static VMIntConstantEntry localHotSpotVMIntConstants[];
0N/A
0N/A // Table of long constants required by the serviceability agent.
0N/A // The last entry is identified over in the serviceability agent by
0N/A // the fact that it has a NULL typeName
0N/A static VMLongConstantEntry localHotSpotVMLongConstants[];
0N/A
0N/A // This is used to run any checking code necessary for validation of
0N/A // the data structure (debug build only)
0N/A static void init();
0N/A
0N/Aprivate:
0N/A // Look up a type in localHotSpotVMTypes using strcmp() (debug build only).
0N/A // Returns 1 if found, 0 if not.
0N/A // debug_only(static int findType(const char* typeName);)
0N/A static int findType(const char* typeName);
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_RUNTIME_VMSTRUCTS_HPP