annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompressedNullConstant.java @ 16116:9e5a323e0a1e

Remove hotspot specific NarrowOop kind, use LIRKind.reference(Kind.Int) instead.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 17 Jun 2014 09:59:59 +0200
parents 4dd2cedc7f57
children 9a804ec7f707
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
1 /*
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
4 *
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
8 *
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
14 *
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
18 *
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
21 * questions.
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
22 */
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.meta;
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
24
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
25 import com.oracle.graal.api.meta.*;
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
26
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
27 /**
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
28 * The compressed representation of the {@link Constant#NULL_OBJECT null constant}.
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
29 */
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
30 public final class HotSpotCompressedNullConstant extends Constant implements HotSpotConstant {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
31
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
32 private static final long serialVersionUID = 8906209595800783961L;
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
33
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
34 public static final Constant COMPRESSED_NULL = new HotSpotCompressedNullConstant();
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
35
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
36 private HotSpotCompressedNullConstant() {
16116
9e5a323e0a1e Remove hotspot specific NarrowOop kind, use LIRKind.reference(Kind.Int) instead.
Roland Schatz <roland.schatz@oracle.com>
parents: 16104
diff changeset
37 super(LIRKind.reference(Kind.Int));
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
38 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
39
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
40 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
41 public boolean isNull() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
42 return true;
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
43 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
44
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
45 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
46 public boolean isDefaultForKind() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
47 return true;
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
48 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
49
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
50 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
51 public Object asBoxedPrimitive() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
52 throw new IllegalArgumentException();
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
53 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
54
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
55 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
56 public int asInt() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
57 throw new IllegalArgumentException();
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
58 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
59
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
60 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
61 public boolean asBoolean() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
62 throw new IllegalArgumentException();
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
63 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
64
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
65 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
66 public long asLong() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
67 throw new IllegalArgumentException();
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
68 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
69
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
70 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
71 public float asFloat() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
72 throw new IllegalArgumentException();
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
73 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
74
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
75 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
76 public double asDouble() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
77 throw new IllegalArgumentException();
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
78 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
79
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
80 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
81 public String toValueString() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
82 return "null";
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
83 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
84
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
85 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
86 public int hashCode() {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
87 return System.identityHashCode(this);
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
88 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
89
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
90 @Override
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
91 public boolean equals(Object o) {
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
92 assert o == this || !(o instanceof HotSpotCompressedNullConstant) : "null constant is a singleton";
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
93 return o == this;
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
94 }
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
95 }