-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #742 from Timbals/fix/java-bytecode-frontend
fix issues with the java bytecode frontend
- Loading branch information
Showing
36 changed files
with
1,376 additions
and
1,656 deletions.
There are no files selected for viewing
Binary file not shown.
33 changes: 33 additions & 0 deletions
33
shared-test-resources/miniTestSuite/java6/source/LocalMerging.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
public class LocalMerging { | ||
public void localMergingWithConstant(int n) { | ||
String a = "one"; | ||
// The branch returns either a local or a constant. | ||
// Because of the divergence neither `a` nor `"two"` should be inlined, | ||
// but a stack local variable should be created for holding the result of the branch. | ||
System.out.println(n == 1 ? a : "two"); | ||
} | ||
|
||
public void localMergingWithOtherLocal(int n) { | ||
String a = "one"; | ||
String b = "two"; | ||
// The branch returns either a local or a different local. | ||
// Because of the divergence neither `a` nor `b` should be inlined, | ||
// but a stack local variable should be created for holding the result of the branch. | ||
System.out.println(n == 1 ? a : b); | ||
} | ||
|
||
public void localMergingWithDuplicateValue(int n) { | ||
String a = "one"; | ||
// One of the branches for the first argument contains the constant "two" | ||
// and the second argument also contains the constant "two". | ||
// This test ensures that when the first argument gets replaced by a stack local, | ||
// the second argument isn't replaced as well. | ||
System.setProperty(n == 1 ? a : "two", "two"); | ||
} | ||
|
||
public void localMergingWithInlining(int n) { | ||
String[] arr = new String[] {"a", "b"}; | ||
int a = 1; | ||
String b = arr[n == 1 ? 0 : a]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.