comparison graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/IntegerSnippets.java @ 7355:8c163cfda1e5

only @MethodSubstitution annotated methods are now considered to be method substitutions which allows for helper methods to be in the same class
author Doug Simon <doug.simon@oracle.com>
date Fri, 11 Jan 2013 18:26:32 +0100
parents f368ec89e231
children
comparison
equal deleted inserted replaced
7354:867ec7c2a9ca 7355:8c163cfda1e5
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 package com.oracle.graal.snippets; 23 package com.oracle.graal.snippets;
24 24
25 import com.oracle.graal.snippets.ClassSubstitution.*;
25 import com.oracle.graal.snippets.nodes.*; 26 import com.oracle.graal.snippets.nodes.*;
26 27
27 @ClassSubstitution(Integer.class) 28 @ClassSubstitution(Integer.class)
28 public class IntegerSnippets implements SnippetsInterface{ 29 public class IntegerSnippets implements SnippetsInterface{
29 30
31 @MethodSubstitution
30 public static int reverseBytes(int i) { 32 public static int reverseBytes(int i) {
31 return ReverseBytesNode.reverse(i); 33 return ReverseBytesNode.reverse(i);
32 } 34 }
33 35
36 @MethodSubstitution
34 public static int numberOfLeadingZeros(int i) { 37 public static int numberOfLeadingZeros(int i) {
35 if (i == 0) { 38 if (i == 0) {
36 return 32; 39 return 32;
37 } 40 }
38 return 31 - BitScanReverseNode.scan(i); 41 return 31 - BitScanReverseNode.scan(i);
39 } 42 }
40 43
44 @MethodSubstitution
41 public static int numberOfTrailingZeros(int i) { 45 public static int numberOfTrailingZeros(int i) {
42 if (i == 0) { 46 if (i == 0) {
43 return 32; 47 return 32;
44 } 48 }
45 return BitScanForwardNode.scan(i); 49 return BitScanForwardNode.scan(i);
46 } 50 }
47 51
52 @MethodSubstitution
48 public static int bitCount(int i) { 53 public static int bitCount(int i) {
49 return BitCountNode.bitCount(i); 54 return BitCountNode.bitCount(i);
50 } 55 }
51 } 56 }