< prev index next >

src/hotspot/share/code/icBuffer.hpp


12  * accompanied this code).                                                                                                           
13  *                                                                                                                                   
14  * You should have received a copy of the GNU General Public License version                                                         
15  * 2 along with this work; if not, write to the Free Software Foundation,                                                            
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.                                                                     
17  *                                                                                                                                   
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA                                                           
19  * or visit www.oracle.com if you need additional information or have any                                                            
20  * questions.                                                                                                                        
21  *                                                                                                                                   
22  */                                                                                                                                  
23 
24 #ifndef SHARE_VM_CODE_ICBUFFER_HPP                                                                                                   
25 #define SHARE_VM_CODE_ICBUFFER_HPP                                                                                                   
26 
27 #include "asm/codeBuffer.hpp"                                                                                                        
28 #include "code/stubs.hpp"                                                                                                            
29 #include "interpreter/bytecodes.hpp"                                                                                                 
30 #include "memory/allocation.hpp"                                                                                                     
31 #include "utilities/align.hpp"                                                                                                       
                                                                                                                                     
32 
33 //                                                                                                                                   
34 // For CompiledIC's:                                                                                                                 
35 //                                                                                                                                   
36 // In cases where we do not have MT-safe state transformation,                                                                       
37 // we go to a transition state, using ICStubs. At a safepoint,                                                                       
38 // the inline caches are transferred from the transitional code:                                                                     
39 //                                                                                                                                   
40 //    instruction_address --> 01 set xxx_oop, Ginline_cache_klass                                                                    
41 //                            23 jump_to Gtemp, yyyy                                                                                 
42 //                            4  nop                                                                                                 
43 
44 class ICStub: public Stub {                                                                                                          
45  private:                                                                                                                            
46   int                 _size;       // total size of the stub incl. code                                                              
47   address             _ic_site;    // points at call instruction of owning ic-buffer                                                 
48   /* stub code follows here */                                                                                                       
49  protected:                                                                                                                          
50   friend class ICStubInterface;                                                                                                      

12  * accompanied this code).
13  *
14  * You should have received a copy of the GNU General Public License version
15  * 2 along with this work; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19  * or visit www.oracle.com if you need additional information or have any
20  * questions.
21  *
22  */
23 
24 #ifndef SHARE_VM_CODE_ICBUFFER_HPP
25 #define SHARE_VM_CODE_ICBUFFER_HPP
26 
27 #include "asm/codeBuffer.hpp"
28 #include "code/stubs.hpp"
29 #include "interpreter/bytecodes.hpp"
30 #include "memory/allocation.hpp"
31 #include "utilities/align.hpp"
32 #include "utilities/macros.hpp"
33 
34 //
35 // For CompiledIC's:
36 //
37 // In cases where we do not have MT-safe state transformation,
38 // we go to a transition state, using ICStubs. At a safepoint,
39 // the inline caches are transferred from the transitional code:
40 //
41 //    instruction_address --> 01 set xxx_oop, Ginline_cache_klass
42 //                            23 jump_to Gtemp, yyyy
43 //                            4  nop
44 
45 class ICStub: public Stub {
46  private:
47   int                 _size;       // total size of the stub incl. code
48   address             _ic_site;    // points at call instruction of owning ic-buffer
49   /* stub code follows here */
50  protected:
51   friend class ICStubInterface;

85 // ICStub Creation                                                                                                                   
86 inline ICStub* ICStub_from_destination_address(address destination_address) {                                                        
87   ICStub* stub = (ICStub*) (destination_address - align_up(sizeof(ICStub), CodeEntryAlignment));                                     
88   #ifdef ASSERT                                                                                                                      
89   stub->verify();                                                                                                                    
90   #endif                                                                                                                             
91   return stub;                                                                                                                       
92 }                                                                                                                                    
93 
94 class InlineCacheBuffer: public AllStatic {                                                                                          
95  private:                                                                                                                            
96   // friends                                                                                                                         
97   friend class ICStub;                                                                                                               
98 
99   static int ic_stub_code_size();                                                                                                    
100 
101   static StubQueue* _buffer;                                                                                                         
102 
103   static CompiledICHolder* _pending_released;                                                                                        
104   static int _pending_count;                                                                                                         
                                                                                                                                     
                                                                                                                                     
105 
106   static StubQueue* buffer()                         { return _buffer;         }                                                     
107 
108   static ICStub* new_ic_stub();                                                                                                      
109 
110   // Machine-dependent implementation of ICBuffer                                                                                    
111   static void    assemble_ic_buffer_code(address code_begin, void* cached_value, address entry_point);                               
112   static address ic_buffer_entry_point  (address code_begin);                                                                        
113   static void*   ic_buffer_cached_value (address code_begin);                                                                        
114 
115  public:                                                                                                                             
116 
117     // Initialization; must be called before first usage                                                                             
118   static void initialize();                                                                                                          
119 
120   // Access                                                                                                                          
121   static bool contains(address instruction_address);                                                                                 
122 
123     // removes the ICStubs after backpatching                                                                                        

86 // ICStub Creation
87 inline ICStub* ICStub_from_destination_address(address destination_address) {
88   ICStub* stub = (ICStub*) (destination_address - align_up(sizeof(ICStub), CodeEntryAlignment));
89   #ifdef ASSERT
90   stub->verify();
91   #endif
92   return stub;
93 }
94 
95 class InlineCacheBuffer: public AllStatic {
96  private:
97   // friends
98   friend class ICStub;
99 
100   static int ic_stub_code_size();
101 
102   static StubQueue* _buffer;
103 
104   static CompiledICHolder* _pending_released;
105   static int _pending_count;
106 
107   DEBUG_ONLY(static volatile int _needs_refill;)
108 
109   static StubQueue* buffer()                         { return _buffer;         }
110 
111   static ICStub* new_ic_stub();
112 
113   // Machine-dependent implementation of ICBuffer
114   static void    assemble_ic_buffer_code(address code_begin, void* cached_value, address entry_point);
115   static address ic_buffer_entry_point  (address code_begin);
116   static void*   ic_buffer_cached_value (address code_begin);
117 
118  public:
119 
120     // Initialization; must be called before first usage
121   static void initialize();
122 
123   // Access
124   static bool contains(address instruction_address);
125 
126     // removes the ICStubs after backpatching
< prev index next >