Uploaded image for project: 'JikesRVM'
  1. JikesRVM
  2. RVM-857

Changes to Strings made via JNI do not propagate back

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Not A Bug
    • Affects Version/s: git tip
    • Fix Version/s: 3.1.4
    • Component/s: Compiler: Optimizing
    • Labels:
      None

      Description

      The attached test highlights a problem with the optimising compiler and the JNI test-suite

      The optimising compiler incorrectly assumes that Strings can not change across a native method call when a reference to the string is passed as an argument. This causes the following code from the JNI StringRegion test to fail:

      static native int testStringCritical(String s);
      <snip>
      String inputStr = "Live Free or Die";
      <snip>
      ret = testStringCritical(inputStr); // testStringCritical changes the string pointed to by inputStr to "Free Java or Die"
      checkTest(ret, inputStr.equals("Free Java or Die"), "StringCritical");

      To recreate this error:
      i) Apply the attached patch which defines a new test-run
      ii) Run the new test run by ant -f test.xml -Dhost.name=<your_host_type_here> -Dtest-run.name=jniOptimisationError

      The test-run will build a production version of the RVM and then run the JNI test suite twice. The first time it specifies -X:aos:initial_compiler=base and all tests complete correctly, the second time the production RVM is run with -X:aos:initial_compiler=opt and the StringRegion test will fail.

      I guess some sort of guard or dependency needs to be added to the opt compiler but I'm not sure where exactly

      It's worth pointing out that this error could have been caught by the nightly stress regression run but the specified extra.args (-X:aos:enable_recompilation=false -X:aos:initial_compiler=opt -X:irc:O1) in stress.properties are not being propagated through to the RVM at runtime. It's not clear to me if this is intentional or just an oversight (edit: the non-propagation of properties was not intentional and has been fixed (see RVM-1035 Closed ))

      Kind regards
      Laurence

        Attachments

          Activity

            People

            • Assignee:
              ebrangs Erik Brangs
              Reporter:
              l.hellyer@kent.ac.uk Laurence Hellyer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: