RFR(S): 8239376: JFR: assert(!cld->is_unsafe_anonymous()) failed: invariant

coleen.phillimore at oracle.com coleen.phillimore at oracle.com
Thu Mar 5 14:27:06 UTC 2020


You don't need this code to get package() because it's a virtual 
function in Klass, and objArrayKlass will return bottom_type().

+ klass = contextual_representative(klass);
+ if (klass->is_typeArray_klass()) {
+ return 0;
+ }
+ assert(klass->is_instance_klass(), "invariant");

Or here either;

397 if (klass->is_typeArray_klass()) {
398 return NULL;
399 }
400 assert(klass->is_instance_klass(), "invariant");
401 return InstanceKlass::cast(klass)->package();


which gets rid of the InstanceKlass::cast() also.

The name contextual_representative() is really strange to read.  I'd 
just add the code inline to get_cld, to get bottom_klass().

172 static ClassLoaderData* get_cld(const Klass* klass) {
  173   assert(klass != NULL, "invariant");
  174 if (klass->is_objArrayKlass())  {
           klass = objArrayKlass::cast(klass)->bottom_klass();
       }
175   return is_unsafe_anonymous(klass) ?
  176     InstanceKlass::cast(klass)->unsafe_anonymous_host()->class_loader_data() : klass->class_loader_data();
  177 }


Coleen

On 3/5/20 8:08 AM, Markus Gronlund wrote:
> Greetings,
>
> Please review the following change set:
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8239376
> Webrev: http://cr.openjdk.java.net/~mgronlun/8239376/webrev01/
> Testing: jdk_jfr
> Description: please see bug
>
> Thanks
> Markus



More information about the hotspot-jfr-dev mailing list