comparison src/share/vm/c1x/c1x_VmIds.hpp @ 2182:9569fdf936ff

Made merge compile.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Wed, 16 Feb 2011 14:21:52 +0100
parents 72cfb36c6bb2
children 999f8086cc4f
comparison
equal deleted inserted replaced
2181:d25d4ca69222 2182:9569fdf936ff
20 * CA 95054 USA or visit www.sun.com if you need additional information or 20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions. 21 * have any questions.
22 * 22 *
23 */ 23 */
24 24
25 class Thread;
26
25 class VmIds : public AllStatic { 27 class VmIds : public AllStatic {
26 28
27 private: 29 private:
28 static GrowableArray<address>* _stubs; 30 static GrowableArray<address>* _stubs;
29 static GrowableArray<jobject>* _localHandles; 31 static GrowableArray<jobject>* _localHandles;
34 // this enum needs to have the same values as the one in HotSpotProxy.java 36 // this enum needs to have the same values as the one in HotSpotProxy.java
35 enum CompilerObjectType { 37 enum CompilerObjectType {
36 STUB = 0x100000000000000l, // address 38 STUB = 0x100000000000000l, // address
37 METHOD = 0x200000000000000l, // methodOop 39 METHOD = 0x200000000000000l, // methodOop
38 CLASS = 0x300000000000000l, // klassOop 40 CLASS = 0x300000000000000l, // klassOop
39 SYMBOL = 0x400000000000000l, // symbolOop
40 CONSTANT_POOL = 0x500000000000000l, // constantPoolOop 41 CONSTANT_POOL = 0x500000000000000l, // constantPoolOop
41 CONSTANT = 0x600000000000000l, // oop 42 CONSTANT = 0x600000000000000l, // oop
42 TYPE_MASK = 0xf00000000000000l, 43 TYPE_MASK = 0xf00000000000000l,
43 DUMMY_CONSTANT = 0x6ffffffffffffffl 44 DUMMY_CONSTANT = 0x6ffffffffffffffl
44 }; 45 };
65 66
66 // Returns the object with the given id, the return type is defined by the template parameter (which must correspond to the actual type of the vmId) 67 // Returns the object with the given id, the return type is defined by the template parameter (which must correspond to the actual type of the vmId)
67 template <typename T> static T get(jlong id); 68 template <typename T> static T get(jlong id);
68 69
69 70
70 // Helper function to convert a symbolOop to a java.lang.String object 71 // Helper function to convert a symbol to a java.lang.String object
71 template <typename T> static T toString(symbolOop symbol, TRAPS); 72 template <typename T> static T toString(Symbol* symbol, TRAPS);
72 73
73 // Helper function to convert a java.lang.String object to a symbolOop (this will return NULL if the symbol doesn't exist in the system) 74 // Helper function to convert a java.lang.String object to a symbol (this will return NULL if the symbol doesn't exist in the system)
74 static symbolOop toSymbol(jstring string); 75 static Symbol* toSymbol(jstring string);
75 76
76 // Helper function to get the contents of a java.lang.Long 77 // Helper function to get the contents of a java.lang.Long
77 static jlong getBoxedLong(oop obj); 78 static jlong getBoxedLong(oop obj);
78 }; 79 };
79 80
85 } 86 }
86 template <> inline jlong VmIds::add<klassOop>(klassOop obj) { 87 template <> inline jlong VmIds::add<klassOop>(klassOop obj) {
87 assert(obj != NULL, "trying to add NULL<klassOop>"); 88 assert(obj != NULL, "trying to add NULL<klassOop>");
88 assert(obj->is_klass(), "trying to add mistyped object"); 89 assert(obj->is_klass(), "trying to add mistyped object");
89 return add(Handle(obj), CLASS); 90 return add(Handle(obj), CLASS);
90 }
91 template <> inline jlong VmIds::add<symbolOop>(symbolOop obj) {
92 assert(obj != NULL, "trying to add NULL<symbolOop>");
93 assert(obj->is_symbol(), "trying to add mistyped object");
94 return add(Handle(obj), SYMBOL);
95 } 91 }
96 template <> inline jlong VmIds::add<constantPoolOop>(constantPoolOop obj) { 92 template <> inline jlong VmIds::add<constantPoolOop>(constantPoolOop obj) {
97 assert(obj != NULL, "trying to add NULL<constantPoolOop>"); 93 assert(obj != NULL, "trying to add NULL<constantPoolOop>");
98 assert(obj->is_constantPool(), "trying to add mistyped object"); 94 assert(obj->is_constantPool(), "trying to add mistyped object");
99 return add(Handle(obj), CONSTANT_POOL); 95 return add(Handle(obj), CONSTANT_POOL);
113 template <> inline klassOop VmIds::get<klassOop>(jlong id) { 109 template <> inline klassOop VmIds::get<klassOop>(jlong id) {
114 assert((id & TYPE_MASK) == CLASS, "CLASS expected"); 110 assert((id & TYPE_MASK) == CLASS, "CLASS expected");
115 assert(getObject(id)->is_klass(), "klassOop expected"); 111 assert(getObject(id)->is_klass(), "klassOop expected");
116 return (klassOop)getObject(id); 112 return (klassOop)getObject(id);
117 } 113 }
118 template <> inline symbolOop VmIds::get<symbolOop>(jlong id) {
119 assert((id & TYPE_MASK) == SYMBOL, "SYMBOL expected");
120 assert(getObject(id)->is_symbol(), "symbolOop expected");
121 return (symbolOop)getObject(id);
122 }
123 template <> inline constantPoolOop VmIds::get<constantPoolOop>(jlong id) { 114 template <> inline constantPoolOop VmIds::get<constantPoolOop>(jlong id) {
124 assert((id & TYPE_MASK) == CONSTANT_POOL, "CONSTANT_POOL expected"); 115 assert((id & TYPE_MASK) == CONSTANT_POOL, "CONSTANT_POOL expected");
125 assert(getObject(id)->is_constantPool(), "constantPoolOop expected"); 116 assert(getObject(id)->is_constantPool(), "constantPoolOop expected");
126 return (constantPoolOop)getObject(id); 117 return (constantPoolOop)getObject(id);
127 } 118 }
133 124
134 inline address VmIds::getStub(oop obj) { 125 inline address VmIds::getStub(oop obj) {
135 return getStub(getBoxedLong(obj)); 126 return getStub(getBoxedLong(obj));
136 } 127 }
137 128
138 template <> inline Handle VmIds::toString<Handle>(symbolOop symbol, TRAPS) { 129 template <> inline Handle VmIds::toString<Handle>(Symbol* symbol, TRAPS) {
139 return java_lang_String::create_from_symbol(symbol, THREAD); 130 return java_lang_String::create_from_symbol(symbol, THREAD);
140 } 131 }
141 template <> inline oop VmIds::toString<oop>(symbolOop symbol, TRAPS) { 132 template <> inline oop VmIds::toString<oop>(Symbol* symbol, TRAPS) {
142 return toString<Handle>(symbol, THREAD)(); 133 return toString<Handle>(symbol, THREAD)();
143 } 134 }
144 template <> inline jstring VmIds::toString<jstring>(symbolOop symbol, TRAPS) { 135 template <> inline jstring VmIds::toString<jstring>(Symbol* symbol, TRAPS) {
145 return (jstring)JNIHandles::make_local(toString<oop>(symbol, THREAD)); 136 return (jstring)JNIHandles::make_local(toString<oop>(symbol, THREAD));
146 } 137 }
147 template <> inline jobject VmIds::toString<jobject>(symbolOop symbol, TRAPS) { 138 template <> inline jobject VmIds::toString<jobject>(Symbol* symbol, TRAPS) {
148 return JNIHandles::make_local(toString<oop>(symbol, THREAD)); 139 return JNIHandles::make_local(toString<oop>(symbol, THREAD));
149 } 140 }
150 141
151 inline symbolOop VmIds::toSymbol(jstring string) { 142 inline Symbol* VmIds::toSymbol(jstring string) {
152 return java_lang_String::as_symbol_or_null(JNIHandles::resolve(string)); 143 return java_lang_String::as_symbol_or_null(JNIHandles::resolve(string));
153 } 144 }
154 145
155 inline jlong VmIds::getBoxedLong(oop obj) { 146 inline jlong VmIds::getBoxedLong(oop obj) {
156 assert(obj->is_oop(true), "cannot unbox null or non-oop"); 147 assert(obj->is_oop(true), "cannot unbox null or non-oop");