31 #include "c1/c1_MacroAssembler.hpp" |
31 #include "c1/c1_MacroAssembler.hpp" |
32 #include "c1/c1_Runtime1.hpp" |
32 #include "c1/c1_Runtime1.hpp" |
33 #include "classfile/systemDictionary.hpp" |
33 #include "classfile/systemDictionary.hpp" |
34 #include "classfile/vmSymbols.hpp" |
34 #include "classfile/vmSymbols.hpp" |
35 #include "code/codeBlob.hpp" |
35 #include "code/codeBlob.hpp" |
36 #include "code/codeCacheExtensions.hpp" |
|
37 #include "code/compiledIC.hpp" |
36 #include "code/compiledIC.hpp" |
38 #include "code/pcDesc.hpp" |
37 #include "code/pcDesc.hpp" |
39 #include "code/scopeDesc.hpp" |
38 #include "code/scopeDesc.hpp" |
40 #include "code/vtableStubs.hpp" |
39 #include "code/vtableStubs.hpp" |
41 #include "compiler/disassembler.hpp" |
40 #include "compiler/disassembler.hpp" |
187 |
186 |
188 OopMapSet* oop_maps; |
187 OopMapSet* oop_maps; |
189 int frame_size; |
188 int frame_size; |
190 bool must_gc_arguments; |
189 bool must_gc_arguments; |
191 |
190 |
192 if (!CodeCacheExtensions::skip_compiler_support()) { |
191 Compilation::setup_code_buffer(&code, 0); |
193 // bypass useless code generation |
192 |
194 Compilation::setup_code_buffer(&code, 0); |
193 // create assembler for code generation |
195 |
194 StubAssembler* sasm = new StubAssembler(&code, name_for(id), id); |
196 // create assembler for code generation |
195 // generate code for runtime stub |
197 StubAssembler* sasm = new StubAssembler(&code, name_for(id), id); |
196 oop_maps = generate_code_for(id, sasm); |
198 // generate code for runtime stub |
197 assert(oop_maps == NULL || sasm->frame_size() != no_frame_size, |
199 oop_maps = generate_code_for(id, sasm); |
198 "if stub has an oop map it must have a valid frame size"); |
200 assert(oop_maps == NULL || sasm->frame_size() != no_frame_size, |
|
201 "if stub has an oop map it must have a valid frame size"); |
|
202 |
199 |
203 #ifdef ASSERT |
200 #ifdef ASSERT |
204 // Make sure that stubs that need oopmaps have them |
201 // Make sure that stubs that need oopmaps have them |
205 switch (id) { |
202 switch (id) { |
206 // These stubs don't need to have an oopmap |
203 // These stubs don't need to have an oopmap |
207 case dtrace_object_alloc_id: |
204 case dtrace_object_alloc_id: |
208 case g1_pre_barrier_slow_id: |
205 case g1_pre_barrier_slow_id: |
209 case g1_post_barrier_slow_id: |
206 case g1_post_barrier_slow_id: |
210 case slow_subtype_check_id: |
207 case slow_subtype_check_id: |
211 case fpu2long_stub_id: |
208 case fpu2long_stub_id: |
212 case unwind_exception_id: |
209 case unwind_exception_id: |
213 case counter_overflow_id: |
210 case counter_overflow_id: |
214 #if defined(SPARC) || defined(PPC32) |
211 #if defined(SPARC) || defined(PPC32) |
215 case handle_exception_nofpu_id: // Unused on sparc |
212 case handle_exception_nofpu_id: // Unused on sparc |
216 #endif |
213 #endif |
217 break; |
214 break; |
218 |
215 |
219 // All other stubs should have oopmaps |
216 // All other stubs should have oopmaps |
220 default: |
217 default: |
221 assert(oop_maps != NULL, "must have an oopmap"); |
218 assert(oop_maps != NULL, "must have an oopmap"); |
222 } |
219 } |
223 #endif |
220 #endif |
224 |
221 |
225 // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned) |
222 // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned) |
226 sasm->align(BytesPerWord); |
223 sasm->align(BytesPerWord); |
227 // make sure all code is in code buffer |
224 // make sure all code is in code buffer |
228 sasm->flush(); |
225 sasm->flush(); |
229 |
226 |
230 frame_size = sasm->frame_size(); |
227 frame_size = sasm->frame_size(); |
231 must_gc_arguments = sasm->must_gc_arguments(); |
228 must_gc_arguments = sasm->must_gc_arguments(); |
232 } else { |
|
233 /* ignored values */ |
|
234 oop_maps = NULL; |
|
235 frame_size = 0; |
|
236 must_gc_arguments = false; |
|
237 } |
|
238 // create blob - distinguish a few special cases |
229 // create blob - distinguish a few special cases |
239 CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id), |
230 CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id), |
240 &code, |
231 &code, |
241 CodeOffsets::frame_never_safe, |
232 CodeOffsets::frame_never_safe, |
242 frame_size, |
233 frame_size, |