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

AddressLayout access fails on 32-bit platforms

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      32Bit System!

      A DESCRIPTION OF THE PROBLEM :
      running the testcode on a 32bit system I got the following exception:
      java.lang.IllegalArgumentException: filterFromTarget filter type does not match target var handle type: (long)MemorySegment, int

      The addresses are java int not long on 32bit systems.

      REGRESSION : Last worked in version 23.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run provided junit test case.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      test pass
      ACTUAL -
      exception thrown

      ---------- BEGIN SOURCE ----------
       @Test
          public void testSetAddressOn32bitAdresses() {
              final Arena arena = Arena.ofConfined();
              final MemorySegment mem = arena.allocate(1024);
              //next call fails on i386!
              mem.set(ValueLayout.ADDRESS, 0, MemorySegment.ofAddress(0xfedcba9876543210L));
              MemorySegment ms = mem.get(ValueLayout.ADDRESS, 0);
              //make sure we do fail on 64 bit!!
              Assertions.assertEquals("0", Long.toHexString(ms.address() & 0xffffffff00000000L), "Please do not test on 64 bit system, its a 32 bit bug!");
              Assertions.assertEquals("76543210", Long.toHexString(ms.address()));
          }
      ---------- END SOURCE ----------

            liach Chen Liang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: