Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classFileParser.cpp @ 7185:90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
Summary: Add ClassLoaderData object for each anonymous class with metaspaces to allocate in.
Reviewed-by: twisti, jrose, stefank
author | coleenp |
---|---|
date | Thu, 29 Nov 2012 16:50:29 -0500 |
parents | 070d523b96a7 |
children | 5fafdef522c6 |
comparison
equal
deleted
inserted
replaced
7181:2fc0334f613a | 7185:90273fc0a981 |
---|---|
2948 } | 2948 } |
2949 #endif // ndef PRODUCT | 2949 #endif // ndef PRODUCT |
2950 | 2950 |
2951 | 2951 |
2952 instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, | 2952 instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, |
2953 Handle class_loader, | 2953 ClassLoaderData* loader_data, |
2954 Handle protection_domain, | 2954 Handle protection_domain, |
2955 KlassHandle host_klass, | 2955 KlassHandle host_klass, |
2956 GrowableArray<Handle>* cp_patches, | 2956 GrowableArray<Handle>* cp_patches, |
2957 TempNewSymbol& parsed_name, | 2957 TempNewSymbol& parsed_name, |
2958 bool verify, | 2958 bool verify, |
2962 // If RedefineClasses() was used before the retransformable | 2962 // If RedefineClasses() was used before the retransformable |
2963 // agent attached, then the cached class bytes may not be the | 2963 // agent attached, then the cached class bytes may not be the |
2964 // original class bytes. | 2964 // original class bytes. |
2965 unsigned char *cached_class_file_bytes = NULL; | 2965 unsigned char *cached_class_file_bytes = NULL; |
2966 jint cached_class_file_length; | 2966 jint cached_class_file_length; |
2967 ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader()); | 2967 Handle class_loader(THREAD, loader_data->class_loader()); |
2968 bool has_default_methods = false; | 2968 bool has_default_methods = false; |
2969 ResourceMark rm(THREAD); | 2969 ResourceMark rm(THREAD); |
2970 | 2970 |
2971 ClassFileStream* cfs = stream(); | 2971 ClassFileStream* cfs = stream(); |
2972 // Timing | 2972 // Timing |
3003 } | 3003 } |
3004 | 3004 |
3005 unsigned char* ptr = cfs->buffer(); | 3005 unsigned char* ptr = cfs->buffer(); |
3006 unsigned char* end_ptr = cfs->buffer() + cfs->length(); | 3006 unsigned char* end_ptr = cfs->buffer() + cfs->length(); |
3007 | 3007 |
3008 JvmtiExport::post_class_file_load_hook(name, class_loader, protection_domain, | 3008 JvmtiExport::post_class_file_load_hook(name, class_loader(), protection_domain, |
3009 &ptr, &end_ptr, | 3009 &ptr, &end_ptr, |
3010 &cached_class_file_bytes, | 3010 &cached_class_file_bytes, |
3011 &cached_class_file_length); | 3011 &cached_class_file_length); |
3012 | 3012 |
3013 if (ptr != cfs->buffer()) { | 3013 if (ptr != cfs->buffer()) { |
4002 // If it cannot be fast-path allocated, set a bit in the layout helper. | 4002 // If it cannot be fast-path allocated, set a bit in the layout helper. |
4003 // See documentation of InstanceKlass::can_be_fastpath_allocated(). | 4003 // See documentation of InstanceKlass::can_be_fastpath_allocated(). |
4004 assert(k->size_helper() > 0, "layout_helper is initialized"); | 4004 assert(k->size_helper() > 0, "layout_helper is initialized"); |
4005 if ((!RegisterFinalizersAtInit && k->has_finalizer()) | 4005 if ((!RegisterFinalizersAtInit && k->has_finalizer()) |
4006 || k->is_abstract() || k->is_interface() | 4006 || k->is_abstract() || k->is_interface() |
4007 || (k->name() == vmSymbols::java_lang_Class() | 4007 || (k->name() == vmSymbols::java_lang_Class() && k->class_loader() == NULL) |
4008 && k->class_loader_data()->is_the_null_class_loader_data()) | |
4009 || k->size_helper() >= FastAllocateSizeLimit) { | 4008 || k->size_helper() >= FastAllocateSizeLimit) { |
4010 // Forbid fast-path allocation. | 4009 // Forbid fast-path allocation. |
4011 jint lh = Klass::instance_layout_helper(k->size_helper(), true); | 4010 jint lh = Klass::instance_layout_helper(k->size_helper(), true); |
4012 k->set_layout_helper(lh); | 4011 k->set_layout_helper(lh); |
4013 } | 4012 } |