Hi, David I am confused here.
As you pointed out: Java anonymous classes are not VM anonymous classes. VM anonymous classes are created by Unsafe_DefineAnonymousClass only. Is my understanding right? All all lambda classes are vm anonymous? Thanks Yumin On Fri, Jan 25, 2019 at 7:18 PM David Holmes <david.hol...@oracle.com> wrote: > <dropped jdk-dev> > > On 25/01/2019 6:52 pm, yumin qi wrote: > > Hi, > > > > I have a question of anonymous class. We know the anonymous class > with a > > host_klass, and the flag is set when the InstanceKlass is created after > the > > class parsed. In case of a regular java class file, the flag will be set > > correctly but for the case it is not set: > > SystemDictionary::parse_stream or resolve_from_stream, which is called > > from JVM_DefineClassWithSource or jni_defineClass. The stack trace like: > > > > #1 0x00007f1127291ce7 in > > SystemDictionary::resolve_from_stream(class_name=0x7f0ee40243f0, > > class_loader=..., protection_domain=...,d__=0x7f0f04001000) at > > > /home/ws/openjdk/8/jdk8u/hotspot/src/share/vm/classfile/systemDictionaryShared.cpp:656 > > #1 0x00007f1127291ce7 in SystemDictionary::resolve_from_stream > > (class_name=0x7f0ee40243f0, class_loader=..., protection_doma > > in=..., > > st=0x7f0f0a5f3850, verify=true, __the_thread__=0x7f0f04001000) > > at > > > /home/ws/openjdk/8/jdk8u/hotspot/src/share/vm/classfile/systemDictionary.cpp:1234 > > #2 0x00007f1126f3cadb in jvm_define_class_common (env=0x7f0f04001220, > > name=0x7f0f0a5f3e60 "com/google/common/collect/Iterato > > rs$3", > > loader=0x7f0f0a5f3f20, buf=0x7f0ee401e210 "\312\376\272\276", > len=943, > > pd=0x7f0f0a5f3f48, > > source=0x7f0f0a5f3a60 "jar:file:/home/<...>/lib/guava-19.0.jar!/", > > verify=1 '\001', __the_thread__=0x7f0f04001000) at > > /home/yumin.qi/ws/openjdk/8/jdk8u/hotspot/src/share/vm/prims/jvm.cpp:1082 > > #3 0x00007f1126f3d019 in JVM_DefineClassWithSource (env=0x7f0f04001220, > > name=0x7f0f0a5f3e60 "com/google/common/collect/Itera > > tors$3", > > loader=0x7f0f0a5f3f20, buf=0x7f0ee401e210 "\312\376\272\276", > len=943, > > pd=0x7f0f0a5f3f48, > > source=0x7f0f0a5f3a60 "jar:file:/home/<...>/lib/guava-19.0.jar!/") > at > > /home/ws/openjdk/8/jdk8u/hotspot/src/share/vm/prim/jvm.cpp:1102 > > #4 0x00007f112581214f in Java_java_lang_ClassLoader_defineClass1 () > > from > > > /home/ws/openjdk/8/jdk8u/build/linux-x86_64-normal-server-slowdebug/images/j2sdk-image/jre/lib/amd64/libjava.so > > #5 0x00007f11118f5402 in ?? () > > #6 0x00007f0f0a5f3f48 in ?? () > > #7 0x00007f0f0a5f3f70 in ?? () > > #8 0x0000000755dbbc28 in ?? () > > > > The class name is com.google.common.collect.Iterators$3, and it is an > > anonymous class. > > I'm confused. Are you talking about Java level anonymous classes or VM > anonymous classes as created by Unsafe.defineAnonymousClass? Only VM > anonymous classes have a "host class". Java level "anonymous classes" > are just regular classes. > > David > ----- > > > > > This is an example using Guava. I also can reproduce with jdk13. > > > > The field after parsing: > > > > _nonstatic_oop_map_size = 1, > > _is_marked_dependent = false, > > _has_unloaded_dependent = false, > > _misc_flags = 38, ////// <------------ not set for anonymous > > _minor_version = 0, > > _major_version = 50, > > _init_thread = 0x0, > > _vtable_len = 8, > > _itable_len = 8, > > > > This path is from a custom loader defining a anonymous class, does not > > set anonymous correctly for the flag. Is this a bug? If in java land, > > supply a host as parameter, it can be set correctly in VM part. Should I > > file a bug for it? > > > > Thanks > > Yumin > > >