< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page




5385           const char * to = k->external_name();
5386           log_debug(class, resolve)("%s %s (interface)", from, to);
5387         }
5388       }
5389     }
5390   }
5391 
5392   TRACE_INIT_KLASS_ID(ik);
5393 
5394   // If we reach here, all is well.
5395   // Now remove the InstanceKlass* from the _klass_to_deallocate field
5396   // in order for it to not be destroyed in the ClassFileParser destructor.
5397   set_klass_to_deallocate(NULL);
5398 
5399   // it's official
5400   set_klass(ik);
5401 
5402   debug_only(ik->verify();)
5403 }
5404 










5405 ClassFileParser::ClassFileParser(ClassFileStream* stream,
5406                                  Symbol* name,
5407                                  ClassLoaderData* loader_data,
5408                                  Handle protection_domain,
5409                                  const Klass* host_klass,
5410                                  GrowableArray<Handle>* cp_patches,
5411                                  Publicity pub_level,
5412                                  TRAPS) :
5413   _stream(stream),
5414   _requested_name(name),
5415   _loader_data(loader_data),
5416   _host_klass(host_klass),
5417   _cp_patches(cp_patches),
5418   _super_klass(),
5419   _cp(NULL),
5420   _fields(NULL),
5421   _methods(NULL),
5422   _inner_classes(NULL),
5423   _local_interfaces(NULL),
5424   _transitive_interfaces(NULL),


5473   assert(0 == _access_flags.as_int(), "invariant");
5474 
5475   // Figure out whether we can skip format checking (matching classic VM behavior)
5476   if (DumpSharedSpaces) {
5477     // verify == true means it's a 'remote' class (i.e., non-boot class)
5478     // Verification decision is based on BytecodeVerificationRemote flag
5479     // for those classes.
5480     _need_verify = (stream->need_verify()) ? BytecodeVerificationRemote :
5481                                               BytecodeVerificationLocal;
5482   }
5483   else {
5484     _need_verify = Verifier::should_verify_for(_loader_data->class_loader(),
5485                                                stream->need_verify());
5486   }
5487 
5488   // synch back verification state to stream
5489   stream->set_verify(_need_verify);
5490 
5491   // Check if verification needs to be relaxed for this class file
5492   // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
5493   _relax_verify = Verifier::relax_verify_for(_loader_data->class_loader());

5494 
5495   parse_stream(stream, CHECK);
5496 
5497   post_process_parsed_stream(stream, _cp, CHECK);
5498 }
5499 
5500 void ClassFileParser::clear_class_metadata() {
5501   // metadata created before the instance klass is created.  Must be
5502   // deallocated if classfile parsing returns an error.
5503   _cp = NULL;
5504   _fields = NULL;
5505   _methods = NULL;
5506   _inner_classes = NULL;
5507   _local_interfaces = NULL;
5508   _transitive_interfaces = NULL;
5509   _combined_annotations = NULL;
5510   _annotations = _type_annotations = NULL;
5511   _fields_annotations = _fields_type_annotations = NULL;
5512 }
5513 




5385           const char * to = k->external_name();
5386           log_debug(class, resolve)("%s %s (interface)", from, to);
5387         }
5388       }
5389     }
5390   }
5391 
5392   TRACE_INIT_KLASS_ID(ik);
5393 
5394   // If we reach here, all is well.
5395   // Now remove the InstanceKlass* from the _klass_to_deallocate field
5396   // in order for it to not be destroyed in the ClassFileParser destructor.
5397   set_klass_to_deallocate(NULL);
5398 
5399   // it's official
5400   set_klass(ik);
5401 
5402   debug_only(ik->verify();)
5403 }
5404 
5405 static bool relax_format_check_for(oop loader, bool boot_loader) {
5406   bool trusted = boot_loader || SystemDictionary::is_platform_class_loader(loader);
5407   bool need_verify =
5408     // verifyAll
5409     (BytecodeVerificationLocal && BytecodeVerificationRemote) ||
5410     // verifyRemote
5411     (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted);
5412   return !need_verify;
5413 }
5414 
5415 ClassFileParser::ClassFileParser(ClassFileStream* stream,
5416                                  Symbol* name,
5417                                  ClassLoaderData* loader_data,
5418                                  Handle protection_domain,
5419                                  const Klass* host_klass,
5420                                  GrowableArray<Handle>* cp_patches,
5421                                  Publicity pub_level,
5422                                  TRAPS) :
5423   _stream(stream),
5424   _requested_name(name),
5425   _loader_data(loader_data),
5426   _host_klass(host_klass),
5427   _cp_patches(cp_patches),
5428   _super_klass(),
5429   _cp(NULL),
5430   _fields(NULL),
5431   _methods(NULL),
5432   _inner_classes(NULL),
5433   _local_interfaces(NULL),
5434   _transitive_interfaces(NULL),


5483   assert(0 == _access_flags.as_int(), "invariant");
5484 
5485   // Figure out whether we can skip format checking (matching classic VM behavior)
5486   if (DumpSharedSpaces) {
5487     // verify == true means it's a 'remote' class (i.e., non-boot class)
5488     // Verification decision is based on BytecodeVerificationRemote flag
5489     // for those classes.
5490     _need_verify = (stream->need_verify()) ? BytecodeVerificationRemote :
5491                                               BytecodeVerificationLocal;
5492   }
5493   else {
5494     _need_verify = Verifier::should_verify_for(_loader_data->class_loader(),
5495                                                stream->need_verify());
5496   }
5497 
5498   // synch back verification state to stream
5499   stream->set_verify(_need_verify);
5500 
5501   // Check if verification needs to be relaxed for this class file
5502   // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
5503   _relax_verify = relax_format_check_for(_loader_data->class_loader(),
5504                                          _loader_data->is_the_null_class_loader_data());
5505 
5506   parse_stream(stream, CHECK);
5507 
5508   post_process_parsed_stream(stream, _cp, CHECK);
5509 }
5510 
5511 void ClassFileParser::clear_class_metadata() {
5512   // metadata created before the instance klass is created.  Must be
5513   // deallocated if classfile parsing returns an error.
5514   _cp = NULL;
5515   _fields = NULL;
5516   _methods = NULL;
5517   _inner_classes = NULL;
5518   _local_interfaces = NULL;
5519   _transitive_interfaces = NULL;
5520   _combined_annotations = NULL;
5521   _annotations = _type_annotations = NULL;
5522   _fields_annotations = _fields_type_annotations = NULL;
5523 }
5524 


< prev index next >