blob: a75e31fee71fae4cb73673f172fb8c20cb59910a [file] [log] [blame]
The Android Open Source Projectf6c38712009-03-03 19:28:47 -08001
2class Blort {
3
4 static void methodThatNeedsInvokeRange
5 (int a, int b, int c, int d, int e, int f) {
6 }
7
8 void testNoLocals() {
9 methodThatNeedsInvokeRange(5, 0, 5, 0, 5, 0);
10 }
11
12 void testMixedLocals() {
13 int src = 6;
14 int dest = 7;
15
16 methodThatNeedsInvokeRange(src, 0, dest, 1, 5, 0);
17 methodThatNeedsInvokeRange(src, 0, dest, 1, 5, 0);
18 }
19
20 // here the current algorithm partial-overlapping will stumble a bit
21 // The register containing "zero" will be marked as "reserved for locals"
22 // Then the subsequent arraycopy will need a whole new set of 5 registers
23 void testMixedWorseCase() {
24 int src = 6;
25 int dest = 7;
26 int zero = 0;
27
28 methodThatNeedsInvokeRange(src, zero, dest, 1, 5, 0);
29 methodThatNeedsInvokeRange(src, 0, dest, 1, 5, 0);
30 }
31
32 void testAllParams(int a, int b, int c, int d, int e, int f) {
33 methodThatNeedsInvokeRange(a, b, c, d, e, f);
34 }
35
36 // this could try to make use of param positions, but doesn't
37 static void testTailParams(int destPos, int length) {
38 int src = 6;
39 int dest = 7;
40
41 methodThatNeedsInvokeRange(src, 0, dest, 0, destPos, length);
42 }
43
44
45 // This presently requires a whole N new registers
46 void testFlip() {
47 int src = 6;
48 int dest = 7;
49
50 methodThatNeedsInvokeRange(src, 0, dest, 1, 5, 0);
51 methodThatNeedsInvokeRange(dest, 0, src, 1, 5, 0);
52 }
53
54 // ensure that an attempt to combine registers for a local
55 // with a differing category doesn't mess us up.
56 long testMixedCategory(boolean foo) {
57 if (foo) {
58 int offset = 1;
59 int src = 6;
60 int dest = 7;
61
62 methodThatNeedsInvokeRange(src, 0, dest, offset, 5, 0);
63 return offset;
64 } else {
65 long offset = System.currentTimeMillis();;
66 return offset;
67 }
68 }
69}
70