hotspot/src/share/vm/ci/ciMethodData.hpp
changeset 20702 bbe0fcde6e13
parent 20695 4f5a5e95090b
child 20709 034be898bf04
equal deleted inserted replaced
20701:ef9996662fd5 20702:bbe0fcde6e13
    39 class ciRetData;
    39 class ciRetData;
    40 class ciBranchData;
    40 class ciBranchData;
    41 class ciArrayData;
    41 class ciArrayData;
    42 class ciMultiBranchData;
    42 class ciMultiBranchData;
    43 class ciArgInfoData;
    43 class ciArgInfoData;
       
    44 class ciCallTypeData;
       
    45 class ciVirtualCallTypeData;
    44 
    46 
    45 typedef ProfileData ciProfileData;
    47 typedef ProfileData ciProfileData;
    46 
    48 
    47 class ciBitData : public BitData {
    49 class ciBitData : public BitData {
    48 public:
    50 public:
    55 };
    57 };
    56 
    58 
    57 class ciJumpData : public JumpData {
    59 class ciJumpData : public JumpData {
    58 public:
    60 public:
    59   ciJumpData(DataLayout* layout) : JumpData(layout) {};
    61   ciJumpData(DataLayout* layout) : JumpData(layout) {};
       
    62 };
       
    63 
       
    64 class ciTypeEntries {
       
    65 protected:
       
    66   static intptr_t translate_klass(intptr_t k) {
       
    67     Klass* v = TypeEntries::valid_klass(k);
       
    68     if (v != NULL) {
       
    69       ciKlass* klass = CURRENT_ENV->get_klass(v);
       
    70       return with_status(klass, k);
       
    71     }
       
    72     return with_status(NULL, k);
       
    73   }
       
    74 
       
    75 public:
       
    76   static ciKlass* valid_ciklass(intptr_t k) {
       
    77     if (!TypeEntries::is_type_none(k) &&
       
    78         !TypeEntries::is_type_unknown(k)) {
       
    79       return (ciKlass*)TypeEntries::klass_part(k);
       
    80     } else {
       
    81       return NULL;
       
    82     }
       
    83   }
       
    84 
       
    85   static intptr_t with_status(ciKlass* k, intptr_t in) {
       
    86     return TypeEntries::with_status((intptr_t)k, in);
       
    87   }
       
    88 
       
    89 #ifndef PRODUCT
       
    90   static void print_ciklass(outputStream* st, intptr_t k);
       
    91 #endif
       
    92 };
       
    93 
       
    94 class ciTypeStackSlotEntries : public TypeStackSlotEntries, ciTypeEntries {
       
    95 public:
       
    96   void translate_type_data_from(const TypeStackSlotEntries* args);
       
    97 
       
    98   ciKlass* valid_type(int i) const {
       
    99     return valid_ciklass(type(i));
       
   100   }
       
   101 
       
   102 #ifndef PRODUCT
       
   103   void print_data_on(outputStream* st) const;
       
   104 #endif
       
   105 };
       
   106 
       
   107 class ciCallTypeData : public CallTypeData {
       
   108 public:
       
   109   ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {}
       
   110 
       
   111   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); }
       
   112 
       
   113   virtual void translate_from(const ProfileData* data) {
       
   114     args()->translate_type_data_from(data->as_CallTypeData()->args());
       
   115   }
       
   116 
       
   117   ciKlass* valid_argument_type(int i) const {
       
   118     return args()->valid_type(i);
       
   119   }
       
   120 
       
   121 #ifndef PRODUCT
       
   122   void print_data_on(outputStream* st) const;
       
   123 #endif
    60 };
   124 };
    61 
   125 
    62 class ciReceiverTypeData : public ReceiverTypeData {
   126 class ciReceiverTypeData : public ReceiverTypeData {
    63 public:
   127 public:
    64   ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {};
   128   ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {};
    67     assert((uint)row < row_limit(), "oob");
   131     assert((uint)row < row_limit(), "oob");
    68     set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count,
   132     set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count,
    69                   (intptr_t) recv);
   133                   (intptr_t) recv);
    70   }
   134   }
    71 
   135 
    72   ciKlass* receiver(uint row) {
   136   ciKlass* receiver(uint row) const {
    73     assert((uint)row < row_limit(), "oob");
   137     assert((uint)row < row_limit(), "oob");
    74     ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count);
   138     ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count);
    75     assert(recv == NULL || recv->is_klass(), "wrong type");
   139     assert(recv == NULL || recv->is_klass(), "wrong type");
    76     return recv;
   140     return recv;
    77   }
   141   }
    78 
   142 
    79   // Copy & translate from oop based ReceiverTypeData
   143   // Copy & translate from oop based ReceiverTypeData
    80   virtual void translate_from(ProfileData* data) {
   144   virtual void translate_from(const ProfileData* data) {
    81     translate_receiver_data_from(data);
   145     translate_receiver_data_from(data);
    82   }
   146   }
    83   void translate_receiver_data_from(ProfileData* data);
   147   void translate_receiver_data_from(const ProfileData* data);
    84 #ifndef PRODUCT
   148 #ifndef PRODUCT
    85   void print_data_on(outputStream* st);
   149   void print_data_on(outputStream* st) const;
    86   void print_receiver_data_on(outputStream* st);
   150   void print_receiver_data_on(outputStream* st) const;
    87 #endif
   151 #endif
    88 };
   152 };
    89 
   153 
    90 class ciVirtualCallData : public VirtualCallData {
   154 class ciVirtualCallData : public VirtualCallData {
    91   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
   155   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
    92   ciReceiverTypeData* rtd_super() { return (ciReceiverTypeData*) this; }
   156   ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }
    93 
   157 
    94 public:
   158 public:
    95   ciVirtualCallData(DataLayout* layout) : VirtualCallData(layout) {};
   159   ciVirtualCallData(DataLayout* layout) : VirtualCallData(layout) {};
    96 
   160 
    97   void set_receiver(uint row, ciKlass* recv) {
   161   void set_receiver(uint row, ciKlass* recv) {
   101   ciKlass* receiver(uint row) {
   165   ciKlass* receiver(uint row) {
   102     return rtd_super()->receiver(row);
   166     return rtd_super()->receiver(row);
   103   }
   167   }
   104 
   168 
   105   // Copy & translate from oop based VirtualCallData
   169   // Copy & translate from oop based VirtualCallData
   106   virtual void translate_from(ProfileData* data) {
   170   virtual void translate_from(const ProfileData* data) {
   107     rtd_super()->translate_receiver_data_from(data);
   171     rtd_super()->translate_receiver_data_from(data);
   108   }
   172   }
   109 #ifndef PRODUCT
   173 #ifndef PRODUCT
   110   void print_data_on(outputStream* st);
   174   void print_data_on(outputStream* st) const;
       
   175 #endif
       
   176 };
       
   177 
       
   178 class ciVirtualCallTypeData : public VirtualCallTypeData {
       
   179 private:
       
   180   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
       
   181   ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }
       
   182 
       
   183 public:
       
   184   ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {}
       
   185 
       
   186   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); }
       
   187 
       
   188   void set_receiver(uint row, ciKlass* recv) {
       
   189     rtd_super()->set_receiver(row, recv);
       
   190   }
       
   191 
       
   192   ciKlass* receiver(uint row) const {
       
   193     return rtd_super()->receiver(row);
       
   194   }
       
   195 
       
   196   // Copy & translate from oop based VirtualCallData
       
   197   virtual void translate_from(const ProfileData* data) {
       
   198     rtd_super()->translate_receiver_data_from(data);
       
   199     args()->translate_type_data_from(data->as_VirtualCallTypeData()->args());
       
   200   }
       
   201 
       
   202   ciKlass* valid_argument_type(int i) const {
       
   203     return args()->valid_type(i);
       
   204   }
       
   205 
       
   206 #ifndef PRODUCT
       
   207   void print_data_on(outputStream* st) const;
   111 #endif
   208 #endif
   112 };
   209 };
   113 
   210 
   114 
   211 
   115 class ciRetData : public RetData {
   212 class ciRetData : public RetData {
   245   // meaning it's not trivial.
   342   // meaning it's not trivial.
   246   void set_would_profile(bool p);
   343   void set_would_profile(bool p);
   247   // Also set the numer of loops and blocks in the method.
   344   // Also set the numer of loops and blocks in the method.
   248   // Again, this is used to determine if a method is trivial.
   345   // Again, this is used to determine if a method is trivial.
   249   void set_compilation_stats(short loops, short blocks);
   346   void set_compilation_stats(short loops, short blocks);
       
   347   // If the compiler finds a profiled type that is known statically
       
   348   // for sure, set it in the MethodData
       
   349   void set_argument_type(int bci, int i, ciKlass* k);
   250 
   350 
   251   void load_data();
   351   void load_data();
   252 
   352 
   253   // Convert a dp (data pointer) to a di (data index).
   353   // Convert a dp (data pointer) to a di (data index).
   254   int dp_to_di(address dp) {
   354   int dp_to_di(address dp) {