comparison src/share/vm/oops/instanceKlass.hpp @ 8719:c8b31b461e1a

8003419: NPG: Clean up metadata created during class loading if failure Summary: Store metadata on ClassFileParser instance to be cleaned up by destructor. This enabled some refactoring of the enormous parseClassFile function. Reviewed-by: jmasa, acorn
author coleenp
date Wed, 13 Mar 2013 17:34:29 -0400
parents 35ef86296a5d
children b9a918201d47 6337ca4dcad8
comparison
equal deleted inserted replaced
8718:0ede345ec7c9 8719:c8b31b461e1a
145 int nonstatic_oop_map_size, 145 int nonstatic_oop_map_size,
146 ReferenceType rt, 146 ReferenceType rt,
147 AccessFlags access_flags, 147 AccessFlags access_flags,
148 bool is_anonymous); 148 bool is_anonymous);
149 public: 149 public:
150 static Klass* allocate_instance_klass(ClassLoaderData* loader_data, 150 static InstanceKlass* allocate_instance_klass(
151 ClassLoaderData* loader_data,
151 int vtable_len, 152 int vtable_len,
152 int itable_len, 153 int itable_len,
153 int static_field_size, 154 int static_field_size,
154 int nonstatic_oop_map_size, 155 int nonstatic_oop_map_size,
155 ReferenceType rt, 156 ReferenceType rt,
264 // Place the _init_state here to utilize the unused 2-byte after 265 // Place the _init_state here to utilize the unused 2-byte after
265 // _idnum_allocated_count. 266 // _idnum_allocated_count.
266 u1 _init_state; // state of class 267 u1 _init_state; // state of class
267 u1 _reference_type; // reference type 268 u1 _reference_type; // reference type
268 269
269
270 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration 270 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
271 271
272 NOT_PRODUCT(int _verify_count;) // to avoid redundant verifies 272 NOT_PRODUCT(int _verify_count;) // to avoid redundant verifies
273 273
274 // Method array. 274 // Method array.
356 Method* method_with_idnum(int idnum); 356 Method* method_with_idnum(int idnum);
357 357
358 // method ordering 358 // method ordering
359 Array<int>* method_ordering() const { return _method_ordering; } 359 Array<int>* method_ordering() const { return _method_ordering; }
360 void set_method_ordering(Array<int>* m) { _method_ordering = m; } 360 void set_method_ordering(Array<int>* m) { _method_ordering = m; }
361 void copy_method_ordering(intArray* m, TRAPS);
361 362
362 // interfaces 363 // interfaces
363 Array<Klass*>* local_interfaces() const { return _local_interfaces; } 364 Array<Klass*>* local_interfaces() const { return _local_interfaces; }
364 void set_local_interfaces(Array<Klass*>* a) { 365 void set_local_interfaces(Array<Klass*>* a) {
365 guarantee(_local_interfaces == NULL || a == NULL, "Just checking"); 366 guarantee(_local_interfaces == NULL || a == NULL, "Just checking");
366 _local_interfaces = a; } 367 _local_interfaces = a; }
368
367 Array<Klass*>* transitive_interfaces() const { return _transitive_interfaces; } 369 Array<Klass*>* transitive_interfaces() const { return _transitive_interfaces; }
368 void set_transitive_interfaces(Array<Klass*>* a) { 370 void set_transitive_interfaces(Array<Klass*>* a) {
369 guarantee(_transitive_interfaces == NULL || a == NULL, "Just checking"); 371 guarantee(_transitive_interfaces == NULL || a == NULL, "Just checking");
370 _transitive_interfaces = a; } 372 _transitive_interfaces = a;
373 }
371 374
372 private: 375 private:
373 friend class fieldDescriptor; 376 friend class fieldDescriptor;
374 FieldInfo* field(int index) const { return FieldInfo::from_field_array(_fields, index); } 377 FieldInfo* field(int index) const { return FieldInfo::from_field_array(_fields, index); }
375 378
381 384
382 // Number of Java declared fields 385 // Number of Java declared fields
383 int java_fields_count() const { return (int)_java_fields_count; } 386 int java_fields_count() const { return (int)_java_fields_count; }
384 387
385 Array<u2>* fields() const { return _fields; } 388 Array<u2>* fields() const { return _fields; }
386
387 void set_fields(Array<u2>* f, u2 java_fields_count) { 389 void set_fields(Array<u2>* f, u2 java_fields_count) {
388 guarantee(_fields == NULL || f == NULL, "Just checking"); 390 guarantee(_fields == NULL || f == NULL, "Just checking");
389 _fields = f; 391 _fields = f;
390 _java_fields_count = java_fields_count; 392 _java_fields_count = java_fields_count;
391 } 393 }
392 394
393 // inner classes 395 // inner classes
394 Array<u2>* inner_classes() const { return _inner_classes; } 396 Array<u2>* inner_classes() const { return _inner_classes; }
914 916
915 void clean_implementors_list(BoolObjectClosure* is_alive); 917 void clean_implementors_list(BoolObjectClosure* is_alive);
916 void clean_method_data(BoolObjectClosure* is_alive); 918 void clean_method_data(BoolObjectClosure* is_alive);
917 919
918 // Explicit metaspace deallocation of fields 920 // Explicit metaspace deallocation of fields
919 // For RedefineClasses, we need to deallocate instanceKlasses 921 // For RedefineClasses and class file parsing errors, we need to deallocate
922 // instanceKlasses and the metadata they point to.
920 void deallocate_contents(ClassLoaderData* loader_data); 923 void deallocate_contents(ClassLoaderData* loader_data);
924 static void deallocate_methods(ClassLoaderData* loader_data,
925 Array<Method*>* methods);
926 void static deallocate_interfaces(ClassLoaderData* loader_data,
927 Klass* super_klass,
928 Array<Klass*>* local_interfaces,
929 Array<Klass*>* transitive_interfaces);
921 930
922 // The constant pool is on stack if any of the methods are executing or 931 // The constant pool is on stack if any of the methods are executing or
923 // referenced by handles. 932 // referenced by handles.
924 bool on_stack() const { return _constants->on_stack(); } 933 bool on_stack() const { return _constants->on_stack(); }
925 934