Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1x/c1x_CodeInstaller.cpp @ 1938:1aa5b22a7716
Support for custom stack area (needed for deoptimization).
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Mon, 27 Dec 2010 14:22:55 +0100 |
parents | 4853c5cad3aa |
children | 79d04223b8a5 |
comparison
equal
deleted
inserted
replaced
1937:4853c5cad3aa | 1938:1aa5b22a7716 |
---|---|
150 ShouldNotReachHere(); | 150 ShouldNotReachHere(); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 // constructor used to create a method | 154 // constructor used to create a method |
155 CodeInstaller::CodeInstaller(oop target_method) { | 155 CodeInstaller::CodeInstaller(Handle target_method) { |
156 ciMethod *ciMethodObject = NULL; | 156 ciMethod *ciMethodObject = NULL; |
157 { | 157 { |
158 No_Safepoint_Verifier no_safepoint; | 158 No_Safepoint_Verifier no_safepoint; |
159 _env = CURRENT_ENV; | 159 _env = CURRENT_ENV; |
160 | 160 |
173 initialize_buffer(buffer); | 173 initialize_buffer(buffer); |
174 process_exception_handlers(); | 174 process_exception_handlers(); |
175 | 175 |
176 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer | 176 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer |
177 ThreadToNativeFromVM t((JavaThread*) Thread::current()); | 177 ThreadToNativeFromVM t((JavaThread*) Thread::current()); |
178 _env->register_method(ciMethodObject, -1, &_offsets, 0, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, | 178 _env->register_method(ciMethodObject, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, |
179 &_implicit_exception_table, C1XCompiler::instance(), _env->comp_level(), false, false); | 179 &_implicit_exception_table, C1XCompiler::instance(), _env->comp_level(), false, false); |
180 | 180 |
181 } | 181 } |
182 | 182 |
183 // constructor used to create a stub | 183 // constructor used to create a stub |
184 CodeInstaller::CodeInstaller(oop target_method, jlong& id) { | 184 CodeInstaller::CodeInstaller(Handle target_method, jlong& id) { |
185 No_Safepoint_Verifier no_safepoint; | 185 No_Safepoint_Verifier no_safepoint; |
186 _env = CURRENT_ENV; | 186 _env = CURRENT_ENV; |
187 | 187 |
188 initialize_fields(target_method); | 188 initialize_fields(target_method); |
189 assert(_hotspot_method == NULL && _name != NULL, "installMethod needs NON-NULL name and NULL method"); | 189 assert(_hotspot_method == NULL && _name != NULL, "installMethod needs NON-NULL name and NULL method"); |
196 BufferBlob* blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created | 196 BufferBlob* blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created |
197 IF_TRACE_C1X_3 Disassembler::decode((CodeBlob*) blob); | 197 IF_TRACE_C1X_3 Disassembler::decode((CodeBlob*) blob); |
198 id = VmIds::addStub(blob->code_begin()); | 198 id = VmIds::addStub(blob->code_begin()); |
199 } | 199 } |
200 | 200 |
201 void CodeInstaller::initialize_fields(oop target_method) { | 201 void CodeInstaller::initialize_fields(Handle target_method) { |
202 _citarget_method = HotSpotTargetMethod::targetMethod(target_method); | 202 _citarget_method = HotSpotTargetMethod::targetMethod(target_method); |
203 _hotspot_method = HotSpotTargetMethod::method(target_method); | 203 _hotspot_method = HotSpotTargetMethod::method(target_method); |
204 _name = HotSpotTargetMethod::name(target_method); | 204 _name = HotSpotTargetMethod::name(target_method); |
205 _sites = (arrayOop) HotSpotTargetMethod::sites(target_method); | 205 _sites = (arrayOop) HotSpotTargetMethod::sites(target_method); |
206 _exception_handlers = (arrayOop) HotSpotTargetMethod::exceptionHandlers(target_method); | 206 _exception_handlers = (arrayOop) HotSpotTargetMethod::exceptionHandlers(target_method); |
207 | 207 |
208 _code = (arrayOop) CiTargetMethod::targetCode(_citarget_method); | 208 _code = (arrayOop) CiTargetMethod::targetCode(_citarget_method); |
209 _code_size = CiTargetMethod::targetCodeSize(_citarget_method); | 209 _code_size = CiTargetMethod::targetCodeSize(_citarget_method); |
210 _frame_size = CiTargetMethod::frameSize(_citarget_method); | 210 _frame_size = CiTargetMethod::frameSize(_citarget_method); |
211 _custom_stack_area_offset = CiTargetMethod::customStackAreaOffset(_citarget_method); | |
212 | |
211 | 213 |
212 // (very) conservative estimate: each site needs a constant section entry | 214 // (very) conservative estimate: each site needs a constant section entry |
213 _constants_size = _sites->length() * BytesPerLong; | 215 _constants_size = _sites->length() * BytesPerLong; |
214 _total_size = align_size_up(_code_size, HeapWordSize) + _constants_size; | 216 _total_size = align_size_up(_code_size, HeapWordSize) + _constants_size; |
215 | 217 |