src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6829187 Sdiff src/share/vm/opto

src/share/vm/opto/type.cpp

Print this page
rev 1082 : [mq]: indy.compiler.patch


2414     // slam NULLs down in the subarrays.
2415     const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, xk, 0);
2416     return arr;
2417   } else if (klass->is_type_array_klass()) {
2418     // Element is an typeArray
2419     const Type* etype = get_const_basic_type(klass->as_type_array_klass()->element_type());
2420     const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
2421     // We used to pass NotNull in here, asserting that the array pointer
2422     // is not-null. That was not true in general.
2423     const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, true, 0);
2424     return arr;
2425   } else {
2426     ShouldNotReachHere();
2427     return NULL;
2428   }
2429 }
2430 
2431 //------------------------------make_from_constant-----------------------------
2432 // Make a java pointer from an oop constant
2433 const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) {
2434   if (o->is_method_data() || o->is_method()) {
2435     // Treat much like a typeArray of bytes, like below, but fake the type...
2436     const Type* etype = (Type*)get_const_basic_type(T_BYTE);
2437     const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
2438     ciKlass *klass = ciTypeArrayKlass::make((BasicType) T_BYTE);
2439     assert(o->can_be_constant(), "method data oops should be tenured");
2440     const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
2441     return arr;
2442   } else {
2443     assert(o->is_java_object(), "must be java language object");
2444     assert(!o->is_null_object(), "null object not yet handled here.");
2445     ciKlass *klass = o->klass();
2446     if (klass->is_instance_klass()) {
2447       // Element is an instance
2448       if (require_constant) {
2449         if (!o->can_be_constant())  return NULL;
2450       } else if (!o->should_be_constant()) {
2451         return TypeInstPtr::make(TypePtr::NotNull, klass, true, NULL, 0);
2452       }
2453       return TypeInstPtr::make(o);
2454     } else if (klass->is_obj_array_klass()) {


3949   st->print(" *");
3950 }
3951 #endif
3952 
3953 
3954 
3955 //=============================================================================
3956 // Convenience common pre-built types.
3957 
3958 //------------------------------make-------------------------------------------
3959 const TypeFunc *TypeFunc::make( const TypeTuple *domain, const TypeTuple *range ) {
3960   return (TypeFunc*)(new TypeFunc(domain,range))->hashcons();
3961 }
3962 
3963 //------------------------------make-------------------------------------------
3964 const TypeFunc *TypeFunc::make(ciMethod* method) {
3965   Compile* C = Compile::current();
3966   const TypeFunc* tf = C->last_tf(method); // check cache
3967   if (tf != NULL)  return tf;  // The hit rate here is almost 50%.
3968   const TypeTuple *domain;
3969   if (method->flags().is_static()) {
3970     domain = TypeTuple::make_domain(NULL, method->signature());
3971   } else {
3972     domain = TypeTuple::make_domain(method->holder(), method->signature());
3973   }
3974   const TypeTuple *range  = TypeTuple::make_range(method->signature());
3975   tf = TypeFunc::make(domain, range);
3976   C->set_last_tf(method, tf);  // fill cache
3977   return tf;
3978 }
3979 
3980 //------------------------------meet-------------------------------------------
3981 // Compute the MEET of two types.  It returns a new Type object.
3982 const Type *TypeFunc::xmeet( const Type *t ) const {
3983   // Perform a fast test for common case; meeting the same types together.
3984   if( this == t ) return this;  // Meeting same type-rep?
3985 
3986   // Current "this->_base" is Func
3987   switch (t->base()) {          // switch on original type
3988 
3989   case Bottom:                  // Ye Olde Default




2414     // slam NULLs down in the subarrays.
2415     const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, xk, 0);
2416     return arr;
2417   } else if (klass->is_type_array_klass()) {
2418     // Element is an typeArray
2419     const Type* etype = get_const_basic_type(klass->as_type_array_klass()->element_type());
2420     const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
2421     // We used to pass NotNull in here, asserting that the array pointer
2422     // is not-null. That was not true in general.
2423     const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::BotPTR, arr0, klass, true, 0);
2424     return arr;
2425   } else {
2426     ShouldNotReachHere();
2427     return NULL;
2428   }
2429 }
2430 
2431 //------------------------------make_from_constant-----------------------------
2432 // Make a java pointer from an oop constant
2433 const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) {
2434   if (o->is_method_data() || o->is_method() || o->is_cpcache()) {
2435     // Treat much like a typeArray of bytes, like below, but fake the type...
2436     const Type* etype = (Type*)get_const_basic_type(T_BYTE);
2437     const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
2438     ciKlass *klass = ciTypeArrayKlass::make((BasicType) T_BYTE);
2439     assert(o->can_be_constant(), "method data oops should be tenured");
2440     const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
2441     return arr;
2442   } else {
2443     assert(o->is_java_object(), "must be java language object");
2444     assert(!o->is_null_object(), "null object not yet handled here.");
2445     ciKlass *klass = o->klass();
2446     if (klass->is_instance_klass()) {
2447       // Element is an instance
2448       if (require_constant) {
2449         if (!o->can_be_constant())  return NULL;
2450       } else if (!o->should_be_constant()) {
2451         return TypeInstPtr::make(TypePtr::NotNull, klass, true, NULL, 0);
2452       }
2453       return TypeInstPtr::make(o);
2454     } else if (klass->is_obj_array_klass()) {


3949   st->print(" *");
3950 }
3951 #endif
3952 
3953 
3954 
3955 //=============================================================================
3956 // Convenience common pre-built types.
3957 
3958 //------------------------------make-------------------------------------------
3959 const TypeFunc *TypeFunc::make( const TypeTuple *domain, const TypeTuple *range ) {
3960   return (TypeFunc*)(new TypeFunc(domain,range))->hashcons();
3961 }
3962 
3963 //------------------------------make-------------------------------------------
3964 const TypeFunc *TypeFunc::make(ciMethod* method) {
3965   Compile* C = Compile::current();
3966   const TypeFunc* tf = C->last_tf(method); // check cache
3967   if (tf != NULL)  return tf;  // The hit rate here is almost 50%.
3968   const TypeTuple *domain;
3969   if (method->is_static()) {
3970     domain = TypeTuple::make_domain(NULL, method->signature());
3971   } else {
3972     domain = TypeTuple::make_domain(method->holder(), method->signature());
3973   }
3974   const TypeTuple *range  = TypeTuple::make_range(method->signature());
3975   tf = TypeFunc::make(domain, range);
3976   C->set_last_tf(method, tf);  // fill cache
3977   return tf;
3978 }
3979 
3980 //------------------------------meet-------------------------------------------
3981 // Compute the MEET of two types.  It returns a new Type object.
3982 const Type *TypeFunc::xmeet( const Type *t ) const {
3983   // Perform a fast test for common case; meeting the same types together.
3984   if( this == t ) return this;  // Meeting same type-rep?
3985 
3986   // Current "this->_base" is Func
3987   switch (t->base()) {          // switch on original type
3988 
3989   case Bottom:                  // Ye Olde Default


src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File