Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ValueKind.java @ 23718:0bd91cd9869d
need to be able to copy internal arrays from LocalVariableTable and LineNumberTable (JDK-8160647)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 30 Jun 2016 22:08:57 +0200 |
parents | c351824fff81 |
children |
rev | line source |
---|---|
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
1 /* |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
4 * |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
8 * |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
14 * |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
18 * |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
21 * questions. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
22 */ |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
23 package jdk.vm.ci.meta; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
24 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
25 /** |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
26 * Represents the type of {@link Value values}. This class can be extended by compilers to track |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
27 * additional information about values. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
28 */ |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
29 public abstract class ValueKind<K extends ValueKind<K>> { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
30 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
31 private enum IllegalKind implements PlatformKind { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
32 ILLEGAL; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
33 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
34 private final EnumKey<IllegalKind> key = new EnumKey<>(this); |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
35 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
36 public Key getKey() { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
37 return key; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
38 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
39 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
40 public int getSizeInBytes() { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
41 return 0; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
42 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
43 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
44 public int getVectorLength() { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
45 return 0; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
46 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
47 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
48 public char getTypeChar() { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
49 return '-'; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
50 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
51 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
52 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
53 private static class IllegalValueKind extends ValueKind<IllegalValueKind> { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
54 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
55 IllegalValueKind() { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
56 super(IllegalKind.ILLEGAL); |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
57 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
58 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
59 @Override |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
60 public IllegalValueKind changeType(PlatformKind newPlatformKind) { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
61 return this; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
62 } |
23714
c351824fff81
Add IllegalValueKind.toString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23708
diff
changeset
|
63 |
c351824fff81
Add IllegalValueKind.toString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23708
diff
changeset
|
64 @Override |
c351824fff81
Add IllegalValueKind.toString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23708
diff
changeset
|
65 public String toString() { |
c351824fff81
Add IllegalValueKind.toString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23708
diff
changeset
|
66 return "ILLEGAL"; |
c351824fff81
Add IllegalValueKind.toString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23708
diff
changeset
|
67 } |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
68 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
69 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
70 /** |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
71 * The non-type. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
72 */ |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
73 public static final ValueKind<?> Illegal = new IllegalValueKind(); |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
74 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
75 private final PlatformKind platformKind; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
76 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
77 public ValueKind(PlatformKind platformKind) { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
78 this.platformKind = platformKind; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
79 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
80 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
81 public final PlatformKind getPlatformKind() { |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
82 return platformKind; |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
83 } |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
84 |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
85 /** |
23397 | 86 * Create a new {@link ValueKind} with a different {@link PlatformKind}. Subclasses must |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
87 * override this to preserve the additional information added by the compiler. |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
88 */ |
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
89 public abstract K changeType(PlatformKind newPlatformKind); |
23708
282873d0192c
Provide more control over the kind reported when printing Values
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23397
diff
changeset
|
90 |
282873d0192c
Provide more control over the kind reported when printing Values
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23397
diff
changeset
|
91 /** |
282873d0192c
Provide more control over the kind reported when printing Values
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23397
diff
changeset
|
92 * Returns a String representation of the kind, which will be included at the end of |
23714
c351824fff81
Add IllegalValueKind.toString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23708
diff
changeset
|
93 * {@link Value#toString()} implementation. Defaults to {@link #toString()} but can be |
c351824fff81
Add IllegalValueKind.toString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23708
diff
changeset
|
94 * overridden to provide something more specific. |
23708
282873d0192c
Provide more control over the kind reported when printing Values
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23397
diff
changeset
|
95 */ |
282873d0192c
Provide more control over the kind reported when printing Values
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23397
diff
changeset
|
96 public String getKindSuffix() { |
282873d0192c
Provide more control over the kind reported when printing Values
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23397
diff
changeset
|
97 return toString(); |
282873d0192c
Provide more control over the kind reported when printing Values
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
23397
diff
changeset
|
98 } |
23396
9ed5b586018b
Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
99 } |