Mercurial > hg > truffle
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotProxy.java @ 1423:760213a60e8b
* rewrite of the code installation
* partial support for safepoints
* macro-based CiTargetMethod interface
* code stub support
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Mon, 16 Aug 2010 18:59:36 -0700 |
parents | c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotInternalObject.java@6223633ce7dd |
children | 149b1d2316de |
comparison
equal
deleted
inserted
replaced
1422:3483ec571caf | 1423:760213a60e8b |
---|---|
1 /* | |
2 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. | |
3 * | |
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is | |
5 * described in this document. In particular, and without limitation, these intellectual property rights may include one | |
6 * or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent | |
7 * applications in the U.S. and in other countries. | |
8 * | |
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard | |
10 * license agreement and applicable provisions of the FAR and its supplements. | |
11 * | |
12 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or registered | |
13 * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and | |
14 * are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. | |
15 * | |
16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. | |
17 */ | |
18 package com.sun.hotspot.c1x; | |
19 | |
20 /** | |
21 * Provides methods to classify the HotSpot-internal identifiers. | |
22 * | |
23 * @author Lukas Stadler | |
24 */ | |
25 public class HotSpotProxy { | |
26 | |
27 private HotSpotProxy() { | |
28 } | |
29 | |
30 private enum CompilerObjectType { | |
31 // this enum needs to have the same values as the one in c1x_Compiler.hpp | |
32 STUB(0x100000000000000l), | |
33 METHOD(0x200000000000000l), | |
34 CLASS(0x300000000000000l), | |
35 SYMBOL(0x400000000000000l), | |
36 CONSTANT_POOL(0x500000000000000l), | |
37 CONSTANT(0x600000000000000l), | |
38 TYPE_MASK(0xf00000000000000l); | |
39 | |
40 public final long bits; | |
41 | |
42 CompilerObjectType(long bits) { | |
43 this.bits = bits; | |
44 } | |
45 } | |
46 | |
47 private static boolean isType(long id, CompilerObjectType type) { | |
48 return (id & CompilerObjectType.TYPE_MASK.bits) == type.bits; | |
49 } | |
50 | |
51 public static boolean isStub(long id) { | |
52 return isType(id, CompilerObjectType.STUB); | |
53 } | |
54 | |
55 public static boolean isMethod(long id) { | |
56 return isType(id, CompilerObjectType.METHOD); | |
57 } | |
58 | |
59 public static boolean isClass(long id) { | |
60 return isType(id, CompilerObjectType.CLASS); | |
61 } | |
62 | |
63 public static boolean isSymbol(long id) { | |
64 return isType(id, CompilerObjectType.SYMBOL); | |
65 } | |
66 | |
67 public static boolean isConstantPool(long id) { | |
68 return isType(id, CompilerObjectType.CONSTANT_POOL); | |
69 } | |
70 | |
71 public static boolean isConstant(long id) { | |
72 return isType(id, CompilerObjectType.CONSTANT_POOL); | |
73 } | |
74 | |
75 public static String toString(long id) { | |
76 CompilerObjectType type = null; | |
77 for (CompilerObjectType t : CompilerObjectType.values()) { | |
78 if ((id & CompilerObjectType.TYPE_MASK.bits) == t.bits) { | |
79 type = t; | |
80 } | |
81 } | |
82 long num = id & ~CompilerObjectType.TYPE_MASK.bits; | |
83 return type + " " + num; | |
84 } | |
85 | |
86 } |