< prev index next >

src/hotspot/share/code/relocInfo.hpp


796  protected:                                                                                                                          
797   short*   data()         const { return binding()->data(); }                                                                        
798   int      datalen()      const { return binding()->datalen(); }                                                                     
799   int      format()       const { return binding()->format(); }                                                                      
800 
801  public:                                                                                                                             
802   virtual relocInfo::relocType type()            { return relocInfo::none; }                                                         
803 
804   // is it a call instruction?                                                                                                       
805   virtual bool is_call()                         { return false; }                                                                   
806 
807   // is it a data movement instruction?                                                                                              
808   virtual bool is_data()                         { return false; }                                                                   
809 
810   // some relocations can compute their own values                                                                                   
811   virtual address  value();                                                                                                          
812 
813   // all relocations are able to reassert their values                                                                               
814   virtual void set_value(address x);                                                                                                 
815 
816   virtual void clear_inline_cache()              { }                                                                                 
817 
818   // This method assumes that all virtual/static (inline) caches are cleared (since for static_call_type and                         
819   // ic_call_type is not always posisition dependent (depending on the state of the cache)). However, this is                        
820   // probably a reasonable assumption, since empty caches simplifies code reloacation.                                               
821   virtual void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { }                                                
822 };                                                                                                                                   
823 
824 
825 // certain inlines must be deferred until class Relocation is defined:                                                               
826 
827 inline RelocationHolder::RelocationHolder() {                                                                                        
828   // initialize the vtbl, just to keep things type-safe                                                                              
829   new(*this) Relocation();                                                                                                           
830 }                                                                                                                                    
831 
832 
833 inline RelocationHolder::RelocationHolder(Relocation* r) {                                                                           
834   // wordwise copy from r (ok if it copies garbage after r)                                                                          
835   for (int i = 0; i < _relocbuf_size; i++) {                                                                                         

796  protected:
797   short*   data()         const { return binding()->data(); }
798   int      datalen()      const { return binding()->datalen(); }
799   int      format()       const { return binding()->format(); }
800 
801  public:
802   virtual relocInfo::relocType type()            { return relocInfo::none; }
803 
804   // is it a call instruction?
805   virtual bool is_call()                         { return false; }
806 
807   // is it a data movement instruction?
808   virtual bool is_data()                         { return false; }
809 
810   // some relocations can compute their own values
811   virtual address  value();
812 
813   // all relocations are able to reassert their values
814   virtual void set_value(address x);
815 
816   virtual bool clear_inline_cache()              { return true; }
817 
818   // This method assumes that all virtual/static (inline) caches are cleared (since for static_call_type and
819   // ic_call_type is not always posisition dependent (depending on the state of the cache)). However, this is
820   // probably a reasonable assumption, since empty caches simplifies code reloacation.
821   virtual void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { }
822 };
823 
824 
825 // certain inlines must be deferred until class Relocation is defined:
826 
827 inline RelocationHolder::RelocationHolder() {
828   // initialize the vtbl, just to keep things type-safe
829   new(*this) Relocation();
830 }
831 
832 
833 inline RelocationHolder::RelocationHolder(Relocation* r) {
834   // wordwise copy from r (ok if it copies garbage after r)
835   for (int i = 0; i < _relocbuf_size; i++) {

1034     _method_index = method_index;                                                                                                    
1035     assert(cached_value != NULL, "first oop address must be specified");                                                             
1036   }                                                                                                                                  
1037 
1038   friend class RelocIterator;                                                                                                        
1039   virtual_call_Relocation() { }                                                                                                      
1040 
1041  public:                                                                                                                             
1042   address cached_value();                                                                                                            
1043 
1044   int     method_index() { return _method_index; }                                                                                   
1045   Method* method_value();                                                                                                            
1046 
1047   // data is packed as scaled offsets in "2_ints" format:  [f l] or [Ff Ll]                                                          
1048   // oop_limit is set to 0 if the limit falls somewhere within the call.                                                             
1049   // When unpacking, a zero oop_limit is taken to refer to the end of the call.                                                      
1050   // (This has the effect of bringing in the call's delay slot on SPARC.)                                                            
1051   void pack_data_to(CodeSection* dest);                                                                                              
1052   void unpack_data();                                                                                                                
1053 
1054   void clear_inline_cache();                                                                                                         
1055 };                                                                                                                                   
1056 
1057 
1058 class opt_virtual_call_Relocation : public CallRelocation {                                                                          
1059   relocInfo::relocType type() { return relocInfo::opt_virtual_call_type; }                                                           
1060 
1061  public:                                                                                                                             
1062   static RelocationHolder spec(int method_index = 0) {                                                                               
1063     RelocationHolder rh = newHolder();                                                                                               
1064     new(rh) opt_virtual_call_Relocation(method_index);                                                                               
1065     return rh;                                                                                                                       
1066   }                                                                                                                                  
1067 
1068  private:                                                                                                                            
1069   jint _method_index; // resolved method for a Java call                                                                             
1070 
1071   opt_virtual_call_Relocation(int method_index) {                                                                                    
1072     _method_index = method_index;                                                                                                    
1073   }                                                                                                                                  
1074 
1075   friend class RelocIterator;                                                                                                        
1076   opt_virtual_call_Relocation() {}                                                                                                   
1077 
1078  public:                                                                                                                             
1079   int     method_index() { return _method_index; }                                                                                   
1080   Method* method_value();                                                                                                            
1081 
1082   void pack_data_to(CodeSection* dest);                                                                                              
1083   void unpack_data();                                                                                                                
1084 
1085   void clear_inline_cache();                                                                                                         
1086 
1087   // find the matching static_stub                                                                                                   
1088   address static_stub(bool is_aot);                                                                                                  
1089 };                                                                                                                                   
1090 
1091 
1092 class static_call_Relocation : public CallRelocation {                                                                               
1093   relocInfo::relocType type() { return relocInfo::static_call_type; }                                                                
1094 
1095  public:                                                                                                                             
1096   static RelocationHolder spec(int method_index = 0) {                                                                               
1097     RelocationHolder rh = newHolder();                                                                                               
1098     new(rh) static_call_Relocation(method_index);                                                                                    
1099     return rh;                                                                                                                       
1100   }                                                                                                                                  
1101 
1102  private:                                                                                                                            
1103   jint _method_index; // resolved method for a Java call                                                                             
1104 
1105   static_call_Relocation(int method_index) {                                                                                         
1106     _method_index = method_index;                                                                                                    
1107   }                                                                                                                                  
1108 
1109   friend class RelocIterator;                                                                                                        
1110   static_call_Relocation() {}                                                                                                        
1111 
1112  public:                                                                                                                             
1113   int     method_index() { return _method_index; }                                                                                   
1114   Method* method_value();                                                                                                            
1115 
1116   void pack_data_to(CodeSection* dest);                                                                                              
1117   void unpack_data();                                                                                                                
1118 
1119   void clear_inline_cache();                                                                                                         
1120 
1121   // find the matching static_stub                                                                                                   
1122   address static_stub(bool is_aot);                                                                                                  
1123 };                                                                                                                                   
1124 
1125 class static_stub_Relocation : public Relocation {                                                                                   
1126   relocInfo::relocType type() { return relocInfo::static_stub_type; }                                                                
1127 
1128  public:                                                                                                                             
1129   static RelocationHolder spec(address static_call, bool is_aot = false) {                                                           
1130     RelocationHolder rh = newHolder();                                                                                               
1131     new(rh) static_stub_Relocation(static_call, is_aot);                                                                             
1132     return rh;                                                                                                                       
1133   }                                                                                                                                  
1134 
1135  private:                                                                                                                            
1136   address _static_call;  // location of corresponding static_call                                                                    
1137   bool _is_aot;          // trampoline to aot code                                                                                   
1138 
1139   static_stub_Relocation(address static_call, bool is_aot) {                                                                         
1140     _static_call = static_call;                                                                                                      
1141     _is_aot = is_aot;                                                                                                                
1142   }                                                                                                                                  
1143 
1144   friend class RelocIterator;                                                                                                        
1145   static_stub_Relocation() { }                                                                                                       
1146 
1147  public:                                                                                                                             
1148   void clear_inline_cache();                                                                                                         
1149 
1150   address static_call() { return _static_call; }                                                                                     
1151   bool is_aot() { return _is_aot; }                                                                                                  
1152 
1153   // data is packed as a scaled offset in "1_int" format:  [c] or [Cc]                                                               
1154   void pack_data_to(CodeSection* dest);                                                                                              
1155   void unpack_data();                                                                                                                
1156 };                                                                                                                                   
1157 
1158 class runtime_call_Relocation : public CallRelocation {                                                                              
1159   relocInfo::relocType type() { return relocInfo::runtime_call_type; }                                                               
1160 
1161  public:                                                                                                                             
1162   static RelocationHolder spec() {                                                                                                   
1163     RelocationHolder rh = newHolder();                                                                                               
1164     new(rh) runtime_call_Relocation();                                                                                               
1165     return rh;                                                                                                                       
1166   }                                                                                                                                  
1167 

1034     _method_index = method_index;
1035     assert(cached_value != NULL, "first oop address must be specified");
1036   }
1037 
1038   friend class RelocIterator;
1039   virtual_call_Relocation() { }
1040 
1041  public:
1042   address cached_value();
1043 
1044   int     method_index() { return _method_index; }
1045   Method* method_value();
1046 
1047   // data is packed as scaled offsets in "2_ints" format:  [f l] or [Ff Ll]
1048   // oop_limit is set to 0 if the limit falls somewhere within the call.
1049   // When unpacking, a zero oop_limit is taken to refer to the end of the call.
1050   // (This has the effect of bringing in the call's delay slot on SPARC.)
1051   void pack_data_to(CodeSection* dest);
1052   void unpack_data();
1053 
1054   bool clear_inline_cache();
1055 };
1056 
1057 
1058 class opt_virtual_call_Relocation : public CallRelocation {
1059   relocInfo::relocType type() { return relocInfo::opt_virtual_call_type; }
1060 
1061  public:
1062   static RelocationHolder spec(int method_index = 0) {
1063     RelocationHolder rh = newHolder();
1064     new(rh) opt_virtual_call_Relocation(method_index);
1065     return rh;
1066   }
1067 
1068  private:
1069   jint _method_index; // resolved method for a Java call
1070 
1071   opt_virtual_call_Relocation(int method_index) {
1072     _method_index = method_index;
1073   }
1074 
1075   friend class RelocIterator;
1076   opt_virtual_call_Relocation() {}
1077 
1078  public:
1079   int     method_index() { return _method_index; }
1080   Method* method_value();
1081 
1082   void pack_data_to(CodeSection* dest);
1083   void unpack_data();
1084 
1085   bool clear_inline_cache();
1086 
1087   // find the matching static_stub
1088   address static_stub(bool is_aot);
1089 };
1090 
1091 
1092 class static_call_Relocation : public CallRelocation {
1093   relocInfo::relocType type() { return relocInfo::static_call_type; }
1094 
1095  public:
1096   static RelocationHolder spec(int method_index = 0) {
1097     RelocationHolder rh = newHolder();
1098     new(rh) static_call_Relocation(method_index);
1099     return rh;
1100   }
1101 
1102  private:
1103   jint _method_index; // resolved method for a Java call
1104 
1105   static_call_Relocation(int method_index) {
1106     _method_index = method_index;
1107   }
1108 
1109   friend class RelocIterator;
1110   static_call_Relocation() {}
1111 
1112  public:
1113   int     method_index() { return _method_index; }
1114   Method* method_value();
1115 
1116   void pack_data_to(CodeSection* dest);
1117   void unpack_data();
1118 
1119   bool clear_inline_cache();
1120 
1121   // find the matching static_stub
1122   address static_stub(bool is_aot);
1123 };
1124 
1125 class static_stub_Relocation : public Relocation {
1126   relocInfo::relocType type() { return relocInfo::static_stub_type; }
1127 
1128  public:
1129   static RelocationHolder spec(address static_call, bool is_aot = false) {
1130     RelocationHolder rh = newHolder();
1131     new(rh) static_stub_Relocation(static_call, is_aot);
1132     return rh;
1133   }
1134 
1135  private:
1136   address _static_call;  // location of corresponding static_call
1137   bool _is_aot;          // trampoline to aot code
1138 
1139   static_stub_Relocation(address static_call, bool is_aot) {
1140     _static_call = static_call;
1141     _is_aot = is_aot;
1142   }
1143 
1144   friend class RelocIterator;
1145   static_stub_Relocation() { }
1146 
1147  public:
1148   bool clear_inline_cache();
1149 
1150   address static_call() { return _static_call; }
1151   bool is_aot() { return _is_aot; }
1152 
1153   // data is packed as a scaled offset in "1_int" format:  [c] or [Cc]
1154   void pack_data_to(CodeSection* dest);
1155   void unpack_data();
1156 };
1157 
1158 class runtime_call_Relocation : public CallRelocation {
1159   relocInfo::relocType type() { return relocInfo::runtime_call_type; }
1160 
1161  public:
1162   static RelocationHolder spec() {
1163     RelocationHolder rh = newHolder();
1164     new(rh) runtime_call_Relocation();
1165     return rh;
1166   }
1167 
< prev index next >