< prev index next >

hotspot/src/share/vm/classfile/classFileParser.cpp

Print this page
rev 10453 : imported patch update dates
   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2911   // If JVMTI original method ordering or sharing is enabled we have to
2912   // remember the original class file ordering.
2913   // We temporarily use the vtable_index field in the Method* to store the
2914   // class file index, so we can read in after calling qsort.
2915   // Put the method ordering in the shared archive.
2916   if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
2917     for (int index = 0; index < length; index++) {
2918       Method* const m = methods->at(index);
2919       assert(!m->valid_vtable_index(), "vtable index should not be set");
2920       m->set_vtable_index(index);
2921     }
2922   }
2923   // Sort method array by ascending method name (for faster lookups & vtable construction)
2924   // Note that the ordering is not alphabetical, see Symbol::fast_compare
2925   Method::sort_methods(methods);
2926 
2927   intArray* method_ordering = NULL;
2928   // If JVMTI original method ordering or sharing is enabled construct int
2929   // array remembering the original ordering
2930   if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
2931     method_ordering = new intArray(length);
2932     for (int index = 0; index < length; index++) {
2933       Method* const m = methods->at(index);
2934       const int old_index = m->vtable_index();
2935       assert(old_index >= 0 && old_index < length, "invalid method index");
2936       method_ordering->at_put(index, old_index);
2937       m->set_vtable_index(Method::invalid_vtable_index);
2938     }
2939   }
2940   return method_ordering;
2941 }
2942 
2943 // Parse generic_signature attribute for methods and fields
2944 u2 ClassFileParser::parse_generic_signature_attribute(const ClassFileStream* const cfs,
2945                                                       TRAPS) {
2946   assert(cfs != NULL, "invariant");
2947 
2948   cfs->guarantee_more(2, CHECK_0);  // generic_signature_index
2949   const u2 generic_signature_index = cfs->get_u2_fast();
2950   check_property(
2951     valid_symbol_at(generic_signature_index),


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2911   // If JVMTI original method ordering or sharing is enabled we have to
2912   // remember the original class file ordering.
2913   // We temporarily use the vtable_index field in the Method* to store the
2914   // class file index, so we can read in after calling qsort.
2915   // Put the method ordering in the shared archive.
2916   if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
2917     for (int index = 0; index < length; index++) {
2918       Method* const m = methods->at(index);
2919       assert(!m->valid_vtable_index(), "vtable index should not be set");
2920       m->set_vtable_index(index);
2921     }
2922   }
2923   // Sort method array by ascending method name (for faster lookups & vtable construction)
2924   // Note that the ordering is not alphabetical, see Symbol::fast_compare
2925   Method::sort_methods(methods);
2926 
2927   intArray* method_ordering = NULL;
2928   // If JVMTI original method ordering or sharing is enabled construct int
2929   // array remembering the original ordering
2930   if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
2931     method_ordering = new intArray(length, length, -1);
2932     for (int index = 0; index < length; index++) {
2933       Method* const m = methods->at(index);
2934       const int old_index = m->vtable_index();
2935       assert(old_index >= 0 && old_index < length, "invalid method index");
2936       method_ordering->at_put(index, old_index);
2937       m->set_vtable_index(Method::invalid_vtable_index);
2938     }
2939   }
2940   return method_ordering;
2941 }
2942 
2943 // Parse generic_signature attribute for methods and fields
2944 u2 ClassFileParser::parse_generic_signature_attribute(const ClassFileStream* const cfs,
2945                                                       TRAPS) {
2946   assert(cfs != NULL, "invariant");
2947 
2948   cfs->guarantee_more(2, CHECK_0);  // generic_signature_index
2949   const u2 generic_signature_index = cfs->get_u2_fast();
2950   check_property(
2951     valid_symbol_at(generic_signature_index),


< prev index next >