Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARCKind.java @ 24127:6d70d9c43369
added ResolvedJavaType.isPlatformType (JDK-8177845)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 15 Apr 2017 23:54:19 +0200 |
parents | 1140503536ae |
children |
rev | line source |
---|---|
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
1 /* |
23738
1140503536ae
Backport style fixes and comments from jdk9.
Roland Schatz <roland.schatz@oracle.com>
parents:
23297
diff
changeset
|
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
4 * |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
8 * |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
14 * |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
18 * |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22622
diff
changeset
|
23 package jdk.vm.ci.sparc; |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22622
diff
changeset
|
25 import jdk.vm.ci.meta.PlatformKind; |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
26 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
27 public enum SPARCKind implements PlatformKind { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
28 BYTE(1), |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
29 HWORD(2), |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
30 WORD(4), |
22682
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22672
diff
changeset
|
31 XWORD(8), |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
32 SINGLE(4), |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
33 DOUBLE(8), |
22682
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22672
diff
changeset
|
34 QUAD(16), |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
35 |
22610
940b668f0809
SPARCKind: Add 32 bit vector kinds
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22604
diff
changeset
|
36 V32_BYTE(4, BYTE), |
940b668f0809
SPARCKind: Add 32 bit vector kinds
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22604
diff
changeset
|
37 V32_HWORD(4, HWORD), |
940b668f0809
SPARCKind: Add 32 bit vector kinds
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22604
diff
changeset
|
38 |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
39 V64_BYTE(8, BYTE), |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
40 V64_HWORD(8, HWORD), |
22622
111882d99400
[SPARC] canStoreValue as switch statement; new type V64_SINGLE
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22610
diff
changeset
|
41 V64_WORD(8, WORD), |
111882d99400
[SPARC] canStoreValue as switch statement; new type V64_SINGLE
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22610
diff
changeset
|
42 V64_SINGLE(8, SINGLE); |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
43 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
44 private final int size; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
45 private final int vectorLength; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
46 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
47 private final SPARCKind scalar; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
48 private final EnumKey<SPARCKind> key = new EnumKey<>(this); |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
49 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22682
diff
changeset
|
50 SPARCKind(int size) { |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
51 this.size = size; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
52 this.scalar = this; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
53 this.vectorLength = 1; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
54 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
55 |
23297
4b58c92e939b
remove redundant modifiers
Manuel Rigger <rigger.manuel@gmail.com>
parents:
22682
diff
changeset
|
56 SPARCKind(int size, SPARCKind scalar) { |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
57 this.size = size; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
58 this.scalar = scalar; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
59 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
60 assert size % scalar.size == 0; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
61 this.vectorLength = size / scalar.size; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
62 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
63 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
64 public SPARCKind getScalar() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
65 return scalar; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
66 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
67 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
68 public int getSizeInBytes() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
69 return size; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
70 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
71 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
72 public int getSizeInBits() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
73 return getSizeInBytes() * 8; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
74 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
75 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
76 public int getVectorLength() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
77 return vectorLength; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
78 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
79 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
80 public Key getKey() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
81 return key; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
82 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
83 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
84 public boolean isInteger() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
85 switch (this) { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
86 case BYTE: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
87 case HWORD: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
88 case WORD: |
22682
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22672
diff
changeset
|
89 case XWORD: |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
90 return true; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
91 default: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
92 return false; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
93 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
94 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
95 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
96 public boolean isFloat() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
97 return !isInteger(); |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
98 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
99 |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
100 public char getTypeChar() { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
101 switch (this) { |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
102 case BYTE: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
103 return 'b'; |
22622
111882d99400
[SPARC] canStoreValue as switch statement; new type V64_SINGLE
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22610
diff
changeset
|
104 case HWORD: |
111882d99400
[SPARC] canStoreValue as switch statement; new type V64_SINGLE
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22610
diff
changeset
|
105 return 'h'; |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
106 case WORD: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
107 return 'w'; |
22682
5ba5ff0fda9e
Add SPARC Quad precision registers and remove unneccesary methods from SPARC.java
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
22672
diff
changeset
|
108 case XWORD: |
22604
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
109 return 'd'; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
110 case SINGLE: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
111 return 'S'; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
112 case DOUBLE: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
113 case V64_BYTE: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
114 case V64_HWORD: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
115 case V64_WORD: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
116 return 'D'; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
117 default: |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
118 return '-'; |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
119 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
120 } |
479228019e48
[SPARC] Remove JavaKind dependency
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
diff
changeset
|
121 } |