< prev index next >

src/hotspot/share/classfile/classFileParser.cpp

Print this page




5958 }
5959 
5960 void ClassFileParser::parse_stream(const ClassFileStream* const stream,
5961                                    TRAPS) {
5962 
5963   assert(stream != NULL, "invariant");
5964   assert(_class_name != NULL, "invariant");
5965 
5966   // BEGIN STREAM PARSING
5967   stream->guarantee_more(8, CHECK);  // magic, major, minor
5968   // Magic value
5969   const u4 magic = stream->get_u4_fast();
5970   guarantee_property(magic == JAVA_CLASSFILE_MAGIC,
5971                      "Incompatible magic value %u in class file %s",
5972                      magic, CHECK);
5973 
5974   // Version numbers
5975   _minor_version = stream->get_u2_fast();
5976   _major_version = stream->get_u2_fast();
5977 
5978   if (DumpSharedSpaces && _major_version < JAVA_6_VERSION) {
5979     ResourceMark rm;
5980     warning("Pre JDK 6 class not supported by CDS: %u.%u %s",
5981             _major_version,  _minor_version, _class_name->as_C_string());
5982     Exceptions::fthrow(
5983       THREAD_AND_LOCATION,
5984       vmSymbols::java_lang_UnsupportedClassVersionError(),
5985       "Unsupported major.minor version for dump time %u.%u",
5986       _major_version,
5987       _minor_version);
5988   }
5989 
5990   // Check version numbers - we check this even with verifier off
5991   verify_class_version(_major_version, _minor_version, _class_name, CHECK);
5992 
5993   stream->guarantee_more(3, CHECK); // length, first cp tag
5994   u2 cp_size = stream->get_u2_fast();
5995 
5996   guarantee_property(
5997     cp_size >= 1, "Illegal constant pool size %u in class file %s",
5998     cp_size, CHECK);
5999 
6000   _orig_cp_size = cp_size;




5958 }
5959 
5960 void ClassFileParser::parse_stream(const ClassFileStream* const stream,
5961                                    TRAPS) {
5962 
5963   assert(stream != NULL, "invariant");
5964   assert(_class_name != NULL, "invariant");
5965 
5966   // BEGIN STREAM PARSING
5967   stream->guarantee_more(8, CHECK);  // magic, major, minor
5968   // Magic value
5969   const u4 magic = stream->get_u4_fast();
5970   guarantee_property(magic == JAVA_CLASSFILE_MAGIC,
5971                      "Incompatible magic value %u in class file %s",
5972                      magic, CHECK);
5973 
5974   // Version numbers
5975   _minor_version = stream->get_u2_fast();
5976   _major_version = stream->get_u2_fast();
5977 
5978   if (DumpSharedSpaces && _major_version < JAVA_1_5_VERSION) {
5979     ResourceMark rm;
5980     warning("Pre JDK 1.5 class not supported by CDS: %u.%u %s",
5981             _major_version,  _minor_version, _class_name->as_C_string());
5982     Exceptions::fthrow(
5983       THREAD_AND_LOCATION,
5984       vmSymbols::java_lang_UnsupportedClassVersionError(),
5985       "Unsupported major.minor version for dump time %u.%u",
5986       _major_version,
5987       _minor_version);
5988   }
5989 
5990   // Check version numbers - we check this even with verifier off
5991   verify_class_version(_major_version, _minor_version, _class_name, CHECK);
5992 
5993   stream->guarantee_more(3, CHECK); // length, first cp tag
5994   u2 cp_size = stream->get_u2_fast();
5995 
5996   guarantee_property(
5997     cp_size >= 1, "Illegal constant pool size %u in class file %s",
5998     cp_size, CHECK);
5999 
6000   _orig_cp_size = cp_size;


< prev index next >