Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java @ 22604:b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 08 Sep 2015 19:57:39 +0200 |
parents | 0e095e2c24e2 |
children | 05183a084a08 |
comparison
equal
deleted
inserted
replaced
22603:6d339ba0edc5 | 22604:b00cc0475f31 |
---|---|
81 public String entryName(int index) { | 81 public String entryName(int index) { |
82 return "[" + index + "]"; | 82 return "[" + index + "]"; |
83 } | 83 } |
84 | 84 |
85 @Override | 85 @Override |
86 public int entryIndexForOffset(long constantOffset, Kind expectedEntryKind) { | 86 public int entryIndexForOffset(long constantOffset, JavaKind expectedEntryKind) { |
87 return entryIndexForOffset(constantOffset, expectedEntryKind, componentType, length); | 87 return entryIndexForOffset(constantOffset, expectedEntryKind, componentType, length); |
88 } | 88 } |
89 | 89 |
90 public static int entryIndexForOffset(long constantOffset, Kind expectedEntryKind, ResolvedJavaType componentType, int length) { | 90 public static int entryIndexForOffset(long constantOffset, JavaKind expectedEntryKind, ResolvedJavaType componentType, int length) { |
91 int baseOffset; | 91 int baseOffset; |
92 int indexScale; | 92 int indexScale; |
93 switch (componentType.getKind()) { | 93 switch (componentType.getJavaKind()) { |
94 case Boolean: | 94 case Boolean: |
95 baseOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET; | 95 baseOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET; |
96 indexScale = Unsafe.ARRAY_BOOLEAN_INDEX_SCALE; | 96 indexScale = Unsafe.ARRAY_BOOLEAN_INDEX_SCALE; |
97 break; | 97 break; |
98 case Byte: | 98 case Byte: |
131 return -1; | 131 return -1; |
132 } | 132 } |
133 long offset; | 133 long offset; |
134 if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN && componentType.isPrimitive()) { | 134 if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN && componentType.isPrimitive()) { |
135 // On big endian, we do just get expect the type be right aligned in this memory slot | 135 // On big endian, we do just get expect the type be right aligned in this memory slot |
136 offset = constantOffset - (componentType.getKind().getByteCount() - Math.min(componentType.getKind().getByteCount(), 4 + expectedEntryKind.getByteCount())); | 136 offset = constantOffset - (componentType.getJavaKind().getByteCount() - Math.min(componentType.getJavaKind().getByteCount(), 4 + expectedEntryKind.getByteCount())); |
137 } else { | 137 } else { |
138 offset = constantOffset; | 138 offset = constantOffset; |
139 } | 139 } |
140 long index = offset - baseOffset; | 140 long index = offset - baseOffset; |
141 if (index % indexScale != 0) { | 141 if (index % indexScale != 0) { |
147 } | 147 } |
148 return (int) elementIndex; | 148 return (int) elementIndex; |
149 } | 149 } |
150 | 150 |
151 @Override | 151 @Override |
152 public Kind entryKind(int index) { | 152 public JavaKind entryKind(int index) { |
153 assert index >= 0 && index < length; | 153 assert index >= 0 && index < length; |
154 return componentType.getKind(); | 154 return componentType.getJavaKind(); |
155 } | 155 } |
156 | 156 |
157 @Override | 157 @Override |
158 public VirtualArrayNode duplicate() { | 158 public VirtualArrayNode duplicate() { |
159 return new VirtualArrayNode(componentType, length); | 159 return new VirtualArrayNode(componentType, length); |