comparison src/share/vm/graal/graalCodeInstaller.cpp @ 3659:b711e226cfaf

Fixed another possible oop/handle issue.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 17 Nov 2011 17:10:52 +0100
parents 47edfca346ab
children c805dfba251d
comparison
equal deleted inserted replaced
3658:ac1f800e73af 3659:b711e226cfaf
231 } 231 }
232 232
233 // constructor used to create a method 233 // constructor used to create a method
234 CodeInstaller::CodeInstaller(Handle target_method, nmethod*& nm, bool install_code) { 234 CodeInstaller::CodeInstaller(Handle target_method, nmethod*& nm, bool install_code) {
235 _env = CURRENT_ENV; 235 _env = CURRENT_ENV;
236 methodOop method = NULL;
237 { 236 {
238 method = getMethodFromHotSpotMethod(HotSpotTargetMethod::method(target_method));
239 _parameter_count = method->size_of_parameters();
240
241 No_Safepoint_Verifier no_safepoint; 237 No_Safepoint_Verifier no_safepoint;
242
243 initialize_fields(target_method); 238 initialize_fields(target_method);
244 assert(_hotspot_method != NULL && _name == NULL, "installMethod needs NON-NULL method and NULL name");
245 assert(_hotspot_method->is_a(HotSpotMethodResolved::klass()), "installMethod needs a HotSpotMethodResolved");
246
247 } 239 }
248 240
249 // (very) conservative estimate: each site needs a relocation 241 // (very) conservative estimate: each site needs a relocation
250 //CodeBuffer buffer("temp graal method", _total_size, _sites->length() * relocInfo::length_limit); 242 //CodeBuffer buffer("temp graal method", _total_size, _sites->length() * relocInfo::length_limit);
251 GraalCompiler::initialize_buffer_blob(); 243 GraalCompiler::initialize_buffer_blob();
254 No_Safepoint_Verifier no_safepoint; 246 No_Safepoint_Verifier no_safepoint;
255 initialize_buffer(buffer); 247 initialize_buffer(buffer);
256 process_exception_handlers(); 248 process_exception_handlers();
257 } 249 }
258 250
259
260 if (_assumptions != NULL) { 251 if (_assumptions != NULL) {
261 objArrayHandle assumptions = (objArrayOop)_assumptions; 252 objArrayHandle assumptions = (objArrayOop)_assumptions;
262 for (int i = 0; i < assumptions->length(); ++i) { 253 for (int i = 0; i < assumptions->length(); ++i) {
263 Handle assumption = assumptions->obj_at(i); 254 Handle assumption = assumptions->obj_at(i);
264 if (!assumption.is_null()) { 255 if (!assumption.is_null()) {
274 } 265 }
275 } 266 }
276 267
277 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer 268 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer
278 ThreadToNativeFromVM t((JavaThread*) Thread::current()); 269 ThreadToNativeFromVM t((JavaThread*) Thread::current());
270 methodHandle method = getMethodFromHotSpotMethod(HotSpotTargetMethod::method(target_method));
279 nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, 271 nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
280 &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, false, install_code); 272 &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, false, install_code);
281 method->clear_queued_for_compilation(); 273 method->clear_queued_for_compilation();
282 } 274 }
283 275
301 } 293 }
302 294
303 void CodeInstaller::initialize_fields(Handle target_method) { 295 void CodeInstaller::initialize_fields(Handle target_method) {
304 _citarget_method = HotSpotTargetMethod::targetMethod(target_method); 296 _citarget_method = HotSpotTargetMethod::targetMethod(target_method);
305 _hotspot_method = HotSpotTargetMethod::method(target_method); 297 _hotspot_method = HotSpotTargetMethod::method(target_method);
298 _parameter_count = getMethodFromHotSpotMethod(_hotspot_method)->size_of_parameters();
306 _name = HotSpotTargetMethod::name(target_method); 299 _name = HotSpotTargetMethod::name(target_method);
307 _sites = (arrayOop) HotSpotTargetMethod::sites(target_method); 300 _sites = (arrayOop) HotSpotTargetMethod::sites(target_method);
308 oop assumptions = CiTargetMethod::assumptions(_citarget_method); 301 oop assumptions = CiTargetMethod::assumptions(_citarget_method);
309 if (assumptions != NULL) { 302 if (assumptions != NULL) {
310 _assumptions = (arrayOop) CiAssumptions::list(assumptions); 303 _assumptions = (arrayOop) CiAssumptions::list(assumptions);