68 #define LAST_STUB_NAME(x) #x " Runtime1 stub" |
68 #define LAST_STUB_NAME(x) #x " Runtime1 stub" |
69 |
69 |
70 class Runtime1: public AllStatic { |
70 class Runtime1: public AllStatic { |
71 friend class VMStructs; |
71 friend class VMStructs; |
72 friend class ArrayCopyStub; |
72 friend class ArrayCopyStub; |
73 private: |
|
74 static int desired_max_code_buffer_size() { |
|
75 return (int) NMethodSizeLimit; // default 256K or 512K |
|
76 } |
|
77 static int desired_max_constant_size() { |
|
78 return (int) NMethodSizeLimit / 10; // about 25K |
|
79 } |
|
80 |
|
81 // Note: This buffers is allocated once at startup since allocation |
|
82 // for each compilation seems to be too expensive (at least on Intel |
|
83 // win32). |
|
84 static BufferBlob* _buffer_blob; |
|
85 |
73 |
86 public: |
74 public: |
87 enum StubID { |
75 enum StubID { |
88 RUNTIME1_STUBS(DECLARE_STUB_ID, DECLARE_LAST_STUB_ID) |
76 RUNTIME1_STUBS(DECLARE_STUB_ID, DECLARE_LAST_STUB_ID) |
89 }; |
77 }; |
113 static int _throw_array_store_exception_count; |
101 static int _throw_array_store_exception_count; |
114 static int _throw_count; |
102 static int _throw_count; |
115 #endif |
103 #endif |
116 |
104 |
117 private: |
105 private: |
118 static bool _is_initialized; |
|
119 static CodeBlob* _blobs[number_of_ids]; |
106 static CodeBlob* _blobs[number_of_ids]; |
120 static const char* _blob_names[]; |
107 static const char* _blob_names[]; |
121 |
108 |
122 // stub generation |
109 // stub generation |
123 static void generate_blob_for(StubID id); |
110 static void generate_blob_for(BufferBlob* blob, StubID id); |
124 static OopMapSet* generate_code_for(StubID id, StubAssembler* masm); |
111 static OopMapSet* generate_code_for(StubID id, StubAssembler* masm); |
125 static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument); |
112 static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument); |
126 static void generate_handle_exception(StubAssembler *sasm, OopMapSet* oop_maps, OopMap* oop_map, bool ignore_fpu_registers = false); |
113 static void generate_handle_exception(StubAssembler *sasm, OopMapSet* oop_maps, OopMap* oop_map, bool ignore_fpu_registers = false); |
127 static void generate_unwind_exception(StubAssembler *sasm); |
114 static void generate_unwind_exception(StubAssembler *sasm); |
128 static OopMapSet* generate_patching(StubAssembler* sasm, address target); |
115 static OopMapSet* generate_patching(StubAssembler* sasm, address target); |
160 static int move_klass_patching(JavaThread* thread); |
147 static int move_klass_patching(JavaThread* thread); |
161 |
148 |
162 static void patch_code(JavaThread* thread, StubID stub_id); |
149 static void patch_code(JavaThread* thread, StubID stub_id); |
163 |
150 |
164 public: |
151 public: |
165 static BufferBlob* get_buffer_blob(); |
|
166 static void setup_code_buffer(CodeBuffer* cb, int call_stub_estimate); |
|
167 |
|
168 // initialization |
152 // initialization |
169 static bool is_initialized() { return _is_initialized; } |
153 static void initialize(BufferBlob* blob); |
170 static void initialize(); |
|
171 static void initialize_pd(); |
154 static void initialize_pd(); |
172 |
155 |
173 // stubs |
156 // stubs |
174 static CodeBlob* blob_for (StubID id); |
157 static CodeBlob* blob_for (StubID id); |
175 static address entry_for(StubID id) { return blob_for(id)->instructions_begin(); } |
158 static address entry_for(StubID id) { return blob_for(id)->instructions_begin(); } |