Mercurial > hg > truffle
comparison src/share/vm/runtime/sharedRuntime.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 | 38fa55e5e792 |
comparison
equal
deleted
inserted
replaced
3752:f918d6096e23 | 3753:cba7b5c2d53f |
---|---|
78 #endif | 78 #endif |
79 #ifdef COMPILER1 | 79 #ifdef COMPILER1 |
80 #include "c1/c1_Runtime1.hpp" | 80 #include "c1/c1_Runtime1.hpp" |
81 #endif | 81 #endif |
82 | 82 |
83 // Shared stub locations | |
84 RuntimeStub* SharedRuntime::_wrong_method_blob; | |
85 RuntimeStub* SharedRuntime::_ic_miss_blob; | |
86 RuntimeStub* SharedRuntime::_resolve_opt_virtual_call_blob; | |
87 RuntimeStub* SharedRuntime::_resolve_virtual_call_blob; | |
88 RuntimeStub* SharedRuntime::_resolve_static_call_blob; | |
89 | |
90 DeoptimizationBlob* SharedRuntime::_deopt_blob; | |
91 RicochetBlob* SharedRuntime::_ricochet_blob; | |
92 | |
93 SafepointBlob* SharedRuntime::_polling_page_safepoint_handler_blob; | |
94 SafepointBlob* SharedRuntime::_polling_page_return_handler_blob; | |
95 | |
96 #ifdef COMPILER2 | |
97 UncommonTrapBlob* SharedRuntime::_uncommon_trap_blob; | |
98 #endif // COMPILER2 | |
99 | |
100 | |
101 //----------------------------generate_stubs----------------------------------- | |
102 void SharedRuntime::generate_stubs() { | |
103 _wrong_method_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method), "wrong_method_stub"); | |
104 _ic_miss_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss), "ic_miss_stub"); | |
105 _resolve_opt_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C), "resolve_opt_virtual_call"); | |
106 _resolve_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C), "resolve_virtual_call"); | |
107 _resolve_static_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C), "resolve_static_call"); | |
108 | |
109 _polling_page_safepoint_handler_blob = generate_handler_blob(CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception), false); | |
110 _polling_page_return_handler_blob = generate_handler_blob(CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception), true); | |
111 | |
112 generate_ricochet_blob(); | |
113 generate_deopt_blob(); | |
114 | |
115 #ifdef COMPILER2 | |
116 generate_uncommon_trap_blob(); | |
117 #endif // COMPILER2 | |
118 } | |
119 | |
120 //----------------------------generate_ricochet_blob--------------------------- | |
121 void SharedRuntime::generate_ricochet_blob() { | |
122 if (!EnableInvokeDynamic) return; // leave it as a null | |
123 | |
124 #ifndef TARGET_ARCH_NYI_6939861 | |
125 // allocate space for the code | |
126 ResourceMark rm; | |
127 // setup code generation tools | |
128 CodeBuffer buffer("ricochet_blob", 256 LP64_ONLY(+ 256), 256); // XXX x86 LP64L: 512, 512 | |
129 MacroAssembler* masm = new MacroAssembler(&buffer); | |
130 | |
131 int bounce_offset = -1, exception_offset = -1, frame_size_in_words = -1; | |
132 MethodHandles::RicochetFrame::generate_ricochet_blob(masm, &bounce_offset, &exception_offset, &frame_size_in_words); | |
133 | |
134 // ------------- | |
135 // make sure all code is generated | |
136 masm->flush(); | |
137 | |
138 // failed to generate? | |
139 if (bounce_offset < 0 || exception_offset < 0 || frame_size_in_words < 0) { | |
140 assert(false, "bad ricochet blob"); | |
141 return; | |
142 } | |
143 | |
144 _ricochet_blob = RicochetBlob::create(&buffer, bounce_offset, exception_offset, frame_size_in_words); | |
145 #endif | |
146 } | |
147 | |
148 | |
83 #include <math.h> | 149 #include <math.h> |
84 | 150 |
85 HS_DTRACE_PROBE_DECL4(hotspot, object__alloc, Thread*, char*, int, size_t); | 151 HS_DTRACE_PROBE_DECL4(hotspot, object__alloc, Thread*, char*, int, size_t); |
86 HS_DTRACE_PROBE_DECL7(hotspot, method__entry, int, | 152 HS_DTRACE_PROBE_DECL7(hotspot, method__entry, int, |
87 char*, int, char*, int, char*, int); | 153 char*, int, char*, int, char*, int); |
88 HS_DTRACE_PROBE_DECL7(hotspot, method__return, int, | 154 HS_DTRACE_PROBE_DECL7(hotspot, method__return, int, |
89 char*, int, char*, int, char*, int); | 155 char*, int, char*, int, char*, int); |
90 | |
91 RicochetBlob* SharedRuntime::_ricochet_blob = NULL; | |
92 | 156 |
93 // Implementation of SharedRuntime | 157 // Implementation of SharedRuntime |
94 | 158 |
95 #ifndef PRODUCT | 159 #ifndef PRODUCT |
96 // For statistics | 160 // For statistics |
140 int SharedRuntime::_rethrow_ctr=0; | 204 int SharedRuntime::_rethrow_ctr=0; |
141 | 205 |
142 int SharedRuntime::_ICmiss_index = 0; | 206 int SharedRuntime::_ICmiss_index = 0; |
143 int SharedRuntime::_ICmiss_count[SharedRuntime::maxICmiss_count]; | 207 int SharedRuntime::_ICmiss_count[SharedRuntime::maxICmiss_count]; |
144 address SharedRuntime::_ICmiss_at[SharedRuntime::maxICmiss_count]; | 208 address SharedRuntime::_ICmiss_at[SharedRuntime::maxICmiss_count]; |
209 | |
145 | 210 |
146 void SharedRuntime::trace_ic_miss(address at) { | 211 void SharedRuntime::trace_ic_miss(address at) { |
147 for (int i = 0; i < _ICmiss_index; i++) { | 212 for (int i = 0; i < _ICmiss_index; i++) { |
148 if (_ICmiss_at[i] == at) { | 213 if (_ICmiss_at[i] == at) { |
149 _ICmiss_count[i]++; | 214 _ICmiss_count[i]++; |