Mercurial > hg > truffle
comparison src/cpu/x86/vm/sharedRuntime_x86_64.cpp @ 3753:cba7b5c2d53f
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 | be4ca325525a 5432047c7db7 |
comparison
equal
deleted
inserted
replaced
3752:f918d6096e23 | 3753:cba7b5c2d53f |
---|---|
39 #endif | 39 #endif |
40 #ifdef COMPILER2 | 40 #ifdef COMPILER2 |
41 #include "opto/runtime.hpp" | 41 #include "opto/runtime.hpp" |
42 #endif | 42 #endif |
43 | 43 |
44 DeoptimizationBlob *SharedRuntime::_deopt_blob; | 44 #define __ masm-> |
45 #ifdef COMPILER2 | |
46 UncommonTrapBlob *SharedRuntime::_uncommon_trap_blob; | |
47 ExceptionBlob *OptoRuntime::_exception_blob; | |
48 #endif // COMPILER2 | |
49 | |
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 | |
60 #define __ masm-> | |
61 | 47 |
62 class SimpleRuntimeFrame { | 48 class SimpleRuntimeFrame { |
63 | 49 |
64 public: | 50 public: |
65 | 51 |
2528 uint SharedRuntime::out_preserve_stack_slots() { | 2514 uint SharedRuntime::out_preserve_stack_slots() { |
2529 return 0; | 2515 return 0; |
2530 } | 2516 } |
2531 | 2517 |
2532 | 2518 |
2533 //----------------------------generate_ricochet_blob--------------------------- | |
2534 void SharedRuntime::generate_ricochet_blob() { | |
2535 if (!EnableInvokeDynamic) return; // leave it as a null | |
2536 | |
2537 // allocate space for the code | |
2538 ResourceMark rm; | |
2539 // setup code generation tools | |
2540 CodeBuffer buffer("ricochet_blob", 512, 512); | |
2541 MacroAssembler* masm = new MacroAssembler(&buffer); | |
2542 | |
2543 int frame_size_in_words = -1, bounce_offset = -1, exception_offset = -1; | |
2544 MethodHandles::RicochetFrame::generate_ricochet_blob(masm, &frame_size_in_words, &bounce_offset, &exception_offset); | |
2545 | |
2546 // ------------- | |
2547 // make sure all code is generated | |
2548 masm->flush(); | |
2549 | |
2550 // failed to generate? | |
2551 if (frame_size_in_words < 0 || bounce_offset < 0 || exception_offset < 0) { | |
2552 assert(false, "bad ricochet blob"); | |
2553 return; | |
2554 } | |
2555 | |
2556 _ricochet_blob = RicochetBlob::create(&buffer, bounce_offset, exception_offset, frame_size_in_words); | |
2557 } | |
2558 | |
2559 //------------------------------generate_deopt_blob---------------------------- | 2519 //------------------------------generate_deopt_blob---------------------------- |
2560 void SharedRuntime::generate_deopt_blob() { | 2520 void SharedRuntime::generate_deopt_blob() { |
2561 // Allocate space for the code | 2521 // Allocate space for the code |
2562 ResourceMark rm; | 2522 ResourceMark rm; |
2563 // Setup code generation tools | 2523 // Setup code generation tools |
3044 //------------------------------generate_handler_blob------ | 3004 //------------------------------generate_handler_blob------ |
3045 // | 3005 // |
3046 // Generate a special Compile2Runtime blob that saves all registers, | 3006 // Generate a special Compile2Runtime blob that saves all registers, |
3047 // and setup oopmap. | 3007 // and setup oopmap. |
3048 // | 3008 // |
3049 static SafepointBlob* generate_handler_blob(address call_ptr, bool cause_return) { | 3009 SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, bool cause_return) { |
3050 assert(StubRoutines::forward_exception_entry() != NULL, | 3010 assert(StubRoutines::forward_exception_entry() != NULL, |
3051 "must be generated before"); | 3011 "must be generated before"); |
3052 | 3012 |
3053 ResourceMark rm; | 3013 ResourceMark rm; |
3054 OopMapSet *oop_maps = new OopMapSet(); | 3014 OopMapSet *oop_maps = new OopMapSet(); |
3130 // Generate a stub that calls into vm to find out the proper destination | 3090 // Generate a stub that calls into vm to find out the proper destination |
3131 // of a java call. All the argument registers are live at this point | 3091 // of a java call. All the argument registers are live at this point |
3132 // but since this is generic code we don't know what they are and the caller | 3092 // but since this is generic code we don't know what they are and the caller |
3133 // must do any gc of the args. | 3093 // must do any gc of the args. |
3134 // | 3094 // |
3135 static RuntimeStub* generate_resolve_blob(address destination, const char* name) { | 3095 RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) { |
3136 assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); | 3096 assert (StubRoutines::forward_exception_entry() != NULL, "must be generated before"); |
3137 | 3097 |
3138 // allocate space for the code | 3098 // allocate space for the code |
3139 ResourceMark rm; | 3099 ResourceMark rm; |
3140 | 3100 |
3204 masm->flush(); | 3164 masm->flush(); |
3205 | 3165 |
3206 // return the blob | 3166 // return the blob |
3207 // frame_size_words or bytes?? | 3167 // frame_size_words or bytes?? |
3208 return RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_in_words, oop_maps, true); | 3168 return RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_in_words, oop_maps, true); |
3209 } | |
3210 | |
3211 | |
3212 void SharedRuntime::generate_stubs() { | |
3213 | |
3214 _wrong_method_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method), | |
3215 "wrong_method_stub"); | |
3216 _ic_miss_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss), | |
3217 "ic_miss_stub"); | |
3218 _resolve_opt_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C), | |
3219 "resolve_opt_virtual_call"); | |
3220 | |
3221 _resolve_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C), | |
3222 "resolve_virtual_call"); | |
3223 | |
3224 _resolve_static_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C), | |
3225 "resolve_static_call"); | |
3226 _polling_page_safepoint_handler_blob = | |
3227 generate_handler_blob(CAST_FROM_FN_PTR(address, | |
3228 SafepointSynchronize::handle_polling_page_exception), false); | |
3229 | |
3230 _polling_page_return_handler_blob = | |
3231 generate_handler_blob(CAST_FROM_FN_PTR(address, | |
3232 SafepointSynchronize::handle_polling_page_exception), true); | |
3233 | |
3234 generate_ricochet_blob(); | |
3235 | |
3236 generate_deopt_blob(); | |
3237 | |
3238 #ifdef COMPILER2 | |
3239 generate_uncommon_trap_blob(); | |
3240 #endif // COMPILER2 | |
3241 } | 3169 } |
3242 | 3170 |
3243 | 3171 |
3244 #ifdef COMPILER2 | 3172 #ifdef COMPILER2 |
3245 // This is here instead of runtime_x86_64.cpp because it uses SimpleRuntimeFrame | 3173 // This is here instead of runtime_x86_64.cpp because it uses SimpleRuntimeFrame |