Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/value/ValueUtil.java @ 2611:bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 06 May 2011 17:08:00 +0200 |
parents | |
children | abb4cc15283d |
comparison
equal
deleted
inserted
replaced
2610:39aa89baa165 | 2611:bd235cb4375a |
---|---|
1 /* | |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.sun.c1x.value; | |
24 | |
25 import com.sun.c1x.ir.*; | |
26 import com.sun.cri.ci.*; | |
27 | |
28 | |
29 public class ValueUtil { | |
30 | |
31 public static Value assertKind(CiKind kind, Value x) { | |
32 assert x != null && (x.kind == kind) : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.kind); | |
33 return x; | |
34 } | |
35 | |
36 public static Value assertLong(Value x) { | |
37 assert x != null && (x.kind == CiKind.Long); | |
38 return x; | |
39 } | |
40 | |
41 public static Value assertJsr(Value x) { | |
42 assert x != null && (x.kind == CiKind.Jsr); | |
43 return x; | |
44 } | |
45 | |
46 public static Value assertInt(Value x) { | |
47 assert x != null && (x.kind == CiKind.Int); | |
48 return x; | |
49 } | |
50 | |
51 public static Value assertFloat(Value x) { | |
52 assert x != null && (x.kind == CiKind.Float); | |
53 return x; | |
54 } | |
55 | |
56 public static Value assertObject(Value x) { | |
57 assert x != null && (x.kind == CiKind.Object); | |
58 return x; | |
59 } | |
60 | |
61 public static Value assertWord(Value x) { | |
62 assert x != null && (x.kind == CiKind.Word); | |
63 return x; | |
64 } | |
65 | |
66 public static Value assertDouble(Value x) { | |
67 assert x != null && (x.kind == CiKind.Double); | |
68 return x; | |
69 } | |
70 | |
71 public static void assertHigh(Value x) { | |
72 assert x == null; | |
73 } | |
74 | |
75 public static boolean typeMismatch(Value x, Value y) { | |
76 return y == null || x.kind != y.kind; | |
77 } | |
78 | |
79 public static boolean isDoubleWord(Value x) { | |
80 return x != null && x.kind.isDoubleWord(); | |
81 } | |
82 | |
83 } |