< prev index next >

src/hotspot/share/c1/c1_LIR.hpp

Print this page


 299   friend BasicType as_BasicType(OprType t);
 300 
 301   OprType type_field_valid() const               { assert(is_register() || is_stack(), "should not be called otherwise"); return (OprType)(value() & type_mask); }
 302   OprType type_field() const                     { return is_illegal() ? unknown_type : (OprType)(value() & type_mask); }
 303 
 304   static OprSize size_for(BasicType t) {
 305     switch (t) {
 306       case T_LONG:
 307       case T_DOUBLE:
 308         return double_size;
 309         break;
 310 
 311       case T_FLOAT:
 312       case T_BOOLEAN:
 313       case T_CHAR:
 314       case T_BYTE:
 315       case T_SHORT:
 316       case T_INT:
 317       case T_ADDRESS:
 318       case T_OBJECT:

 319       case T_ARRAY:
 320       case T_METADATA:
 321         return single_size;
 322         break;
 323 
 324       default:
 325         ShouldNotReachHere();
 326         return single_size;
 327       }
 328   }
 329 
 330 
 331   void validate_type() const PRODUCT_RETURN;
 332 
 333   BasicType type() const {
 334     if (is_pointer()) {
 335       return pointer()->type();
 336     }
 337     return as_BasicType(type_field());
 338   }


 449 #endif
 450 
 451   jint      as_jint()    const { return as_constant_ptr()->as_jint(); }
 452   jlong     as_jlong()   const { return as_constant_ptr()->as_jlong(); }
 453   jfloat    as_jfloat()  const { return as_constant_ptr()->as_jfloat(); }
 454   jdouble   as_jdouble() const { return as_constant_ptr()->as_jdouble(); }
 455   jobject   as_jobject() const { return as_constant_ptr()->as_jobject(); }
 456 
 457   void print() const PRODUCT_RETURN;
 458   void print(outputStream* out) const PRODUCT_RETURN;
 459 };
 460 
 461 
 462 inline LIR_OprDesc::OprType as_OprType(BasicType type) {
 463   switch (type) {
 464   case T_INT:      return LIR_OprDesc::int_type;
 465   case T_LONG:     return LIR_OprDesc::long_type;
 466   case T_FLOAT:    return LIR_OprDesc::float_type;
 467   case T_DOUBLE:   return LIR_OprDesc::double_type;
 468   case T_OBJECT:

 469   case T_ARRAY:    return LIR_OprDesc::object_type;
 470   case T_ADDRESS:  return LIR_OprDesc::address_type;
 471   case T_METADATA: return LIR_OprDesc::metadata_type;
 472   case T_ILLEGAL:  // fall through
 473   default: ShouldNotReachHere(); return LIR_OprDesc::unknown_type;
 474   }
 475 }
 476 
 477 inline BasicType as_BasicType(LIR_OprDesc::OprType t) {
 478   switch (t) {
 479   case LIR_OprDesc::int_type:     return T_INT;
 480   case LIR_OprDesc::long_type:    return T_LONG;
 481   case LIR_OprDesc::float_type:   return T_FLOAT;
 482   case LIR_OprDesc::double_type:  return T_DOUBLE;
 483   case LIR_OprDesc::object_type:  return T_OBJECT;
 484   case LIR_OprDesc::address_type: return T_ADDRESS;
 485   case LIR_OprDesc::metadata_type:return T_METADATA;
 486   case LIR_OprDesc::unknown_type: // fall through
 487   default: ShouldNotReachHere();  return T_ILLEGAL;
 488   }


 634     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 635                                LIR_OprDesc::float_type          |
 636                                LIR_OprDesc::fpu_register        |
 637                                LIR_OprDesc::single_size         |
 638                                LIR_OprDesc::is_xmm_mask);
 639   }
 640   static LIR_Opr double_xmm(int reg) {
 641     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 642                                (reg << LIR_OprDesc::reg2_shift) |
 643                                LIR_OprDesc::double_type         |
 644                                LIR_OprDesc::fpu_register        |
 645                                LIR_OprDesc::double_size         |
 646                                LIR_OprDesc::is_xmm_mask);
 647   }
 648 #endif // X86
 649 
 650   static LIR_Opr virtual_register(int index, BasicType type) {
 651     LIR_Opr res;
 652     switch (type) {
 653       case T_OBJECT: // fall through

 654       case T_ARRAY:
 655         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 656                                             LIR_OprDesc::object_type  |
 657                                             LIR_OprDesc::cpu_register |
 658                                             LIR_OprDesc::single_size  |
 659                                             LIR_OprDesc::virtual_mask);
 660         break;
 661 
 662       case T_METADATA:
 663         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 664                                             LIR_OprDesc::metadata_type|
 665                                             LIR_OprDesc::cpu_register |
 666                                             LIR_OprDesc::single_size  |
 667                                             LIR_OprDesc::virtual_mask);
 668         break;
 669 
 670       case T_INT:
 671         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 672                                   LIR_OprDesc::int_type              |
 673                                   LIR_OprDesc::cpu_register          |


 739                                t |
 740                                LIR_OprDesc::cpu_register |
 741                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 742 #else // __SOFTFP__
 743     LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) | t |
 744                                           ((type == T_FLOAT || type == T_DOUBLE) ?  LIR_OprDesc::fpu_register : LIR_OprDesc::cpu_register) |
 745                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 746     assert(res == old_res, "old and new method not equal");
 747 #endif // __SOFTFP__
 748 #endif // ASSERT
 749 
 750     return res;
 751   }
 752 
 753   // 'index' is computed by FrameMap::local_stack_pos(index); do not use other parameters as
 754   // the index is platform independent; a double stack useing indeces 2 and 3 has always
 755   // index 2.
 756   static LIR_Opr stack(int index, BasicType type) {
 757     LIR_Opr res;
 758     switch (type) {

 759       case T_OBJECT: // fall through
 760       case T_ARRAY:
 761         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 762                                   LIR_OprDesc::object_type           |
 763                                   LIR_OprDesc::stack_value           |
 764                                   LIR_OprDesc::single_size);
 765         break;
 766 
 767       case T_METADATA:
 768         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 769                                   LIR_OprDesc::metadata_type         |
 770                                   LIR_OprDesc::stack_value           |
 771                                   LIR_OprDesc::single_size);
 772         break;
 773       case T_INT:
 774         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 775                                   LIR_OprDesc::int_type              |
 776                                   LIR_OprDesc::stack_value           |
 777                                   LIR_OprDesc::single_size);
 778         break;




 299   friend BasicType as_BasicType(OprType t);
 300 
 301   OprType type_field_valid() const               { assert(is_register() || is_stack(), "should not be called otherwise"); return (OprType)(value() & type_mask); }
 302   OprType type_field() const                     { return is_illegal() ? unknown_type : (OprType)(value() & type_mask); }
 303 
 304   static OprSize size_for(BasicType t) {
 305     switch (t) {
 306       case T_LONG:
 307       case T_DOUBLE:
 308         return double_size;
 309         break;
 310 
 311       case T_FLOAT:
 312       case T_BOOLEAN:
 313       case T_CHAR:
 314       case T_BYTE:
 315       case T_SHORT:
 316       case T_INT:
 317       case T_ADDRESS:
 318       case T_OBJECT:
 319       case T_VALUETYPE:
 320       case T_ARRAY:
 321       case T_METADATA:
 322         return single_size;
 323         break;
 324 
 325       default:
 326         ShouldNotReachHere();
 327         return single_size;
 328       }
 329   }
 330 
 331 
 332   void validate_type() const PRODUCT_RETURN;
 333 
 334   BasicType type() const {
 335     if (is_pointer()) {
 336       return pointer()->type();
 337     }
 338     return as_BasicType(type_field());
 339   }


 450 #endif
 451 
 452   jint      as_jint()    const { return as_constant_ptr()->as_jint(); }
 453   jlong     as_jlong()   const { return as_constant_ptr()->as_jlong(); }
 454   jfloat    as_jfloat()  const { return as_constant_ptr()->as_jfloat(); }
 455   jdouble   as_jdouble() const { return as_constant_ptr()->as_jdouble(); }
 456   jobject   as_jobject() const { return as_constant_ptr()->as_jobject(); }
 457 
 458   void print() const PRODUCT_RETURN;
 459   void print(outputStream* out) const PRODUCT_RETURN;
 460 };
 461 
 462 
 463 inline LIR_OprDesc::OprType as_OprType(BasicType type) {
 464   switch (type) {
 465   case T_INT:      return LIR_OprDesc::int_type;
 466   case T_LONG:     return LIR_OprDesc::long_type;
 467   case T_FLOAT:    return LIR_OprDesc::float_type;
 468   case T_DOUBLE:   return LIR_OprDesc::double_type;
 469   case T_OBJECT:
 470   case T_VALUETYPE:
 471   case T_ARRAY:    return LIR_OprDesc::object_type;
 472   case T_ADDRESS:  return LIR_OprDesc::address_type;
 473   case T_METADATA: return LIR_OprDesc::metadata_type;
 474   case T_ILLEGAL:  // fall through
 475   default: ShouldNotReachHere(); return LIR_OprDesc::unknown_type;
 476   }
 477 }
 478 
 479 inline BasicType as_BasicType(LIR_OprDesc::OprType t) {
 480   switch (t) {
 481   case LIR_OprDesc::int_type:     return T_INT;
 482   case LIR_OprDesc::long_type:    return T_LONG;
 483   case LIR_OprDesc::float_type:   return T_FLOAT;
 484   case LIR_OprDesc::double_type:  return T_DOUBLE;
 485   case LIR_OprDesc::object_type:  return T_OBJECT;
 486   case LIR_OprDesc::address_type: return T_ADDRESS;
 487   case LIR_OprDesc::metadata_type:return T_METADATA;
 488   case LIR_OprDesc::unknown_type: // fall through
 489   default: ShouldNotReachHere();  return T_ILLEGAL;
 490   }


 636     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 637                                LIR_OprDesc::float_type          |
 638                                LIR_OprDesc::fpu_register        |
 639                                LIR_OprDesc::single_size         |
 640                                LIR_OprDesc::is_xmm_mask);
 641   }
 642   static LIR_Opr double_xmm(int reg) {
 643     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 644                                (reg << LIR_OprDesc::reg2_shift) |
 645                                LIR_OprDesc::double_type         |
 646                                LIR_OprDesc::fpu_register        |
 647                                LIR_OprDesc::double_size         |
 648                                LIR_OprDesc::is_xmm_mask);
 649   }
 650 #endif // X86
 651 
 652   static LIR_Opr virtual_register(int index, BasicType type) {
 653     LIR_Opr res;
 654     switch (type) {
 655       case T_OBJECT: // fall through
 656       case T_VALUETYPE: // fall through
 657       case T_ARRAY:
 658         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 659                                             LIR_OprDesc::object_type  |
 660                                             LIR_OprDesc::cpu_register |
 661                                             LIR_OprDesc::single_size  |
 662                                             LIR_OprDesc::virtual_mask);
 663         break;
 664 
 665       case T_METADATA:
 666         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 667                                             LIR_OprDesc::metadata_type|
 668                                             LIR_OprDesc::cpu_register |
 669                                             LIR_OprDesc::single_size  |
 670                                             LIR_OprDesc::virtual_mask);
 671         break;
 672 
 673       case T_INT:
 674         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 675                                   LIR_OprDesc::int_type              |
 676                                   LIR_OprDesc::cpu_register          |


 742                                t |
 743                                LIR_OprDesc::cpu_register |
 744                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 745 #else // __SOFTFP__
 746     LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) | t |
 747                                           ((type == T_FLOAT || type == T_DOUBLE) ?  LIR_OprDesc::fpu_register : LIR_OprDesc::cpu_register) |
 748                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 749     assert(res == old_res, "old and new method not equal");
 750 #endif // __SOFTFP__
 751 #endif // ASSERT
 752 
 753     return res;
 754   }
 755 
 756   // 'index' is computed by FrameMap::local_stack_pos(index); do not use other parameters as
 757   // the index is platform independent; a double stack useing indeces 2 and 3 has always
 758   // index 2.
 759   static LIR_Opr stack(int index, BasicType type) {
 760     LIR_Opr res;
 761     switch (type) {
 762       case T_VALUETYPE: // fall through
 763       case T_OBJECT: // fall through
 764       case T_ARRAY:
 765         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 766                                   LIR_OprDesc::object_type           |
 767                                   LIR_OprDesc::stack_value           |
 768                                   LIR_OprDesc::single_size);
 769         break;
 770 
 771       case T_METADATA:
 772         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 773                                   LIR_OprDesc::metadata_type         |
 774                                   LIR_OprDesc::stack_value           |
 775                                   LIR_OprDesc::single_size);
 776         break;
 777       case T_INT:
 778         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 779                                   LIR_OprDesc::int_type              |
 780                                   LIR_OprDesc::stack_value           |
 781                                   LIR_OprDesc::single_size);
 782         break;


< prev index next >