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

Mismatched access detection is inaccurate

    Details

    • Subcomponent:
    • Resolved In Build:
      b110

      Description

      Mismatched access detection is too coarse, e.g. Unsafe.getBoolean() from boolean[] instance is considered mismatched.

      http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/tip/src/share/vm/opto/library_call.cpp#l2532:
      bool mismatched = false;
        if (alias_type->element() != NULL || alias_type->field() != NULL) {
          BasicType bt;
          if (alias_type->element() != NULL) {
            const Type* element = alias_type->element();
            bt = element->isa_narrowoop() ? T_OBJECT : element->array_element_basic_type();
          } else {
            bt = alias_type->field()->type()->basic_type();
          }
          if (bt == T_ARRAY) {
            // accessing an array field with getObject is not a mismatch
            bt = T_OBJECT;
          }
          if (bt != type) {
            mismatched = true;
          }
        }

      $ p alias_type->_adr_type
      byte[int:>=0]:exact+any *

      $ adr_type->dump()
      stable:bool[int:2]<ciTypeArray length=2 type=<ciTypeArrayKlass name=[Z ident=1036 address=0x0000000105037750> ident=1051 SCAVENGABLE address=0x00000001009dd030>[0] *

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vlivanov Vladimir Ivanov
                Reporter:
                vlivanov Vladimir Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: