Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalCompilerToVM.cpp @ 9597:d5c2b20e9d73
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 07 May 2013 01:59:12 +0200 |
parents | db2125285960 4172233f32fd |
children | ffbb0a365039 |
comparison
equal
deleted
inserted
replaced
9596:aa8f3fc0a9a9 | 9597:d5c2b20e9d73 |
---|---|
389 | 389 |
390 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants(); | 390 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants(); |
391 | 391 |
392 oop result = NULL; | 392 oop result = NULL; |
393 constantTag tag = cp->tag_at(index); | 393 constantTag tag = cp->tag_at(index); |
394 if (tag.is_int()) { | 394 |
395 result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_0); | 395 switch (tag.value()) { |
396 } else if (tag.is_long()) { | 396 case JVM_CONSTANT_Integer: |
397 result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_0); | 397 result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_NULL); |
398 } else if (tag.is_float()) { | 398 break; |
399 result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_0); | 399 |
400 } else if (tag.is_double()) { | 400 case JVM_CONSTANT_Long: |
401 result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_0); | 401 result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_NULL); |
402 } else if (tag.is_string()) { | 402 break; |
403 oop string = NULL; | 403 |
404 if (cp->is_pseudo_string_at(index)) { | 404 case JVM_CONSTANT_Float: |
405 int obj_index = cp->cp_to_object_index(index); | 405 result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_NULL); |
406 string = cp->pseudo_string_at(index, obj_index); | 406 break; |
407 } else { | 407 |
408 string = cp->string_at(index, THREAD); | 408 case JVM_CONSTANT_Double: |
409 if (HAS_PENDING_EXCEPTION) { | 409 result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_NULL); |
410 CLEAR_PENDING_EXCEPTION; | 410 break; |
411 // TODO: Gracefully exit compilation. | 411 |
412 fatal("out of memory during compilation!"); | 412 case JVM_CONSTANT_Class: |
413 return NULL; | 413 case JVM_CONSTANT_UnresolvedClass: |
414 } | 414 case JVM_CONSTANT_UnresolvedClassInError: |
415 } | 415 { |
416 result = VMToCompiler::createConstantObject(string, CHECK_0); | 416 Handle type = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); |
417 } else if (tag.is_klass() || tag.is_unresolved_klass()) { | 417 result = type(); |
418 Handle type = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); | 418 break; |
419 result = type(); | 419 } |
420 } else { | 420 |
421 tty->print("unknown constant pool tag (%s) at cpi %d in %s: ", tag.internal_name(), index, cp->pool_holder()->name()->as_C_string()); | 421 case JVM_CONSTANT_String: |
422 ShouldNotReachHere(); | 422 { |
423 oop result_oop = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL); | |
424 result = VMToCompiler::createConstantObject(result_oop, CHECK_NULL); | |
425 break; | |
426 } | |
427 | |
428 case JVM_CONSTANT_MethodHandle: | |
429 case JVM_CONSTANT_MethodHandleInError: | |
430 case JVM_CONSTANT_MethodType: | |
431 case JVM_CONSTANT_MethodTypeInError: | |
432 { | |
433 oop result_oop = cp->resolve_constant_at(index, CHECK_NULL); | |
434 result = VMToCompiler::createConstantObject(result_oop, CHECK_NULL); | |
435 break; | |
436 } | |
437 | |
438 default: | |
439 fatal(err_msg_res("unknown constant pool tag %s at cpi %d in %s", tag.internal_name(), index, cp->pool_holder()->name()->as_C_string())); | |
423 } | 440 } |
424 | 441 |
425 return JNIHandles::make_local(THREAD, result); | 442 return JNIHandles::make_local(THREAD, result); |
426 C2V_END | 443 C2V_END |
427 | 444 |
613 if (id == NULL) { | 630 if (id == NULL) { |
614 fatal(err_msg("field not found: %s (%s)", name, sig)); | 631 fatal(err_msg("field not found: %s (%s)", name, sig)); |
615 } | 632 } |
616 return id; | 633 return id; |
617 } | 634 } |
618 | |
619 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT }; | |
620 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType); | |
621 | 635 |
622 C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) | 636 C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) |
623 | 637 |
624 #define set_boolean(name, value) do { env->SetBooleanField(config, getFieldID(env, config, name, "Z"), value); } while (0) | 638 #define set_boolean(name, value) do { env->SetBooleanField(config, getFieldID(env, config, name, "Z"), value); } while (0) |
625 #define set_int(name, value) do { env->SetIntField(config, getFieldID(env, config, name, "I"), value); } while (0) | 639 #define set_int(name, value) do { env->SetIntField(config, getFieldID(env, config, name, "I"), value); } while (0) |