Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/sharedRuntime_x86_32.cpp @ 3442:f7d55ea6ee56
7045514: SPARC assembly code for JSR 292 ricochet frames
Reviewed-by: kvn, jrose
author | never |
---|---|
date | Fri, 03 Jun 2011 22:31:43 -0700 |
parents | 167b70ff3abc |
children | 5432047c7db7 |
comparison
equal
deleted
inserted
replaced
3441:f56542cb325a | 3442:f7d55ea6ee56 |
---|---|
40 #ifdef COMPILER2 | 40 #ifdef COMPILER2 |
41 #include "opto/runtime.hpp" | 41 #include "opto/runtime.hpp" |
42 #endif | 42 #endif |
43 | 43 |
44 #define __ masm-> | 44 #define __ masm-> |
45 #ifdef COMPILER2 | |
46 UncommonTrapBlob *SharedRuntime::_uncommon_trap_blob; | |
47 #endif // COMPILER2 | |
48 | |
49 DeoptimizationBlob *SharedRuntime::_deopt_blob; | |
50 SafepointBlob *SharedRuntime::_polling_page_safepoint_handler_blob; | |
51 SafepointBlob *SharedRuntime::_polling_page_return_handler_blob; | |
52 RuntimeStub* SharedRuntime::_wrong_method_blob; | |
53 RuntimeStub* SharedRuntime::_ic_miss_blob; | |
54 RuntimeStub* SharedRuntime::_resolve_opt_virtual_call_blob; | |
55 RuntimeStub* SharedRuntime::_resolve_virtual_call_blob; | |
56 RuntimeStub* SharedRuntime::_resolve_static_call_blob; | |
57 | 45 |
58 const int StackAlignmentInSlots = StackAlignmentInBytes / VMRegImpl::stack_slot_size; | 46 const int StackAlignmentInSlots = StackAlignmentInBytes / VMRegImpl::stack_slot_size; |
59 | 47 |
60 class RegisterSaver { | 48 class RegisterSaver { |
61 enum { FPU_regs_live = 8 /*for the FPU stack*/+8/*eight more for XMM registers*/ }; | 49 enum { FPU_regs_live = 8 /*for the FPU stack*/+8/*eight more for XMM registers*/ }; |
2251 | 2239 |
2252 uint SharedRuntime::out_preserve_stack_slots() { | 2240 uint SharedRuntime::out_preserve_stack_slots() { |
2253 return 0; | 2241 return 0; |
2254 } | 2242 } |
2255 | 2243 |
2256 //----------------------------generate_ricochet_blob--------------------------- | |
2257 void SharedRuntime::generate_ricochet_blob() { | |
2258 if (!EnableInvokeDynamic) return; // leave it as a null | |
2259 | |
2260 // allocate space for the code | |
2261 ResourceMark rm; | |
2262 // setup code generation tools | |
2263 CodeBuffer buffer("ricochet_blob", 256, 256); | |
2264 MacroAssembler* masm = new MacroAssembler(&buffer); | |
2265 | |
2266 int frame_size_in_words = -1, bounce_offset = -1, exception_offset = -1; | |
2267 MethodHandles::RicochetFrame::generate_ricochet_blob(masm, &frame_size_in_words, &bounce_offset, &exception_offset); | |
2268 | |
2269 // ------------- | |
2270 // make sure all code is generated | |
2271 masm->flush(); | |
2272 | |
2273 // failed to generate? | |
2274 if (frame_size_in_words < 0 || bounce_offset < 0 || exception_offset < 0) { | |
2275 assert(false, "bad ricochet blob"); | |
2276 return; | |
2277 } | |
2278 | |
2279 _ricochet_blob = RicochetBlob::create(&buffer, bounce_offset, exception_offset, frame_size_in_words); | |
2280 } | |
2281 | 2244 |
2282 //------------------------------generate_deopt_blob---------------------------- | 2245 //------------------------------generate_deopt_blob---------------------------- |
2283 void SharedRuntime::generate_deopt_blob() { | 2246 void SharedRuntime::generate_deopt_blob() { |
2284 // allocate space for the code | 2247 // allocate space for the code |
2285 ResourceMark rm; | 2248 ResourceMark rm; |
2814 // | 2777 // |
2815 // Generate a special Compile2Runtime blob that saves all registers, | 2778 // Generate a special Compile2Runtime blob that saves all registers, |
2816 // setup oopmap, and calls safepoint code to stop the compiled code for | 2779 // setup oopmap, and calls safepoint code to stop the compiled code for |
2817 // a safepoint. | 2780 // a safepoint. |
2818 // | 2781 // |
2819 static SafepointBlob* generate_handler_blob(address call_ptr, bool cause_return) { | 2782 SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, bool cause_return) { |
2820 | 2783 |
2821 // Account for thread arg in our frame | 2784 // Account for thread arg in our frame |
2822 const int additional_words = 1; | 2785 const int additional_words = 1; |
2823 int frame_size_in_words; | 2786 int frame_size_in_words; |
2824 | 2787 |
2911 // Generate a stub that calls into vm to find out the proper destination | 2874 // Generate a stub that calls into vm to find out the proper destination |
2912 // of a java call. All the argument registers are live at this point | 2875 // of a java call. All the argument registers are live at this point |
2913 // but since this is generic code we don't know what they are and the caller | 2876 // but since this is generic code we don't know what they are and the caller |
2914 // must do any gc of the args. | 2877 // must do any gc of the args. |
2915 // | 2878 // |
2916 static RuntimeStub* generate_resolve_blob(address destination, const char* name) { | 2879 RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) { |
2917 assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); | 2880 assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); |
2918 | 2881 |
2919 // allocate space for the code | 2882 // allocate space for the code |
2920 ResourceMark rm; | 2883 ResourceMark rm; |
2921 | 2884 |
2993 | 2956 |
2994 // return the blob | 2957 // return the blob |
2995 // frame_size_words or bytes?? | 2958 // frame_size_words or bytes?? |
2996 return RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_words, oop_maps, true); | 2959 return RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_words, oop_maps, true); |
2997 } | 2960 } |
2998 | |
2999 void SharedRuntime::generate_stubs() { | |
3000 | |
3001 _wrong_method_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method), | |
3002 "wrong_method_stub"); | |
3003 | |
3004 _ic_miss_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss), | |
3005 "ic_miss_stub"); | |
3006 | |
3007 _resolve_opt_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C), | |
3008 "resolve_opt_virtual_call"); | |
3009 | |
3010 _resolve_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C), | |
3011 "resolve_virtual_call"); | |
3012 | |
3013 _resolve_static_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C), | |
3014 "resolve_static_call"); | |
3015 | |
3016 _polling_page_safepoint_handler_blob = | |
3017 generate_handler_blob(CAST_FROM_FN_PTR(address, | |
3018 SafepointSynchronize::handle_polling_page_exception), false); | |
3019 | |
3020 _polling_page_return_handler_blob = | |
3021 generate_handler_blob(CAST_FROM_FN_PTR(address, | |
3022 SafepointSynchronize::handle_polling_page_exception), true); | |
3023 | |
3024 generate_ricochet_blob(); | |
3025 | |
3026 generate_deopt_blob(); | |
3027 #ifdef COMPILER2 | |
3028 generate_uncommon_trap_blob(); | |
3029 #endif // COMPILER2 | |
3030 } |