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

[lworld] Further optimize loading/storing element of known type to object array

    Details

      Description

      JDK-8227634 optimized object array accesses when casting an element loaded from an array to a known type or storing an object of a known type to an array. This optimization should be extended to also work when the type is only known after parsing. For example:

          Integer test90_value = new Integer(rI);

          @ForceInline
          public Object test90_value() {
              return test90_value;
          }

          // Same as test81 but with type only known after inlining
          @Test(failOn = ALLOC_G + ALLOCA_G + LOAD_UNKNOWN_VALUE + STORE_UNKNOWN_VALUE + VALUE_ARRAY_NULL_GUARD)
          public Object test90(Object[] array, Object o, int i) {
              Object v = test90_value();
              if (v == null) {
                return null;
              }
              array[0] = v;
              array[1] = array[0];
              array[2] = o;
              return array[i];
          }

          @DontCompile
          public void test90_verifier(boolean warmup) {
              Integer i = new Integer(rI);
              Integer[] array1 = new Integer[3];
              Object[] array2 = new Object[3];
              Object result = test90(array1, i, 0);
              Asserts.assertEquals(array1[0], i);
              Asserts.assertEquals(array1[1], i);
              Asserts.assertEquals(array1[2], i);
              Asserts.assertEquals(result, i);
              result = test90(array2, i, 1);
              Asserts.assertEquals(array2[0], i);
              Asserts.assertEquals(array2[1], i);
              Asserts.assertEquals(array2[2], i);
              Asserts.assertEquals(result, i);
          }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                thartmann Tobias Hartmann
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: