src/share/vm/classfile/classFileParser.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/classfile

src/share/vm/classfile/classFileParser.cpp

Print this page




   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  *
  23  */
  24 #include "precompiled.hpp"

  25 #include "classfile/classFileParser.hpp"
  26 #include "classfile/classFileStream.hpp"
  27 #include "classfile/classLoader.hpp"
  28 #include "classfile/classLoaderData.inline.hpp"
  29 #include "classfile/defaultMethods.hpp"

  30 #include "classfile/javaClasses.inline.hpp"
  31 #include "classfile/moduleEntry.hpp"
  32 #include "classfile/symbolTable.hpp"
  33 #include "classfile/systemDictionary.hpp"
  34 #include "classfile/verificationType.hpp"
  35 #include "classfile/verifier.hpp"
  36 #include "classfile/vmSymbols.hpp"
  37 #include "gc/shared/gcLocker.hpp"
  38 #include "logging/log.hpp"
  39 #include "memory/allocation.hpp"
  40 #include "memory/metadataFactory.hpp"
  41 #include "memory/oopFactory.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "memory/universe.inline.hpp"
  44 #include "oops/annotations.hpp"
  45 #include "oops/fieldStreams.hpp"
  46 #include "oops/instanceKlass.hpp"
  47 #include "oops/instanceMirrorKlass.hpp"
  48 #include "oops/klass.inline.hpp"
  49 #include "oops/klassVtable.hpp"


5173           }
5174         }
5175       } // end for
5176     } // CheckIntrinsics
5177 #endif // ASSERT
5178   }
5179 }
5180 
5181 InstanceKlass* ClassFileParser::create_instance_klass(bool changed_by_loadhook, TRAPS) {
5182   if (_klass != NULL) {
5183     return _klass;
5184   }
5185 
5186   InstanceKlass* const ik =
5187     InstanceKlass::allocate_instance_klass(*this, CHECK_NULL);
5188 
5189   fill_instance_klass(ik, changed_by_loadhook, CHECK_NULL);
5190 
5191   assert(_klass == ik, "invariant");
5192 













5193   return ik;
5194 }
5195 
5196 void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loadhook, TRAPS) {
5197   assert(ik != NULL, "invariant");
5198 
5199   set_klass_to_deallocate(ik);
5200 
5201   assert(_field_info != NULL, "invariant");
5202   assert(ik->static_field_size() == _field_info->static_field_size, "sanity");
5203   assert(ik->nonstatic_oop_map_count() == _field_info->total_oop_map_count,
5204     "sanity");
5205 
5206   assert(ik->is_instance_klass(), "sanity");
5207   assert(ik->size_helper() == _field_info->instance_size, "sanity");
5208 
5209   // Fill in information already parsed
5210   ik->set_should_verify_class(_need_verify);
5211 
5212   // Not yet: supers are done below to support the new subtype-checking fields




   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  *
  23  */
  24 #include "precompiled.hpp"
  25 #include "aot/aotLoader.hpp"
  26 #include "classfile/classFileParser.hpp"
  27 #include "classfile/classFileStream.hpp"
  28 #include "classfile/classLoader.hpp"
  29 #include "classfile/classLoaderData.inline.hpp"
  30 #include "classfile/defaultMethods.hpp"
  31 #include "classfile/dictionary.hpp"
  32 #include "classfile/javaClasses.inline.hpp"
  33 #include "classfile/moduleEntry.hpp"
  34 #include "classfile/symbolTable.hpp"
  35 #include "classfile/systemDictionary.hpp"
  36 #include "classfile/verificationType.hpp"
  37 #include "classfile/verifier.hpp"
  38 #include "classfile/vmSymbols.hpp"
  39 #include "gc/shared/gcLocker.hpp"
  40 #include "logging/log.hpp"
  41 #include "memory/allocation.hpp"
  42 #include "memory/metadataFactory.hpp"
  43 #include "memory/oopFactory.hpp"
  44 #include "memory/resourceArea.hpp"
  45 #include "memory/universe.inline.hpp"
  46 #include "oops/annotations.hpp"
  47 #include "oops/fieldStreams.hpp"
  48 #include "oops/instanceKlass.hpp"
  49 #include "oops/instanceMirrorKlass.hpp"
  50 #include "oops/klass.inline.hpp"
  51 #include "oops/klassVtable.hpp"


5175           }
5176         }
5177       } // end for
5178     } // CheckIntrinsics
5179 #endif // ASSERT
5180   }
5181 }
5182 
5183 InstanceKlass* ClassFileParser::create_instance_klass(bool changed_by_loadhook, TRAPS) {
5184   if (_klass != NULL) {
5185     return _klass;
5186   }
5187 
5188   InstanceKlass* const ik =
5189     InstanceKlass::allocate_instance_klass(*this, CHECK_NULL);
5190 
5191   fill_instance_klass(ik, changed_by_loadhook, CHECK_NULL);
5192 
5193   assert(_klass == ik, "invariant");
5194 
5195   ik->set_has_passed_fingerprint_check(false);
5196   if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
5197     uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik);
5198     if (aot_fp != 0 && aot_fp == _stream->compute_fingerprint()) {
5199       // This class matches with a class saved in an AOT library
5200       ik->set_has_passed_fingerprint_check(true);
5201     } else {
5202       ResourceMark rm;
5203       log_info(class, fingerprint)("%s :  expected = " PTR64_FORMAT " actual = " PTR64_FORMAT,
5204                                  ik->external_name(), aot_fp, _stream->compute_fingerprint());
5205     }
5206   }
5207 
5208   return ik;
5209 }
5210 
5211 void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loadhook, TRAPS) {
5212   assert(ik != NULL, "invariant");
5213 
5214   set_klass_to_deallocate(ik);
5215 
5216   assert(_field_info != NULL, "invariant");
5217   assert(ik->static_field_size() == _field_info->static_field_size, "sanity");
5218   assert(ik->nonstatic_oop_map_count() == _field_info->total_oop_map_count,
5219     "sanity");
5220 
5221   assert(ik->is_instance_klass(), "sanity");
5222   assert(ik->size_helper() == _field_info->instance_size, "sanity");
5223 
5224   // Fill in information already parsed
5225   ik->set_should_verify_class(_need_verify);
5226 
5227   // Not yet: supers are done below to support the new subtype-checking fields


src/share/vm/classfile/classFileParser.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File