Wed, 23 Jan 2013 13:02:39 -0500
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS.
Reviewed-by: coleenp, stefank
duke@435 | 1 | /* |
jiangli@3826 | 2 | * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #include "precompiled.hpp" |
coleenp@4037 | 26 | #include "interpreter/interpreter.hpp" |
coleenp@4037 | 27 | #include "memory/gcLocker.hpp" |
coleenp@4037 | 28 | #include "memory/metadataFactory.hpp" |
coleenp@4037 | 29 | #include "oops/constMethod.hpp" |
coleenp@4037 | 30 | #include "oops/method.hpp" |
duke@435 | 31 | |
duke@435 | 32 | // Static initialization |
coleenp@4037 | 33 | const u2 ConstMethod::MAX_IDNUM = 0xFFFE; |
coleenp@4037 | 34 | const u2 ConstMethod::UNSET_IDNUM = 0xFFFF; |
coleenp@4037 | 35 | |
coleenp@4037 | 36 | ConstMethod* ConstMethod::allocate(ClassLoaderData* loader_data, |
kamg@4245 | 37 | int byte_code_size, |
kamg@4245 | 38 | int compressed_line_number_size, |
kamg@4245 | 39 | int localvariable_table_length, |
kamg@4245 | 40 | int exception_table_length, |
kamg@4245 | 41 | int checked_exceptions_length, |
coleenp@4398 | 42 | int method_parameters_length, |
jiangli@4302 | 43 | u2 generic_signature_index, |
kamg@4245 | 44 | MethodType method_type, |
kamg@4245 | 45 | TRAPS) { |
coleenp@4037 | 46 | int size = ConstMethod::size(byte_code_size, |
coleenp@4398 | 47 | compressed_line_number_size, |
coleenp@4398 | 48 | localvariable_table_length, |
coleenp@4398 | 49 | exception_table_length, |
coleenp@4398 | 50 | checked_exceptions_length, |
coleenp@4398 | 51 | method_parameters_length, |
coleenp@4398 | 52 | generic_signature_index); |
coleenp@4037 | 53 | return new (loader_data, size, true, THREAD) ConstMethod( |
kamg@4245 | 54 | byte_code_size, compressed_line_number_size, localvariable_table_length, |
coleenp@4398 | 55 | exception_table_length, checked_exceptions_length, |
coleenp@4398 | 56 | method_parameters_length, generic_signature_index, |
jiangli@4302 | 57 | method_type, size); |
coleenp@4037 | 58 | } |
coleenp@4037 | 59 | |
coleenp@4037 | 60 | ConstMethod::ConstMethod(int byte_code_size, |
kamg@4245 | 61 | int compressed_line_number_size, |
kamg@4245 | 62 | int localvariable_table_length, |
kamg@4245 | 63 | int exception_table_length, |
kamg@4245 | 64 | int checked_exceptions_length, |
coleenp@4398 | 65 | int method_parameters_length, |
jiangli@4302 | 66 | u2 generic_signature_index, |
kamg@4245 | 67 | MethodType method_type, |
kamg@4245 | 68 | int size) { |
coleenp@4037 | 69 | |
coleenp@4037 | 70 | No_Safepoint_Verifier no_safepoint; |
coleenp@4037 | 71 | set_interpreter_kind(Interpreter::invalid); |
coleenp@4037 | 72 | init_fingerprint(); |
coleenp@4037 | 73 | set_constants(NULL); |
coleenp@4037 | 74 | set_stackmap_data(NULL); |
coleenp@4037 | 75 | set_code_size(byte_code_size); |
coleenp@4037 | 76 | set_constMethod_size(size); |
jiangli@4302 | 77 | set_inlined_tables_length(generic_signature_index, |
jiangli@4302 | 78 | checked_exceptions_length, |
coleenp@4037 | 79 | compressed_line_number_size, |
coleenp@4037 | 80 | localvariable_table_length, |
coleenp@4398 | 81 | exception_table_length, |
coleenp@4398 | 82 | method_parameters_length); |
kamg@4245 | 83 | set_method_type(method_type); |
coleenp@4037 | 84 | assert(this->size() == size, "wrong size for object"); |
coleenp@4037 | 85 | } |
coleenp@4037 | 86 | |
coleenp@4037 | 87 | |
coleenp@4037 | 88 | // Deallocate metadata fields associated with ConstMethod* |
coleenp@4037 | 89 | void ConstMethod::deallocate_contents(ClassLoaderData* loader_data) { |
coleenp@4037 | 90 | set_interpreter_kind(Interpreter::invalid); |
coleenp@4037 | 91 | if (stackmap_data() != NULL) { |
coleenp@4037 | 92 | MetadataFactory::free_array<u1>(loader_data, stackmap_data()); |
coleenp@4037 | 93 | } |
coleenp@4037 | 94 | set_stackmap_data(NULL); |
coleenp@4037 | 95 | } |
duke@435 | 96 | |
duke@435 | 97 | // How big must this constMethodObject be? |
duke@435 | 98 | |
coleenp@4037 | 99 | int ConstMethod::size(int code_size, |
coleenp@4398 | 100 | int compressed_line_number_size, |
coleenp@4398 | 101 | int local_variable_table_length, |
coleenp@4398 | 102 | int exception_table_length, |
coleenp@4398 | 103 | int checked_exceptions_length, |
coleenp@4398 | 104 | int method_parameters_length, |
coleenp@4398 | 105 | u2 generic_signature_index) { |
duke@435 | 106 | int extra_bytes = code_size; |
duke@435 | 107 | if (compressed_line_number_size > 0) { |
duke@435 | 108 | extra_bytes += compressed_line_number_size; |
duke@435 | 109 | } |
duke@435 | 110 | if (checked_exceptions_length > 0) { |
duke@435 | 111 | extra_bytes += sizeof(u2); |
duke@435 | 112 | extra_bytes += checked_exceptions_length * sizeof(CheckedExceptionElement); |
duke@435 | 113 | } |
duke@435 | 114 | if (local_variable_table_length > 0) { |
duke@435 | 115 | extra_bytes += sizeof(u2); |
duke@435 | 116 | extra_bytes += |
duke@435 | 117 | local_variable_table_length * sizeof(LocalVariableTableElement); |
duke@435 | 118 | } |
jiangli@3917 | 119 | if (exception_table_length > 0) { |
jiangli@3917 | 120 | extra_bytes += sizeof(u2); |
jiangli@3917 | 121 | extra_bytes += exception_table_length * sizeof(ExceptionTableElement); |
jiangli@3917 | 122 | } |
jiangli@4302 | 123 | if (generic_signature_index != 0) { |
jiangli@4302 | 124 | extra_bytes += sizeof(u2); |
jiangli@4302 | 125 | } |
coleenp@4398 | 126 | if (method_parameters_length > 0) { |
coleenp@4398 | 127 | extra_bytes += sizeof(u2); |
coleenp@4398 | 128 | extra_bytes += method_parameters_length * sizeof(MethodParametersElement); |
coleenp@4398 | 129 | } |
duke@435 | 130 | int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord; |
duke@435 | 131 | return align_object_size(header_size() + extra_words); |
duke@435 | 132 | } |
duke@435 | 133 | |
coleenp@4037 | 134 | Method* ConstMethod::method() const { |
coleenp@4251 | 135 | return _constants->pool_holder()->method_with_idnum(_method_idnum); |
jiangli@3826 | 136 | } |
duke@435 | 137 | |
duke@435 | 138 | // linenumber table - note that length is unknown until decompression, |
duke@435 | 139 | // see class CompressedLineNumberReadStream. |
duke@435 | 140 | |
coleenp@4037 | 141 | u_char* ConstMethod::compressed_linenumber_table() const { |
duke@435 | 142 | // Located immediately following the bytecodes. |
duke@435 | 143 | assert(has_linenumber_table(), "called only if table is present"); |
duke@435 | 144 | return code_end(); |
duke@435 | 145 | } |
duke@435 | 146 | |
jiangli@4302 | 147 | u2* ConstMethod::generic_signature_index_addr() const { |
jiangli@4302 | 148 | // Located at the end of the constMethod. |
jiangli@4302 | 149 | assert(has_generic_signature(), "called only if generic signature exists"); |
jiangli@4302 | 150 | return last_u2_element(); |
jiangli@4302 | 151 | } |
jiangli@4302 | 152 | |
coleenp@4037 | 153 | u2* ConstMethod::checked_exceptions_length_addr() const { |
jiangli@4302 | 154 | // Located immediately before the generic signature index. |
duke@435 | 155 | assert(has_checked_exceptions(), "called only if table is present"); |
coleenp@4398 | 156 | if(has_method_parameters()) { |
coleenp@4398 | 157 | // If method parameters present, locate immediately before them. |
coleenp@4398 | 158 | return (u2*)method_parameters_start() - 1; |
coleenp@4398 | 159 | } else { |
coleenp@4398 | 160 | // Else, the exception table is at the end of the constMethod. |
coleenp@4398 | 161 | return has_generic_signature() ? (last_u2_element() - 1) : |
coleenp@4398 | 162 | last_u2_element(); |
coleenp@4398 | 163 | } |
coleenp@4398 | 164 | } |
coleenp@4398 | 165 | |
coleenp@4398 | 166 | u2* ConstMethod::method_parameters_length_addr() const { |
coleenp@4398 | 167 | assert(has_method_parameters(), "called only if table is present"); |
jiangli@4302 | 168 | return has_generic_signature() ? (last_u2_element() - 1) : |
jiangli@4302 | 169 | last_u2_element(); |
duke@435 | 170 | } |
duke@435 | 171 | |
coleenp@4037 | 172 | u2* ConstMethod::exception_table_length_addr() const { |
jiangli@3917 | 173 | assert(has_exception_handler(), "called only if table is present"); |
duke@435 | 174 | if (has_checked_exceptions()) { |
duke@435 | 175 | // If checked_exception present, locate immediately before them. |
duke@435 | 176 | return (u2*) checked_exceptions_start() - 1; |
duke@435 | 177 | } else { |
coleenp@4398 | 178 | if(has_method_parameters()) { |
coleenp@4398 | 179 | // If method parameters present, locate immediately before them. |
coleenp@4398 | 180 | return (u2*)method_parameters_start() - 1; |
coleenp@4398 | 181 | } else { |
coleenp@4398 | 182 | // Else, the exception table is at the end of the constMethod. |
jiangli@4302 | 183 | return has_generic_signature() ? (last_u2_element() - 1) : |
jiangli@4302 | 184 | last_u2_element(); |
duke@435 | 185 | } |
coleenp@4398 | 186 | } |
duke@435 | 187 | } |
duke@435 | 188 | |
coleenp@4037 | 189 | u2* ConstMethod::localvariable_table_length_addr() const { |
jiangli@3917 | 190 | assert(has_localvariable_table(), "called only if table is present"); |
jiangli@3917 | 191 | if (has_exception_handler()) { |
jiangli@3917 | 192 | // If exception_table present, locate immediately before them. |
jiangli@3917 | 193 | return (u2*) exception_table_start() - 1; |
jiangli@3917 | 194 | } else { |
jiangli@3917 | 195 | if (has_checked_exceptions()) { |
jiangli@3917 | 196 | // If checked_exception present, locate immediately before them. |
jiangli@3917 | 197 | return (u2*) checked_exceptions_start() - 1; |
jiangli@3917 | 198 | } else { |
coleenp@4398 | 199 | if(has_method_parameters()) { |
coleenp@4398 | 200 | // If method parameters present, locate immediately before them. |
coleenp@4398 | 201 | return (u2*)method_parameters_start() - 1; |
coleenp@4398 | 202 | } else { |
coleenp@4398 | 203 | // Else, the exception table is at the end of the constMethod. |
jiangli@4302 | 204 | return has_generic_signature() ? (last_u2_element() - 1) : |
jiangli@4302 | 205 | last_u2_element(); |
jiangli@3917 | 206 | } |
jiangli@3917 | 207 | } |
coleenp@4398 | 208 | } |
jiangli@3917 | 209 | } |
jiangli@3917 | 210 | |
duke@435 | 211 | // Update the flags to indicate the presence of these optional fields. |
jiangli@4302 | 212 | void ConstMethod::set_inlined_tables_length(u2 generic_signature_index, |
jiangli@4302 | 213 | int checked_exceptions_len, |
jiangli@4302 | 214 | int compressed_line_number_size, |
jiangli@4302 | 215 | int localvariable_table_len, |
coleenp@4398 | 216 | int exception_table_len, |
coleenp@4398 | 217 | int method_parameters_len) { |
duke@435 | 218 | assert(_flags == 0, "Error"); |
coleenp@4398 | 219 | if (compressed_line_number_size > 0) |
duke@435 | 220 | _flags |= _has_linenumber_table; |
coleenp@4398 | 221 | if (generic_signature_index != 0) |
jiangli@4302 | 222 | _flags |= _has_generic_signature; |
coleenp@4398 | 223 | if (method_parameters_len > 0) |
coleenp@4398 | 224 | _flags |= _has_method_parameters; |
coleenp@4398 | 225 | if (checked_exceptions_len > 0) |
coleenp@4398 | 226 | _flags |= _has_checked_exceptions; |
coleenp@4398 | 227 | if (exception_table_len > 0) |
coleenp@4398 | 228 | _flags |= _has_exception_table; |
coleenp@4398 | 229 | if (localvariable_table_len > 0) |
coleenp@4398 | 230 | _flags |= _has_localvariable_table; |
coleenp@4398 | 231 | |
coleenp@4398 | 232 | // This code is extremely brittle and should possibly be revised. |
coleenp@4398 | 233 | // The *_length_addr functions walk backwards through the |
coleenp@4398 | 234 | // constMethod data, using each of the length indexes ahead of them, |
coleenp@4398 | 235 | // as well as the flags variable. Therefore, the indexes must be |
coleenp@4398 | 236 | // initialized in reverse order, or else they will compute the wrong |
coleenp@4398 | 237 | // offsets. Moving the initialization of _flags into a separate |
coleenp@4398 | 238 | // block solves *half* of the problem, but the following part will |
coleenp@4398 | 239 | // still break if the order is not exactly right. |
coleenp@4398 | 240 | // |
coleenp@4398 | 241 | // Also, the servicability agent needs to be informed anytime |
coleenp@4398 | 242 | // anything is added here. It might be advisable to have some sort |
coleenp@4398 | 243 | // of indication of this inline. |
coleenp@4398 | 244 | if (generic_signature_index != 0) |
jiangli@4302 | 245 | *(generic_signature_index_addr()) = generic_signature_index; |
coleenp@4398 | 246 | // New data should probably go here. |
coleenp@4398 | 247 | if (method_parameters_len > 0) |
coleenp@4398 | 248 | *(method_parameters_length_addr()) = method_parameters_len; |
coleenp@4398 | 249 | if (checked_exceptions_len > 0) |
duke@435 | 250 | *(checked_exceptions_length_addr()) = checked_exceptions_len; |
coleenp@4398 | 251 | if (exception_table_len > 0) |
jiangli@3917 | 252 | *(exception_table_length_addr()) = exception_table_len; |
coleenp@4398 | 253 | if (localvariable_table_len > 0) |
duke@435 | 254 | *(localvariable_table_length_addr()) = localvariable_table_len; |
coleenp@4398 | 255 | } |
coleenp@4398 | 256 | |
coleenp@4398 | 257 | int ConstMethod::method_parameters_length() const { |
coleenp@4398 | 258 | return has_method_parameters() ? *(method_parameters_length_addr()) : 0; |
coleenp@4398 | 259 | } |
coleenp@4398 | 260 | |
coleenp@4398 | 261 | MethodParametersElement* ConstMethod::method_parameters_start() const { |
coleenp@4398 | 262 | u2* addr = method_parameters_length_addr(); |
coleenp@4398 | 263 | u2 length = *addr; |
coleenp@4398 | 264 | assert(length > 0, "should only be called if table is present"); |
coleenp@4398 | 265 | addr -= length * sizeof(MethodParametersElement) / sizeof(u2); |
coleenp@4398 | 266 | return (MethodParametersElement*) addr; |
duke@435 | 267 | } |
duke@435 | 268 | |
duke@435 | 269 | |
coleenp@4037 | 270 | int ConstMethod::checked_exceptions_length() const { |
duke@435 | 271 | return has_checked_exceptions() ? *(checked_exceptions_length_addr()) : 0; |
duke@435 | 272 | } |
duke@435 | 273 | |
duke@435 | 274 | |
coleenp@4037 | 275 | CheckedExceptionElement* ConstMethod::checked_exceptions_start() const { |
duke@435 | 276 | u2* addr = checked_exceptions_length_addr(); |
duke@435 | 277 | u2 length = *addr; |
duke@435 | 278 | assert(length > 0, "should only be called if table is present"); |
duke@435 | 279 | addr -= length * sizeof(CheckedExceptionElement) / sizeof(u2); |
duke@435 | 280 | return (CheckedExceptionElement*) addr; |
duke@435 | 281 | } |
duke@435 | 282 | |
duke@435 | 283 | |
coleenp@4037 | 284 | int ConstMethod::localvariable_table_length() const { |
duke@435 | 285 | return has_localvariable_table() ? *(localvariable_table_length_addr()) : 0; |
duke@435 | 286 | } |
duke@435 | 287 | |
duke@435 | 288 | |
coleenp@4037 | 289 | LocalVariableTableElement* ConstMethod::localvariable_table_start() const { |
duke@435 | 290 | u2* addr = localvariable_table_length_addr(); |
duke@435 | 291 | u2 length = *addr; |
duke@435 | 292 | assert(length > 0, "should only be called if table is present"); |
duke@435 | 293 | addr -= length * sizeof(LocalVariableTableElement) / sizeof(u2); |
duke@435 | 294 | return (LocalVariableTableElement*) addr; |
duke@435 | 295 | } |
jiangli@3917 | 296 | |
coleenp@4037 | 297 | int ConstMethod::exception_table_length() const { |
jiangli@3917 | 298 | return has_exception_handler() ? *(exception_table_length_addr()) : 0; |
jiangli@3917 | 299 | } |
jiangli@3917 | 300 | |
coleenp@4037 | 301 | ExceptionTableElement* ConstMethod::exception_table_start() const { |
jiangli@3917 | 302 | u2* addr = exception_table_length_addr(); |
jiangli@3917 | 303 | u2 length = *addr; |
jiangli@3917 | 304 | assert(length > 0, "should only be called if table is present"); |
jiangli@3917 | 305 | addr -= length * sizeof(ExceptionTableElement) / sizeof(u2); |
jiangli@3917 | 306 | return (ExceptionTableElement*)addr; |
jiangli@3917 | 307 | } |
coleenp@4037 | 308 | |
coleenp@4037 | 309 | |
coleenp@4037 | 310 | // Printing |
coleenp@4037 | 311 | |
coleenp@4037 | 312 | void ConstMethod::print_on(outputStream* st) const { |
coleenp@4037 | 313 | ResourceMark rm; |
coleenp@4037 | 314 | assert(is_constMethod(), "must be constMethod"); |
coleenp@4037 | 315 | st->print_cr(internal_name()); |
coleenp@4037 | 316 | st->print(" - method: " INTPTR_FORMAT " ", (address)method()); |
coleenp@4037 | 317 | method()->print_value_on(st); st->cr(); |
coleenp@4037 | 318 | if (has_stackmap_table()) { |
coleenp@4037 | 319 | st->print(" - stackmap data: "); |
coleenp@4037 | 320 | stackmap_data()->print_value_on(st); |
coleenp@4037 | 321 | st->cr(); |
coleenp@4037 | 322 | } |
coleenp@4037 | 323 | } |
coleenp@4037 | 324 | |
coleenp@4037 | 325 | // Short version of printing ConstMethod* - just print the name of the |
coleenp@4037 | 326 | // method it belongs to. |
coleenp@4037 | 327 | void ConstMethod::print_value_on(outputStream* st) const { |
coleenp@4037 | 328 | assert(is_constMethod(), "must be constMethod"); |
coleenp@4037 | 329 | st->print(" const part of method " ); |
coleenp@4037 | 330 | method()->print_value_on(st); |
coleenp@4037 | 331 | } |
coleenp@4037 | 332 | |
coleenp@4037 | 333 | |
coleenp@4037 | 334 | // Verification |
coleenp@4037 | 335 | |
coleenp@4037 | 336 | void ConstMethod::verify_on(outputStream* st) { |
coleenp@4037 | 337 | guarantee(is_constMethod(), "object must be constMethod"); |
coleenp@4037 | 338 | guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this)); |
coleenp@4037 | 339 | |
coleenp@4037 | 340 | // Verification can occur during oop construction before the method or |
coleenp@4037 | 341 | // other fields have been initialized. |
coleenp@4037 | 342 | guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this)); |
coleenp@4037 | 343 | guarantee(method()->is_method(), "should be method"); |
coleenp@4037 | 344 | |
coleenp@4037 | 345 | address m_end = (address)((oop*) this + size()); |
coleenp@4037 | 346 | address compressed_table_start = code_end(); |
coleenp@4037 | 347 | guarantee(compressed_table_start <= m_end, "invalid method layout"); |
coleenp@4037 | 348 | address compressed_table_end = compressed_table_start; |
coleenp@4037 | 349 | // Verify line number table |
coleenp@4037 | 350 | if (has_linenumber_table()) { |
coleenp@4037 | 351 | CompressedLineNumberReadStream stream(compressed_linenumber_table()); |
coleenp@4037 | 352 | while (stream.read_pair()) { |
coleenp@4037 | 353 | guarantee(stream.bci() >= 0 && stream.bci() <= code_size(), "invalid bci in line number table"); |
coleenp@4037 | 354 | } |
coleenp@4037 | 355 | compressed_table_end += stream.position(); |
coleenp@4037 | 356 | } |
coleenp@4037 | 357 | guarantee(compressed_table_end <= m_end, "invalid method layout"); |
coleenp@4037 | 358 | // Verify checked exceptions, exception table and local variable tables |
coleenp@4398 | 359 | if (has_method_parameters()) { |
coleenp@4398 | 360 | u2* addr = method_parameters_length_addr(); |
coleenp@4398 | 361 | guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout"); |
coleenp@4398 | 362 | } |
coleenp@4037 | 363 | if (has_checked_exceptions()) { |
coleenp@4037 | 364 | u2* addr = checked_exceptions_length_addr(); |
coleenp@4037 | 365 | guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout"); |
coleenp@4037 | 366 | } |
coleenp@4037 | 367 | if (has_exception_handler()) { |
coleenp@4037 | 368 | u2* addr = exception_table_length_addr(); |
coleenp@4037 | 369 | guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout"); |
coleenp@4037 | 370 | } |
coleenp@4037 | 371 | if (has_localvariable_table()) { |
coleenp@4037 | 372 | u2* addr = localvariable_table_length_addr(); |
coleenp@4037 | 373 | guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout"); |
coleenp@4037 | 374 | } |
coleenp@4037 | 375 | // Check compressed_table_end relative to uncompressed_table_start |
coleenp@4037 | 376 | u2* uncompressed_table_start; |
coleenp@4037 | 377 | if (has_localvariable_table()) { |
coleenp@4037 | 378 | uncompressed_table_start = (u2*) localvariable_table_start(); |
coleenp@4037 | 379 | } else if (has_exception_handler()) { |
coleenp@4037 | 380 | uncompressed_table_start = (u2*) exception_table_start(); |
coleenp@4037 | 381 | } else if (has_checked_exceptions()) { |
coleenp@4037 | 382 | uncompressed_table_start = (u2*) checked_exceptions_start(); |
coleenp@4398 | 383 | } else if (has_method_parameters()) { |
coleenp@4398 | 384 | uncompressed_table_start = (u2*) method_parameters_start(); |
coleenp@4037 | 385 | } else { |
coleenp@4037 | 386 | uncompressed_table_start = (u2*) m_end; |
coleenp@4037 | 387 | } |
coleenp@4037 | 388 | int gap = (intptr_t) uncompressed_table_start - (intptr_t) compressed_table_end; |
coleenp@4037 | 389 | int max_gap = align_object_size(1)*BytesPerWord; |
coleenp@4037 | 390 | guarantee(gap >= 0 && gap < max_gap, "invalid method layout"); |
coleenp@4037 | 391 | } |