Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: hg tip
-
Fix Version/s: 3.1.4
-
Component/s: Compiler: Optimizing
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
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
Kind regards
Laurence
bulk defer open issues to 3.1.2