Mercurial > hg > graal-compiler
comparison src/share/vm/c1x/c1x_VMEntries.cpp @ 1465:2c754f3a2722
Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Thu, 18 Nov 2010 17:27:43 +0100 |
parents | 7bc14f75a077 |
children | ef7761803480 |
comparison
equal
deleted
inserted
replaced
1463:7bc14f75a077 | 1465:2c754f3a2722 |
---|---|
166 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); | 166 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); |
167 | 167 |
168 oop result = NULL; | 168 oop result = NULL; |
169 constantTag tag = cp->tag_at(index); | 169 constantTag tag = cp->tag_at(index); |
170 if (tag.is_int()) { | 170 if (tag.is_int()) { |
171 result = VMExits::createCiConstantInt(cp->int_at(index), CHECK_0); | 171 result = VMExits::createCiConstantLong(cp->int_at(index), CHECK_0); |
172 CiValue::set_kind(result, CiKind::Int()); | |
172 } else if (tag.is_long()) { | 173 } else if (tag.is_long()) { |
173 result = VMExits::createCiConstantLong(cp->long_at(index), CHECK_0); | 174 result = VMExits::createCiConstantLong(cp->long_at(index), CHECK_0); |
174 } else if (tag.is_float()) { | 175 } else if (tag.is_float()) { |
175 result = VMExits::createCiConstantFloat(cp->float_at(index), CHECK_0); | 176 result = VMExits::createCiConstantFloat(cp->float_at(index), CHECK_0); |
176 } else if (tag.is_double()) { | 177 } else if (tag.is_double()) { |
186 // TODO: Gracefully exit compilation. | 187 // TODO: Gracefully exit compilation. |
187 fatal("out of memory during compilation!"); | 188 fatal("out of memory during compilation!"); |
188 return NULL; | 189 return NULL; |
189 } | 190 } |
190 } | 191 } |
191 jlong id = VmIds::add<oop>(string); | 192 result = VMExits::createCiConstantObject(string, CHECK_0); |
192 // tty->print("\n\nstring: 0x%08x%08x\n", string, id>>32, id); | |
193 // string->print(); | |
194 result = VMExits::createCiConstantObject(id, CHECK_0); | |
195 } else if (tag.is_klass() || tag.is_unresolved_klass()) { | 193 } else if (tag.is_klass() || tag.is_unresolved_klass()) { |
196 bool ignore; | 194 bool ignore; |
197 ciInstanceKlass* accessor = (ciInstanceKlass*) ciEnv::current()->get_object(cp->pool_holder()); | 195 ciInstanceKlass* accessor = (ciInstanceKlass*) ciEnv::current()->get_object(cp->pool_holder()); |
198 ciKlass* klass = ciEnv::current()->get_klass_by_index(cp, index, ignore, accessor); | 196 ciKlass* klass = ciEnv::current()->get_klass_by_index(cp, index, ignore, accessor); |
199 result = C1XCompiler::get_RiType(klass, cp->pool_holder(), CHECK_NULL); | 197 result = C1XCompiler::get_RiType(klass, cp->pool_holder(), CHECK_NULL); |
200 } else if (tag.is_object()) { | 198 } else if (tag.is_object()) { |
201 oop obj = cp->object_at(index); | 199 oop obj = cp->object_at(index); |
202 assert(obj->is_instance(), "must be an instance"); | 200 assert(obj->is_instance(), "must be an instance"); |
203 result = VMExits::createCiConstantObject(VmIds::add<oop>(obj), CHECK_NULL); | 201 result = VMExits::createCiConstantObject(obj, CHECK_NULL); |
204 } else { | 202 } else { |
205 ShouldNotReachHere(); | 203 ShouldNotReachHere(); |
206 } | 204 } |
207 | 205 |
208 return JNIHandles::make_local(THREAD, result); | 206 return JNIHandles::make_local(THREAD, result); |
254 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); | 252 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); |
255 | 253 |
256 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); | 254 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); |
257 ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); | 255 ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); |
258 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); | 256 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); |
259 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiField(field, loading_klass, cp->pool_holder(), code, THREAD)); | 257 Handle field_handle = C1XCompiler::get_RiField(field, loading_klass, cp->pool_holder(), code, THREAD); |
258 if (field->is_constant() && field->is_static()) { | |
259 ciConstant constant = field->constant_value(); | |
260 oop constant_object = NULL; | |
261 switch (constant.basic_type()) { | |
262 case T_OBJECT: | |
263 case T_ARRAY: | |
264 { | |
265 ciObject* obj = constant.as_object(); | |
266 if (obj->is_null_object()) { | |
267 constant_object = VMExits::createCiConstantObject(NULL, CHECK_0); | |
268 } else if (obj->can_be_constant()) { | |
269 constant_object = VMExits::createCiConstantObject(constant.as_object()->get_oop(), CHECK_0); | |
270 } | |
271 } | |
272 break; | |
273 case T_DOUBLE: | |
274 constant_object = VMExits::createCiConstantDouble(constant.as_double(), CHECK_0); | |
275 break; | |
276 case T_LONG: | |
277 constant_object = VMExits::createCiConstantLong(constant.as_long(), CHECK_0); | |
278 break; | |
279 case T_INT: | |
280 constant_object = VMExits::createCiConstantLong(constant.as_int(), CHECK_0); | |
281 CiValue::set_kind(constant_object, CiKind::Int()); | |
282 break; | |
283 case T_SHORT: | |
284 constant_object = VMExits::createCiConstantLong(constant.as_int(), CHECK_0); | |
285 CiValue::set_kind(constant_object, CiKind::Short()); | |
286 break; | |
287 case T_CHAR: | |
288 constant_object = VMExits::createCiConstantLong(constant.as_int(), CHECK_0); | |
289 CiValue::set_kind(constant_object, CiKind::Char()); | |
290 break; | |
291 case T_BYTE: | |
292 constant_object = VMExits::createCiConstantLong(constant.as_int(), CHECK_0); | |
293 CiValue::set_kind(constant_object, CiKind::Byte()); | |
294 break; | |
295 case T_BOOLEAN: | |
296 constant_object = VMExits::createCiConstantLong(constant.as_int(), CHECK_0); | |
297 CiValue::set_kind(constant_object, CiKind::Boolean()); | |
298 break; | |
299 default: | |
300 constant.print(); | |
301 fatal("Unhandled constant"); | |
302 } | |
303 if (constant_object != NULL) { | |
304 HotSpotField::set_constant(field_handle, constant_object); | |
305 } | |
306 } | |
307 return JNIHandles::make_local(THREAD, field_handle()); | |
260 } | 308 } |
261 | 309 |
262 // public RiConstantPool RiType_constantPool(long vmId); | 310 // public RiConstantPool RiType_constantPool(long vmId); |
263 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool(JNIEnv *, jobject, jlong vmId) { | 311 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool(JNIEnv *, jobject, jlong vmId) { |
264 VM_ENTRY_MARK; | 312 VM_ENTRY_MARK; |