Thu, 24 May 2018 19:24:53 +0800
#7046 Disable the compilation when branch offset is beyond short branch
Contributed-by: fujie, aoqi
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@0 | 25 | #ifndef SHARE_VM_RUNTIME_VMSTRUCTS_HPP |
aoqi@0 | 26 | #define SHARE_VM_RUNTIME_VMSTRUCTS_HPP |
aoqi@0 | 27 | |
aoqi@0 | 28 | #include "utilities/debug.hpp" |
aoqi@0 | 29 | #ifdef COMPILER1 |
aoqi@0 | 30 | #include "c1/c1_Runtime1.hpp" |
aoqi@0 | 31 | #endif |
aoqi@0 | 32 | |
aoqi@0 | 33 | // This table encapsulates the debugging information required by the |
aoqi@0 | 34 | // serviceability agent in order to run. Specifically, we need to |
aoqi@0 | 35 | // understand the layout of certain C data structures (offsets, in |
aoqi@0 | 36 | // bytes, of their fields.) |
aoqi@0 | 37 | // |
aoqi@0 | 38 | // There are alternatives for the design of this mechanism, including |
aoqi@0 | 39 | // parsing platform-specific debugging symbols from a debug build into |
aoqi@0 | 40 | // a program database. While this current mechanism can be considered |
aoqi@0 | 41 | // to be a workaround for the inability to debug arbitrary C and C++ |
aoqi@0 | 42 | // programs at the present time, it does have certain advantages. |
aoqi@0 | 43 | // First, it is platform-independent, which will vastly simplify the |
aoqi@0 | 44 | // initial bringup of the system both now and on future platforms. |
aoqi@0 | 45 | // Second, it is embedded within the VM, as opposed to being in a |
aoqi@0 | 46 | // separate program database; experience has shown that whenever |
aoqi@0 | 47 | // portions of a system are decoupled, version skew is problematic. |
aoqi@0 | 48 | // Third, generating a program database, for example for a product |
aoqi@0 | 49 | // build, would probably require two builds to be done: the desired |
aoqi@0 | 50 | // product build as well as an intermediary build with the PRODUCT |
aoqi@0 | 51 | // flag turned on but also compiled with -g, leading to a doubling of |
aoqi@0 | 52 | // the time required to get a serviceability agent-debuggable product |
aoqi@0 | 53 | // build. Fourth, and very significantly, this table probably |
aoqi@0 | 54 | // preserves more information about field types than stabs do; for |
aoqi@0 | 55 | // example, it preserves the fact that a field is a "jlong" rather |
aoqi@0 | 56 | // than transforming the type according to the typedef in jni_md.h, |
aoqi@0 | 57 | // which allows the Java-side code to identify "Java-sized" fields in |
aoqi@0 | 58 | // C++ data structures. If the symbol parsing mechanism was redone |
aoqi@0 | 59 | // using stabs, it might still be necessary to have a table somewhere |
aoqi@0 | 60 | // containing this information. |
aoqi@0 | 61 | // |
aoqi@0 | 62 | // Do not change the sizes or signedness of the integer values in |
aoqi@0 | 63 | // these data structures; they are fixed over in the serviceability |
aoqi@0 | 64 | // agent's Java code (for bootstrapping). |
aoqi@0 | 65 | |
aoqi@0 | 66 | typedef struct { |
aoqi@0 | 67 | const char* typeName; // The type name containing the given field (example: "Klass") |
aoqi@0 | 68 | const char* fieldName; // The field name within the type (example: "_name") |
aoqi@0 | 69 | const char* typeString; // Quoted name of the type of this field (example: "Symbol*"; |
aoqi@0 | 70 | // parsed in Java to ensure type correctness |
aoqi@0 | 71 | int32_t isStatic; // Indicates whether following field is an offset or an address |
aoqi@0 | 72 | uint64_t offset; // Offset of field within structure; only used for nonstatic fields |
aoqi@0 | 73 | void* address; // Address of field; only used for static fields |
aoqi@0 | 74 | // ("offset" can not be reused because of apparent SparcWorks compiler bug |
aoqi@0 | 75 | // in generation of initializer data) |
aoqi@0 | 76 | } VMStructEntry; |
aoqi@0 | 77 | |
aoqi@0 | 78 | typedef struct { |
aoqi@0 | 79 | const char* typeName; // Type name (example: "Method") |
aoqi@0 | 80 | const char* superclassName; // Superclass name, or null if none (example: "oopDesc") |
aoqi@0 | 81 | int32_t isOopType; // Does this type represent an oop typedef? (i.e., "Method*" or |
aoqi@0 | 82 | // "Klass*", but NOT "Method") |
aoqi@0 | 83 | int32_t isIntegerType; // Does this type represent an integer type (of arbitrary size)? |
aoqi@0 | 84 | int32_t isUnsigned; // If so, is it unsigned? |
aoqi@0 | 85 | uint64_t size; // Size, in bytes, of the type |
aoqi@0 | 86 | } VMTypeEntry; |
aoqi@0 | 87 | |
aoqi@0 | 88 | typedef struct { |
aoqi@0 | 89 | const char* name; // Name of constant (example: "_thread_in_native") |
aoqi@0 | 90 | int32_t value; // Value of constant |
aoqi@0 | 91 | } VMIntConstantEntry; |
aoqi@0 | 92 | |
aoqi@0 | 93 | typedef struct { |
aoqi@0 | 94 | const char* name; // Name of constant (example: "_thread_in_native") |
aoqi@0 | 95 | uint64_t value; // Value of constant |
aoqi@0 | 96 | } VMLongConstantEntry; |
aoqi@0 | 97 | |
aoqi@0 | 98 | // This class is a friend of most classes, to be able to access |
aoqi@0 | 99 | // private fields |
aoqi@0 | 100 | class VMStructs { |
aoqi@0 | 101 | public: |
aoqi@0 | 102 | // The last entry is identified over in the serviceability agent by |
aoqi@0 | 103 | // the fact that it has a NULL fieldName |
aoqi@0 | 104 | static VMStructEntry localHotSpotVMStructs[]; |
aoqi@0 | 105 | |
aoqi@0 | 106 | // The last entry is identified over in the serviceability agent by |
aoqi@0 | 107 | // the fact that it has a NULL typeName |
aoqi@0 | 108 | static VMTypeEntry localHotSpotVMTypes[]; |
aoqi@0 | 109 | |
aoqi@0 | 110 | // Table of integer constants required by the serviceability agent. |
aoqi@0 | 111 | // The last entry is identified over in the serviceability agent by |
aoqi@0 | 112 | // the fact that it has a NULL typeName |
aoqi@0 | 113 | static VMIntConstantEntry localHotSpotVMIntConstants[]; |
aoqi@0 | 114 | |
aoqi@0 | 115 | // Table of long constants required by the serviceability agent. |
aoqi@0 | 116 | // The last entry is identified over in the serviceability agent by |
aoqi@0 | 117 | // the fact that it has a NULL typeName |
aoqi@0 | 118 | static VMLongConstantEntry localHotSpotVMLongConstants[]; |
aoqi@0 | 119 | |
aoqi@0 | 120 | // This is used to run any checking code necessary for validation of |
aoqi@0 | 121 | // the data structure (debug build only) |
aoqi@0 | 122 | static void init(); |
aoqi@0 | 123 | |
aoqi@0 | 124 | #ifndef PRODUCT |
aoqi@0 | 125 | // Execute unit tests |
aoqi@0 | 126 | static void test(); |
aoqi@0 | 127 | #endif |
aoqi@0 | 128 | |
aoqi@0 | 129 | private: |
aoqi@0 | 130 | // Look up a type in localHotSpotVMTypes using strcmp() (debug build only). |
aoqi@0 | 131 | // Returns 1 if found, 0 if not. |
aoqi@0 | 132 | // debug_only(static int findType(const char* typeName);) |
aoqi@0 | 133 | static int findType(const char* typeName); |
aoqi@0 | 134 | }; |
aoqi@0 | 135 | |
aoqi@0 | 136 | #endif // SHARE_VM_RUNTIME_VMSTRUCTS_HPP |