1 /* 2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 /* 24 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 25 */ 26 /* 27 */ 28 29 30 package org.graalvm.compiler.jtt.micro; 31 32 import org.junit.Test; 33 34 import org.graalvm.compiler.jtt.JTTTest; 35 36 public class BigParamsAlignment extends JTTTest { 37 test(int num)38 public static int test(int num) { 39 int sum = 0; 40 if (num == 0) { 41 sum += testA(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); 42 sum += testA(1, 1, 2, 3, 4, 5, 6, 7, 8, 9); 43 sum += testA(2, 1, 2, 3, 4, 5, 6, 7, 8, 9); 44 sum += testA(3, 1, 2, 3, 4, 5, 6, 7, 8, 9); 45 sum += testA(4, 1, 2, 3, 4, 5, 6, 7, 8, 9); 46 sum += testA(5, 1, 2, 3, 4, 5, 6, 7, 8, 9); 47 sum += testA(6, 1, 2, 3, 4, 5, 6, 7, 8, 9); 48 sum += testA(7, 1, 2, 3, 4, 5, 6, 7, 8, 9); 49 sum += testA(8, 1, 2, 3, 4, 5, 6, 7, 8, 9); 50 } else if (num == 1) { 51 sum += testB(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 52 sum += testB(1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 53 sum += testB(2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 54 sum += testB(3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 55 sum += testB(4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 56 sum += testB(5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 57 sum += testB(6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 58 sum += testB(7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 59 sum += testB(8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 60 sum += testB(9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 61 } else if (num == 2) { 62 for (int i = 0; i < 9; i++) { 63 sum += testA(i, 1, 2, 3, 4, 5, 6, 7, 8, 9); 64 } 65 } else if (num == 3) { 66 for (int i = 0; i < 10; i++) { 67 sum += testB(i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); 68 } 69 } else if (num == 4) { 70 for (int i = 0; i < 11; i++) { 71 sum += testC(i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); 72 } 73 } else if (num == 5) { 74 for (int i = 0; i < 12; i++) { 75 sum += testD(i, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); 76 } 77 } 78 return sum; 79 } 80 testA(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)81 private static int testA(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) { 82 switch (choice) { 83 case 0: 84 return p0; 85 case 1: 86 return p1; 87 case 2: 88 return p2; 89 case 3: 90 return p3; 91 case 4: 92 return p4; 93 case 5: 94 return p5; 95 case 6: 96 return p6; 97 case 7: 98 return p7; 99 case 8: 100 return p8; 101 } 102 return 42; 103 } 104 testB(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9)105 private static int testB(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9) { 106 switch (choice) { 107 case 0: 108 return p0; 109 case 1: 110 return p1; 111 case 2: 112 return p2; 113 case 3: 114 return p3; 115 case 4: 116 return p4; 117 case 5: 118 return p5; 119 case 6: 120 return p6; 121 case 7: 122 return p7; 123 case 8: 124 return p8; 125 case 9: 126 return p9; 127 } 128 return 42; 129 } 130 testC(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10)131 private static int testC(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10) { 132 switch (choice) { 133 case 0: 134 return p0; 135 case 1: 136 return p1; 137 case 2: 138 return p2; 139 case 3: 140 return p3; 141 case 4: 142 return p4; 143 case 5: 144 return p5; 145 case 6: 146 return p6; 147 case 7: 148 return p7; 149 case 8: 150 return p8; 151 case 9: 152 return p9; 153 case 10: 154 return p10; 155 } 156 return 42; 157 } 158 testD(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11)159 private static int testD(int choice, int p0, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11) { 160 switch (choice) { 161 case 0: 162 return p0; 163 case 1: 164 return p1; 165 case 2: 166 return p2; 167 case 3: 168 return p3; 169 case 4: 170 return p4; 171 case 5: 172 return p5; 173 case 6: 174 return p6; 175 case 7: 176 return p7; 177 case 8: 178 return p8; 179 case 9: 180 return p9; 181 case 10: 182 return p10; 183 case 11: 184 return p11; 185 } 186 return 42; 187 } 188 189 @Test run0()190 public void run0() throws Throwable { 191 runTest("test", 0); 192 } 193 194 @Test run1()195 public void run1() throws Throwable { 196 runTest("test", 1); 197 } 198 199 @Test run2()200 public void run2() throws Throwable { 201 runTest("test", 2); 202 } 203 204 @Test run3()205 public void run3() throws Throwable { 206 runTest("test", 3); 207 } 208 209 @Test run4()210 public void run4() throws Throwable { 211 runTest("test", 4); 212 } 213 214 @Test run5()215 public void run5() throws Throwable { 216 runTest("test", 5); 217 } 218 219 @Test run6()220 public void run6() throws Throwable { 221 runTest("test", 6); 222 } 223 224 } 225