Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152295

Redundant CLCs for classes resolved in both loaders

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 10
    • 9
    • hotspot
    • b21

      The code for SD::add_loader_constraint() doesn't check whether the class is already present in both loaders:

      diff --git a/src/share/vm/classfile/loaderConstraints.cpp b/src/share/vm/classfile/loaderConstraints.cpp
      --- a/src/share/vm/classfile/loaderConstraints.cpp
      +++ b/src/share/vm/classfile/loaderConstraints.cpp
      @@ -186,8 +186,9 @@
                                              Klass* klass2, Handle class_loader2) {
          int failure_code = 0; // encode different reasons for failing

      - if (klass1 != NULL && klass2 != NULL && klass1 != klass2) {
      - failure_code = 1;
      + if (klass1 != NULL && klass2 != NULL) {
      + // Same type already loaded in both places. There is no need for any constraint.
      + failure_code = (klass1 == klass2) ? 0 : 1;
          } else {
            Klass* klass = klass1 != NULL ? klass1 : klass2;

            hseigel Harold Seigel (Inactive)
            vlivanov Vladimir Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: