Mercurial > hg > truffle
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 3657:47edfca346ab
Fix a safepoint bug in code installer.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 17 Nov 2011 16:40:14 +0100 |
parents | 0e8a2a629afb |
children | b711e226cfaf |
comparison
equal
deleted
inserted
replaced
3655:2a0cb564e470 | 3657:47edfca346ab |
---|---|
248 | 248 |
249 // (very) conservative estimate: each site needs a relocation | 249 // (very) conservative estimate: each site needs a relocation |
250 //CodeBuffer buffer("temp graal method", _total_size, _sites->length() * relocInfo::length_limit); | 250 //CodeBuffer buffer("temp graal method", _total_size, _sites->length() * relocInfo::length_limit); |
251 GraalCompiler::initialize_buffer_blob(); | 251 GraalCompiler::initialize_buffer_blob(); |
252 CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); | 252 CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); |
253 initialize_buffer(buffer); | 253 { |
254 process_exception_handlers(); | 254 No_Safepoint_Verifier no_safepoint; |
255 initialize_buffer(buffer); | |
256 process_exception_handlers(); | |
257 } | |
258 | |
259 | |
260 if (_assumptions != NULL) { | |
261 objArrayHandle assumptions = (objArrayOop)_assumptions; | |
262 for (int i = 0; i < assumptions->length(); ++i) { | |
263 Handle assumption = assumptions->obj_at(i); | |
264 if (!assumption.is_null()) { | |
265 if (assumption->is_a(CiAssumptions_ConcreteSubtype::klass())) { | |
266 assumption_ConcreteSubtype(assumption); | |
267 } else if (assumption->is_a(CiAssumptions_ConcreteMethod::klass())) { | |
268 assumption_ConcreteMethod(assumption); | |
269 } else { | |
270 assumption->print(); | |
271 fatal("unexpected Assumption subclass"); | |
272 } | |
273 } | |
274 } | |
275 } | |
255 | 276 |
256 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer | 277 int stack_slots = (_frame_size / HeapWordSize) + 2; // conversion to words, need to add two slots for ret address and frame pointer |
257 ThreadToNativeFromVM t((JavaThread*) Thread::current()); | 278 ThreadToNativeFromVM t((JavaThread*) Thread::current()); |
258 nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, | 279 nm = GraalEnv::register_method(method, -1, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, |
259 &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, false, install_code); | 280 &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, false, install_code); |
350 site_Mark(buffer, pc_offset, site); | 371 site_Mark(buffer, pc_offset, site); |
351 } else { | 372 } else { |
352 fatal("unexpected Site subclass"); | 373 fatal("unexpected Site subclass"); |
353 } | 374 } |
354 } | 375 } |
355 | 376 } |
356 | 377 |
357 if (_assumptions != NULL) { | 378 void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) { |
358 oop* assumptions = (oop*) _assumptions->base(T_OBJECT); | 379 Handle context_handle = CiAssumptions_ConcreteSubtype::context(assumption); |
359 for (int i = 0; i < _assumptions->length(); ++i) { | 380 Handle type_handle = CiAssumptions_ConcreteSubtype::subtype(assumption); |
360 oop assumption = assumptions[i]; | 381 |
361 if (assumption != NULL) { | 382 ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(context_handle))); |
362 if (assumption->is_a(CiAssumptions_ConcreteSubtype::klass())) { | 383 ciKlass* type = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type_handle))); |
363 assumption_ConcreteSubtype(assumption); | |
364 } else if (assumption->is_a(CiAssumptions_ConcreteMethod::klass())) { | |
365 assumption_ConcreteMethod(assumption); | |
366 } else { | |
367 assumption->print(); | |
368 fatal("unexpected Assumption subclass"); | |
369 } | |
370 } | |
371 } | |
372 } | |
373 } | |
374 | |
375 void CodeInstaller::assumption_ConcreteSubtype(oop assumption) { | |
376 oop context_oop = CiAssumptions_ConcreteSubtype::context(assumption); | |
377 oop type_oop = CiAssumptions_ConcreteSubtype::subtype(assumption); | |
378 | |
379 ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(context_oop))); | |
380 ciKlass* type = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type_oop))); | |
381 | 384 |
382 _dependencies->assert_leaf_type(type); | 385 _dependencies->assert_leaf_type(type); |
383 if (context != type) { | 386 if (context != type) { |
384 assert(context->is_abstract(), ""); | 387 assert(context->is_abstract(), ""); |
385 ThreadToNativeFromVM trans(JavaThread::current()); | 388 ThreadToNativeFromVM trans(JavaThread::current()); |
386 _dependencies->assert_abstract_with_unique_concrete_subtype(context, type); | 389 _dependencies->assert_abstract_with_unique_concrete_subtype(context, type); |
387 } | 390 } |
388 } | 391 } |
389 | 392 |
390 void CodeInstaller::assumption_ConcreteMethod(oop assumption) { | 393 void CodeInstaller::assumption_ConcreteMethod(Handle assumption) { |
391 oop context_oop = CiAssumptions_ConcreteMethod::context(assumption); | 394 Handle context_handle = CiAssumptions_ConcreteMethod::context(assumption); |
392 oop method_oop = CiAssumptions_ConcreteMethod::method(assumption); | 395 Handle method_handle = CiAssumptions_ConcreteMethod::method(assumption); |
393 methodOop method = getMethodFromHotSpotMethod(method_oop); | 396 methodHandle method = getMethodFromHotSpotMethod(method_handle()); |
394 methodOop context = getMethodFromHotSpotMethod(context_oop); | 397 methodHandle context = getMethodFromHotSpotMethod(context_handle()); |
395 | 398 |
396 ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(method); | 399 ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(method()); |
397 ciMethod* c = (ciMethod*) CURRENT_ENV->get_object(context); | 400 ciMethod* c = (ciMethod*) CURRENT_ENV->get_object(context()); |
398 ciKlass* context_klass = c->holder(); | 401 ciKlass* context_klass = c->holder(); |
399 { | 402 { |
400 ThreadToNativeFromVM trans(JavaThread::current()); | 403 ThreadToNativeFromVM trans(JavaThread::current()); |
401 _dependencies->assert_unique_concrete_method(context_klass, m); | 404 _dependencies->assert_unique_concrete_method(context_klass, m); |
402 } | 405 } |