Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/type.cpp @ 6182:765ee2d1674b
7157365: jruby/bench.bench_timeout crashes with JVM internal error
Reviewed-by: jrose, kvn
author | twisti |
---|---|
date | Mon, 18 Jun 2012 15:17:30 -0700 |
parents | 8c92982cbbc4 |
children | 24b9c7f4cae6 |
comparison
equal
deleted
inserted
replaced
6181:f8de958e5b2c | 6182:765ee2d1674b |
---|---|
2611 } | 2611 } |
2612 | 2612 |
2613 //------------------------------make_from_constant----------------------------- | 2613 //------------------------------make_from_constant----------------------------- |
2614 // Make a java pointer from an oop constant | 2614 // Make a java pointer from an oop constant |
2615 const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) { | 2615 const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) { |
2616 if (o->is_method_data() || o->is_method() || o->is_cpcache()) { | 2616 if (o->is_method_data() || o->is_method()) { |
2617 // Treat much like a typeArray of bytes, like below, but fake the type... | 2617 // Treat much like a typeArray of bytes, like below, but fake the type... |
2618 const Type* etype = (Type*)get_const_basic_type(T_BYTE); | 2618 const BasicType bt = T_BYTE; |
2619 const Type* etype = get_const_basic_type(bt); | |
2619 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS); | 2620 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS); |
2620 ciKlass *klass = ciTypeArrayKlass::make((BasicType) T_BYTE); | 2621 ciKlass* klass = ciArrayKlass::make(ciType::make(bt)); |
2621 assert(o->can_be_constant(), "method data oops should be tenured"); | 2622 assert(o->can_be_constant(), "should be tenured"); |
2622 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); | 2623 return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); |
2623 return arr; | 2624 } else if (o->is_cpcache()) { |
2625 // Treat much like a objArray, like below, but fake the type... | |
2626 const BasicType bt = T_OBJECT; | |
2627 const Type* etype = get_const_basic_type(bt); | |
2628 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS); | |
2629 ciKlass* klass = ciArrayKlass::make(ciType::make(bt)); | |
2630 assert(o->can_be_constant(), "should be tenured"); | |
2631 return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); | |
2624 } else { | 2632 } else { |
2625 assert(o->is_java_object(), "must be java language object"); | 2633 assert(o->is_java_object(), "must be java language object"); |
2626 assert(!o->is_null_object(), "null object not yet handled here."); | 2634 assert(!o->is_null_object(), "null object not yet handled here."); |
2627 ciKlass *klass = o->klass(); | 2635 ciKlass* klass = o->klass(); |
2628 if (klass->is_instance_klass()) { | 2636 if (klass->is_instance_klass()) { |
2629 // Element is an instance | 2637 // Element is an instance |
2630 if (require_constant) { | 2638 if (require_constant) { |
2631 if (!o->can_be_constant()) return NULL; | 2639 if (!o->can_be_constant()) return NULL; |
2632 } else if (!o->should_be_constant()) { | 2640 } else if (!o->should_be_constant()) { |
2633 return TypeInstPtr::make(TypePtr::NotNull, klass, true, NULL, 0); | 2641 return TypeInstPtr::make(TypePtr::NotNull, klass, true, NULL, 0); |
2634 } | 2642 } |
2635 return TypeInstPtr::make(o); | 2643 return TypeInstPtr::make(o); |
2636 } else if (klass->is_obj_array_klass()) { | 2644 } else if (klass->is_obj_array_klass()) { |
2637 // Element is an object array. Recursively call ourself. | 2645 // Element is an object array. Recursively call ourself. |
2638 const Type *etype = | 2646 const Type *etype = make_from_klass_raw(klass->as_obj_array_klass()->element_klass()); |
2639 TypeOopPtr::make_from_klass_raw(klass->as_obj_array_klass()->element_klass()); | |
2640 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length())); | 2647 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length())); |
2641 // We used to pass NotNull in here, asserting that the sub-arrays | 2648 // We used to pass NotNull in here, asserting that the sub-arrays |
2642 // are all not-null. This is not true in generally, as code can | 2649 // are all not-null. This is not true in generally, as code can |
2643 // slam NULLs down in the subarrays. | 2650 // slam NULLs down in the subarrays. |
2644 if (require_constant) { | 2651 if (require_constant) { |
2645 if (!o->can_be_constant()) return NULL; | 2652 if (!o->can_be_constant()) return NULL; |
2646 } else if (!o->should_be_constant()) { | 2653 } else if (!o->should_be_constant()) { |
2647 return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0); | 2654 return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0); |
2648 } | 2655 } |
2649 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); | 2656 return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); |
2650 return arr; | |
2651 } else if (klass->is_type_array_klass()) { | 2657 } else if (klass->is_type_array_klass()) { |
2652 // Element is an typeArray | 2658 // Element is an typeArray |
2653 const Type* etype = | 2659 const Type* etype = get_const_basic_type(klass->as_type_array_klass()->element_type()); |
2654 (Type*)get_const_basic_type(klass->as_type_array_klass()->element_type()); | |
2655 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length())); | 2660 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length())); |
2656 // We used to pass NotNull in here, asserting that the array pointer | 2661 // We used to pass NotNull in here, asserting that the array pointer |
2657 // is not-null. That was not true in general. | 2662 // is not-null. That was not true in general. |
2658 if (require_constant) { | 2663 if (require_constant) { |
2659 if (!o->can_be_constant()) return NULL; | 2664 if (!o->can_be_constant()) return NULL; |
2660 } else if (!o->should_be_constant()) { | 2665 } else if (!o->should_be_constant()) { |
2661 return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0); | 2666 return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0); |
2662 } | 2667 } |
2663 const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); | 2668 return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); |
2664 return arr; | 2669 } |
2665 } | 2670 } |
2666 } | 2671 |
2667 | 2672 fatal("unhandled object type"); |
2668 ShouldNotReachHere(); | |
2669 return NULL; | 2673 return NULL; |
2670 } | 2674 } |
2671 | 2675 |
2672 //------------------------------get_con---------------------------------------- | 2676 //------------------------------get_con---------------------------------------- |
2673 intptr_t TypeOopPtr::get_con() const { | 2677 intptr_t TypeOopPtr::get_con() const { |