Wed, 01 May 2013 08:07:59 -0700
8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
Summary: Do not treat static methods as miranda methods.
Reviewed-by: dholmes, acorn
never@3137 | 1 | /* |
coleenp@4037 | 2 | * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
never@3137 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
never@3137 | 4 | * |
never@3137 | 5 | * This code is free software; you can redistribute it and/or modify it |
never@3137 | 6 | * under the terms of the GNU General Public License version 2 only, as |
never@3137 | 7 | * published by the Free Software Foundation. |
never@3137 | 8 | * |
never@3137 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
never@3137 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
never@3137 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
never@3137 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
never@3137 | 13 | * accompanied this code). |
never@3137 | 14 | * |
never@3137 | 15 | * You should have received a copy of the GNU General Public License version |
never@3137 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
never@3137 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
never@3137 | 18 | * |
never@3137 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
never@3137 | 20 | * or visit www.oracle.com if you need additional information or have any |
never@3137 | 21 | * questions. |
never@3137 | 22 | * |
never@3137 | 23 | */ |
never@3137 | 24 | |
never@3137 | 25 | #ifndef SHARE_VM_OOPS_FIELDINFO_HPP |
never@3137 | 26 | #define SHARE_VM_OOPS_FIELDINFO_HPP |
never@3137 | 27 | |
coleenp@4037 | 28 | #include "oops/constantPool.hpp" |
never@3137 | 29 | #include "oops/typeArrayOop.hpp" |
never@3137 | 30 | #include "classfile/vmSymbols.hpp" |
never@3137 | 31 | |
never@3137 | 32 | // This class represents the field information contained in the fields |
coleenp@4037 | 33 | // array of an InstanceKlass. Currently it's laid on top an array of |
never@3137 | 34 | // Java shorts but in the future it could simply be used as a real |
never@3137 | 35 | // array type. FieldInfo generally shouldn't be used directly. |
coleenp@4037 | 36 | // Fields should be queried either through InstanceKlass or through |
never@3137 | 37 | // the various FieldStreams. |
never@3137 | 38 | class FieldInfo VALUE_OBJ_CLASS_SPEC { |
never@3137 | 39 | friend class fieldDescriptor; |
never@3137 | 40 | friend class JavaFieldStream; |
never@3137 | 41 | friend class ClassFileParser; |
never@3137 | 42 | |
never@3137 | 43 | public: |
never@3137 | 44 | // fields |
never@3137 | 45 | // Field info extracted from the class file and stored |
jwilhelm@4430 | 46 | // as an array of 6 shorts. |
jwilhelm@4430 | 47 | |
jwilhelm@4430 | 48 | #define FIELDINFO_TAG_SIZE 2 |
jwilhelm@4430 | 49 | #define FIELDINFO_TAG_BLANK 0 |
jwilhelm@4430 | 50 | #define FIELDINFO_TAG_OFFSET 1 |
jwilhelm@4430 | 51 | #define FIELDINFO_TAG_TYPE_PLAIN 2 |
jwilhelm@4430 | 52 | #define FIELDINFO_TAG_TYPE_CONTENDED 3 |
jwilhelm@4430 | 53 | #define FIELDINFO_TAG_MASK 3 |
jwilhelm@4430 | 54 | |
jwilhelm@4430 | 55 | // Packed field has the tag, and can be either of: |
jwilhelm@4430 | 56 | // hi bits <--------------------------- lo bits |
jwilhelm@4430 | 57 | // |---------high---------|---------low---------| |
jwilhelm@4430 | 58 | // ..........................................00 - blank |
jwilhelm@4430 | 59 | // [------------------offset----------------]01 - real field offset |
jwilhelm@4430 | 60 | // ......................[-------type-------]10 - plain field with type |
jwilhelm@4430 | 61 | // [--contention_group--][-------type-------]11 - contended field with type and contention group |
never@3137 | 62 | enum FieldOffset { |
never@3137 | 63 | access_flags_offset = 0, |
never@3137 | 64 | name_index_offset = 1, |
never@3137 | 65 | signature_index_offset = 2, |
never@3137 | 66 | initval_index_offset = 3, |
jwilhelm@4430 | 67 | low_packed_offset = 4, |
jwilhelm@4430 | 68 | high_packed_offset = 5, |
jiangli@3803 | 69 | field_slots = 6 |
never@3137 | 70 | }; |
never@3137 | 71 | |
never@3137 | 72 | private: |
never@3137 | 73 | u2 _shorts[field_slots]; |
never@3137 | 74 | |
never@3137 | 75 | void set_name_index(u2 val) { _shorts[name_index_offset] = val; } |
never@3137 | 76 | void set_signature_index(u2 val) { _shorts[signature_index_offset] = val; } |
never@3137 | 77 | void set_initval_index(u2 val) { _shorts[initval_index_offset] = val; } |
never@3137 | 78 | |
never@3137 | 79 | u2 name_index() const { return _shorts[name_index_offset]; } |
never@3137 | 80 | u2 signature_index() const { return _shorts[signature_index_offset]; } |
never@3137 | 81 | u2 initval_index() const { return _shorts[initval_index_offset]; } |
never@3137 | 82 | |
never@3137 | 83 | public: |
coleenp@4037 | 84 | static FieldInfo* from_field_array(Array<u2>* fields, int index) { |
coleenp@4037 | 85 | return ((FieldInfo*)fields->adr_at(index * field_slots)); |
never@3137 | 86 | } |
jiangli@3803 | 87 | static FieldInfo* from_field_array(u2* fields, int index) { |
jiangli@3803 | 88 | return ((FieldInfo*)(fields + index * field_slots)); |
jiangli@3803 | 89 | } |
never@3137 | 90 | |
never@3137 | 91 | void initialize(u2 access_flags, |
never@3137 | 92 | u2 name_index, |
never@3137 | 93 | u2 signature_index, |
jwilhelm@4430 | 94 | u2 initval_index) { |
never@3137 | 95 | _shorts[access_flags_offset] = access_flags; |
never@3137 | 96 | _shorts[name_index_offset] = name_index; |
never@3137 | 97 | _shorts[signature_index_offset] = signature_index; |
never@3137 | 98 | _shorts[initval_index_offset] = initval_index; |
jwilhelm@4430 | 99 | _shorts[low_packed_offset] = 0; |
jwilhelm@4430 | 100 | _shorts[high_packed_offset] = 0; |
never@3137 | 101 | } |
never@3137 | 102 | |
never@3137 | 103 | u2 access_flags() const { return _shorts[access_flags_offset]; } |
jwilhelm@4430 | 104 | u4 offset() const { |
jwilhelm@4430 | 105 | u2 lo = _shorts[low_packed_offset]; |
jwilhelm@4430 | 106 | switch(lo & FIELDINFO_TAG_MASK) { |
jwilhelm@4430 | 107 | case FIELDINFO_TAG_OFFSET: |
jwilhelm@4430 | 108 | return build_int_from_shorts(_shorts[low_packed_offset], _shorts[high_packed_offset]) >> FIELDINFO_TAG_SIZE; |
jwilhelm@4430 | 109 | #ifndef PRODUCT |
jwilhelm@4430 | 110 | case FIELDINFO_TAG_TYPE_PLAIN: |
neliasso@4769 | 111 | fatal("Asking offset for the plain type field"); |
jwilhelm@4430 | 112 | case FIELDINFO_TAG_TYPE_CONTENDED: |
neliasso@4769 | 113 | fatal("Asking offset for the contended type field"); |
jwilhelm@4430 | 114 | case FIELDINFO_TAG_BLANK: |
neliasso@4769 | 115 | fatal("Asking offset for the blank field"); |
jwilhelm@4430 | 116 | #endif |
jwilhelm@4430 | 117 | } |
jwilhelm@4430 | 118 | ShouldNotReachHere(); |
jwilhelm@4430 | 119 | return 0; |
jwilhelm@4430 | 120 | } |
jwilhelm@4430 | 121 | |
jwilhelm@4430 | 122 | bool is_contended() const { |
jwilhelm@4430 | 123 | u2 lo = _shorts[low_packed_offset]; |
jwilhelm@4430 | 124 | switch(lo & FIELDINFO_TAG_MASK) { |
jwilhelm@4430 | 125 | case FIELDINFO_TAG_TYPE_PLAIN: |
jwilhelm@4430 | 126 | return false; |
jwilhelm@4430 | 127 | case FIELDINFO_TAG_TYPE_CONTENDED: |
jwilhelm@4430 | 128 | return true; |
jwilhelm@4430 | 129 | #ifndef PRODUCT |
jwilhelm@4430 | 130 | case FIELDINFO_TAG_OFFSET: |
neliasso@4769 | 131 | fatal("Asking contended flag for the field with offset"); |
jwilhelm@4430 | 132 | case FIELDINFO_TAG_BLANK: |
neliasso@4769 | 133 | fatal("Asking contended flag for the blank field"); |
jwilhelm@4430 | 134 | #endif |
jwilhelm@4430 | 135 | } |
jwilhelm@4430 | 136 | ShouldNotReachHere(); |
jwilhelm@4430 | 137 | return false; |
jwilhelm@4430 | 138 | } |
jwilhelm@4430 | 139 | |
jwilhelm@4430 | 140 | u2 contended_group() const { |
jwilhelm@4430 | 141 | u2 lo = _shorts[low_packed_offset]; |
jwilhelm@4430 | 142 | switch(lo & FIELDINFO_TAG_MASK) { |
jwilhelm@4430 | 143 | case FIELDINFO_TAG_TYPE_PLAIN: |
jwilhelm@4430 | 144 | return 0; |
jwilhelm@4430 | 145 | case FIELDINFO_TAG_TYPE_CONTENDED: |
jwilhelm@4430 | 146 | return _shorts[high_packed_offset]; |
jwilhelm@4430 | 147 | #ifndef PRODUCT |
jwilhelm@4430 | 148 | case FIELDINFO_TAG_OFFSET: |
neliasso@4769 | 149 | fatal("Asking the contended group for the field with offset"); |
jwilhelm@4430 | 150 | case FIELDINFO_TAG_BLANK: |
neliasso@4769 | 151 | fatal("Asking the contended group for the blank field"); |
jwilhelm@4430 | 152 | #endif |
jwilhelm@4430 | 153 | } |
jwilhelm@4430 | 154 | ShouldNotReachHere(); |
jwilhelm@4430 | 155 | return 0; |
jwilhelm@4430 | 156 | } |
jwilhelm@4430 | 157 | |
jwilhelm@4430 | 158 | u2 allocation_type() const { |
jwilhelm@4430 | 159 | u2 lo = _shorts[low_packed_offset]; |
jwilhelm@4430 | 160 | switch(lo & FIELDINFO_TAG_MASK) { |
jwilhelm@4430 | 161 | case FIELDINFO_TAG_TYPE_PLAIN: |
jwilhelm@4430 | 162 | case FIELDINFO_TAG_TYPE_CONTENDED: |
jwilhelm@4430 | 163 | return (lo >> FIELDINFO_TAG_SIZE); |
jwilhelm@4430 | 164 | #ifndef PRODUCT |
jwilhelm@4430 | 165 | case FIELDINFO_TAG_OFFSET: |
neliasso@4769 | 166 | fatal("Asking the field type for field with offset"); |
jwilhelm@4430 | 167 | case FIELDINFO_TAG_BLANK: |
neliasso@4769 | 168 | fatal("Asking the field type for the blank field"); |
jwilhelm@4430 | 169 | #endif |
jwilhelm@4430 | 170 | } |
jwilhelm@4430 | 171 | ShouldNotReachHere(); |
jwilhelm@4430 | 172 | return 0; |
jwilhelm@4430 | 173 | } |
jwilhelm@4430 | 174 | |
jwilhelm@4430 | 175 | bool is_offset_set() const { |
jwilhelm@4430 | 176 | return (_shorts[low_packed_offset] & FIELDINFO_TAG_MASK) == FIELDINFO_TAG_OFFSET; |
jwilhelm@4430 | 177 | } |
never@3137 | 178 | |
never@3137 | 179 | Symbol* name(constantPoolHandle cp) const { |
never@3137 | 180 | int index = name_index(); |
never@3137 | 181 | if (is_internal()) { |
never@3137 | 182 | return lookup_symbol(index); |
never@3137 | 183 | } |
never@3137 | 184 | return cp->symbol_at(index); |
never@3137 | 185 | } |
never@3137 | 186 | |
never@3137 | 187 | Symbol* signature(constantPoolHandle cp) const { |
never@3137 | 188 | int index = signature_index(); |
never@3137 | 189 | if (is_internal()) { |
never@3137 | 190 | return lookup_symbol(index); |
never@3137 | 191 | } |
never@3137 | 192 | return cp->symbol_at(index); |
never@3137 | 193 | } |
never@3137 | 194 | |
never@3137 | 195 | void set_access_flags(u2 val) { _shorts[access_flags_offset] = val; } |
never@3137 | 196 | void set_offset(u4 val) { |
jwilhelm@4430 | 197 | val = val << FIELDINFO_TAG_SIZE; // make room for tag |
jwilhelm@4430 | 198 | _shorts[low_packed_offset] = extract_low_short_from_int(val) | FIELDINFO_TAG_OFFSET; |
jwilhelm@4430 | 199 | _shorts[high_packed_offset] = extract_high_short_from_int(val); |
jwilhelm@4430 | 200 | } |
jwilhelm@4430 | 201 | |
jwilhelm@4430 | 202 | void set_allocation_type(int type) { |
jwilhelm@4430 | 203 | u2 lo = _shorts[low_packed_offset]; |
jwilhelm@4430 | 204 | switch(lo & FIELDINFO_TAG_MASK) { |
jwilhelm@4430 | 205 | case FIELDINFO_TAG_BLANK: |
jwilhelm@4430 | 206 | _shorts[low_packed_offset] = ((type << FIELDINFO_TAG_SIZE)) & 0xFFFF; |
jwilhelm@4430 | 207 | _shorts[low_packed_offset] &= ~FIELDINFO_TAG_MASK; |
jwilhelm@4430 | 208 | _shorts[low_packed_offset] |= FIELDINFO_TAG_TYPE_PLAIN; |
jwilhelm@4430 | 209 | return; |
jwilhelm@4430 | 210 | #ifndef PRODUCT |
jwilhelm@4430 | 211 | case FIELDINFO_TAG_TYPE_PLAIN: |
jwilhelm@4430 | 212 | case FIELDINFO_TAG_TYPE_CONTENDED: |
jwilhelm@4430 | 213 | case FIELDINFO_TAG_OFFSET: |
neliasso@4769 | 214 | fatal("Setting the field type with overwriting"); |
jwilhelm@4430 | 215 | #endif |
jwilhelm@4430 | 216 | } |
jwilhelm@4430 | 217 | ShouldNotReachHere(); |
jwilhelm@4430 | 218 | } |
jwilhelm@4430 | 219 | |
jwilhelm@4430 | 220 | void set_contended_group(u2 val) { |
jwilhelm@4430 | 221 | u2 lo = _shorts[low_packed_offset]; |
jwilhelm@4430 | 222 | switch(lo & FIELDINFO_TAG_MASK) { |
jwilhelm@4430 | 223 | case FIELDINFO_TAG_TYPE_PLAIN: |
jwilhelm@4430 | 224 | _shorts[low_packed_offset] |= FIELDINFO_TAG_TYPE_CONTENDED; |
jwilhelm@4430 | 225 | _shorts[high_packed_offset] = val; |
jwilhelm@4430 | 226 | return; |
jwilhelm@4430 | 227 | #ifndef PRODUCT |
jwilhelm@4430 | 228 | case FIELDINFO_TAG_TYPE_CONTENDED: |
neliasso@4769 | 229 | fatal("Overwriting contended group"); |
jwilhelm@4430 | 230 | case FIELDINFO_TAG_BLANK: |
neliasso@4769 | 231 | fatal("Setting contended group for the blank field"); |
jwilhelm@4430 | 232 | case FIELDINFO_TAG_OFFSET: |
neliasso@4769 | 233 | fatal("Setting contended group for field with offset"); |
jwilhelm@4430 | 234 | #endif |
jwilhelm@4430 | 235 | } |
jwilhelm@4430 | 236 | ShouldNotReachHere(); |
never@3137 | 237 | } |
never@3137 | 238 | |
never@3137 | 239 | bool is_internal() const { |
never@3137 | 240 | return (access_flags() & JVM_ACC_FIELD_INTERNAL) != 0; |
never@3137 | 241 | } |
never@3137 | 242 | |
never@3137 | 243 | Symbol* lookup_symbol(int symbol_index) const { |
never@3137 | 244 | assert(is_internal(), "only internal fields"); |
never@3137 | 245 | return vmSymbols::symbol_at((vmSymbols::SID)symbol_index); |
never@3137 | 246 | } |
never@3137 | 247 | }; |
never@3137 | 248 | |
never@3137 | 249 | #endif // SHARE_VM_OOPS_FIELDINFO_HPP |