comparison graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StringSwitchTest.java @ 14906:f3a5036cc13c

javadoc fixes javadoc has become stricter in jdk8
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 31 Mar 2014 20:51:09 +0200
parents f705fc04faa5
children 64dcb92ee75a
comparison
equal deleted inserted replaced
14905:b7afc71535d3 14906:f3a5036cc13c
28 import org.junit.Test; 28 import org.junit.Test;
29 import com.oracle.graal.compiler.hsail.test.infra.*; 29 import com.oracle.graal.compiler.hsail.test.infra.*;
30 30
31 /** 31 /**
32 * Tests switch statement with String literal keys. 32 * Tests switch statement with String literal keys.
33 * 33 *
34 * Note: In Java bytecode, this example reduces to a LOOKUPSWITCH over int keys because the Java 34 * Note: In Java bytecode, this example reduces to a LOOKUPSWITCH over int keys because the Java
35 * source compiler generates a call to String.hashcode( ) to convert to int values. 35 * source compiler generates a call to String.hashcode( ) to convert to int values.
36 * 36 *
37 * The HSAIL code generated for this example is a series of cascading compare and branch 37 * The HSAIL code generated for this example is a series of cascading compare and branch
38 * instructions for each case of the switch. 38 * instructions for each case of the switch.
39 * 39 *
40 * These instruction have the following form: 40 * These instruction have the following form:
41 * 41 *
42 * 42 *
43 * //Check whether the key matches the key constant of the case. Store the result of the compare (0 43 * //Check whether the key matches the key constant of the case. Store the result of the compare (0
44 * or 1) in the control register c0. 44 * or 1) in the control register c0.
45 * 45 *
46 * cmp_eq $c0 <source register>, <key constant for case statement> 46 * cmp_eq $c0 &lt;source register&gt;, &lt;key constant for case statement&gt;
47 * 47 *
48 * //Branch to the corresponding label of that case if there's a match. 48 * //Branch to the corresponding label of that case if there's a match.
49 * 49 *
50 * cbr $c0 <branch target for that case> 50 * cbr $c0 &lt;branch target for that case&gt;
51 */ 51 */
52 public class StringSwitchTest extends GraalKernelTester { 52 public class StringSwitchTest extends GraalKernelTester {
53 53
54 static final int num = 40; 54 static final int num = 40;
55 // Output array storing the results of the operations. 55 // Output array storing the results of the operations.
60 "Honda Civic", "Jeeo Wrangler", "Toyota", "Mustang", "Chrysler", "Subaru"}; 60 "Honda Civic", "Jeeo Wrangler", "Toyota", "Mustang", "Chrysler", "Subaru"};
61 61
62 /** 62 /**
63 * The static "kernel" method we will be testing. This method performs a switch statement over a 63 * The static "kernel" method we will be testing. This method performs a switch statement over a
64 * String literal key. 64 * String literal key.
65 * 65 *
66 * @param out the output array 66 * @param out the output array
67 * @param ina the input array of String literal keys 67 * @param ina the input array of String literal keys
68 * @param gid the parameter used to index into the input and output arrays 68 * @param gid the parameter used to index into the input and output arrays
69 */ 69 */
70 public static void run(int[] out, String[] ina, int gid) { 70 public static void run(int[] out, String[] ina, int gid) {
131 super.testGeneratedHsail(); 131 super.testGeneratedHsail();
132 } 132 }
133 133
134 /** 134 /**
135 * Initializes the input and output arrays passed to the run routine. 135 * Initializes the input and output arrays passed to the run routine.
136 * 136 *
137 * @param in the input array 137 * @param in the input array
138 */ 138 */
139 void setupArrays(String[] in) { 139 void setupArrays(String[] in) {
140 for (int i = 0; i < num; i++) { 140 for (int i = 0; i < num; i++) {
141 // fill the input array with Strings. 141 // fill the input array with Strings.