Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 3714:b648304ba4ff
Change Graal monitor enter and exit from BasicObjectLock to BasicLock
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 13 Dec 2011 21:17:46 -0800 |
parents | 4e037604f6ee |
children | 4177ddd2d1d1 |
comparison
equal
deleted
inserted
replaced
3713:d6a0c46a73b2 | 3714:b648304ba4ff |
---|---|
219 } | 219 } |
220 ShouldNotReachHere(); | 220 ShouldNotReachHere(); |
221 return NULL; | 221 return NULL; |
222 } | 222 } |
223 | 223 |
224 static MonitorValue* get_monitor_value(oop value, int frame_size, GrowableArray<ScopeValue*>* objects) { | |
225 guarantee(value->is_a(CiMonitorValue::klass()), "Monitors must be of type CiMonitorValue"); | |
226 | |
227 ScopeValue* second = NULL; | |
228 ScopeValue* owner_value = get_hotspot_value(CiMonitorValue::owner(value), frame_size, objects, second); | |
229 assert(second == NULL, "monitor cannot occupy two stack slots"); | |
230 | |
231 ScopeValue* lock_data_value = get_hotspot_value(CiMonitorValue::lockData(value), frame_size, objects, second); | |
232 assert(second == NULL, "monitor cannot occupy two stack slots"); | |
233 assert(lock_data_value->is_location(), "invalid monitor location"); | |
234 Location lock_data_loc = ((LocationValue*)lock_data_value)->location(); | |
235 | |
236 bool eliminated = CiMonitorValue::eliminated(value); | |
237 | |
238 return new MonitorValue(owner_value, lock_data_loc, eliminated); | |
239 } | |
240 | |
224 void CodeInstaller::initialize_assumptions(oop target_method) { | 241 void CodeInstaller::initialize_assumptions(oop target_method) { |
225 _oop_recorder = new OopRecorder(_env->arena()); | 242 _oop_recorder = new OopRecorder(_env->arena()); |
226 _env->set_oop_recorder(_oop_recorder); | 243 _env->set_oop_recorder(_oop_recorder); |
227 _env->set_dependencies(_dependencies); | 244 _env->set_dependencies(_dependencies); |
228 _dependencies = new Dependencies(_env); | 245 _dependencies = new Dependencies(_env); |
486 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); | 503 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); |
487 } | 504 } |
488 | 505 |
489 for (jint i = 0; i < values->length(); i++) { | 506 for (jint i = 0; i < values->length(); i++) { |
490 ScopeValue* second = NULL; | 507 ScopeValue* second = NULL; |
491 ScopeValue* value = get_hotspot_value(((oop*) values->base(T_OBJECT))[i], _frame_size, objects, second); | 508 oop value = ((oop*) values->base(T_OBJECT))[i]; |
492 | 509 |
493 if (i < local_count) { | 510 if (i < local_count) { |
511 ScopeValue* first = get_hotspot_value(value, _frame_size, objects, second); | |
494 if (second != NULL) { | 512 if (second != NULL) { |
495 locals->append(second); | 513 locals->append(second); |
496 } | 514 } |
497 locals->append(value); | 515 locals->append(first); |
498 } else if (i < local_count + expression_count) { | 516 } else if (i < local_count + expression_count) { |
517 ScopeValue* first = get_hotspot_value(value, _frame_size, objects, second); | |
499 if (second != NULL) { | 518 if (second != NULL) { |
500 expressions->append(value); | 519 expressions->append(second); |
501 } | 520 } |
502 expressions->append(value); | 521 expressions->append(first); |
503 } else { | 522 } else { |
504 assert(second == NULL, "monitor cannot occupy two stack slots"); | 523 monitors->append(get_monitor_value(value, _frame_size, objects)); |
505 assert(value->is_location(), "invalid monitor location"); | |
506 LocationValue* loc = (LocationValue*)value; | |
507 int monitor_offset = loc->location().stack_offset(); | |
508 LocationValue* obj = new LocationValue(Location::new_stk_loc(Location::oop, monitor_offset + BasicObjectLock::obj_offset_in_bytes())); | |
509 bool eliminated = value->is_object(); | |
510 monitors->append(new MonitorValue(obj, Location::new_stk_loc(Location::normal, monitor_offset + BasicObjectLock::lock_offset_in_bytes()), eliminated)); | |
511 } | 524 } |
512 if (second != NULL) { | 525 if (second != NULL) { |
513 i++; | 526 i++; |
514 assert(i < values->length(), "double-slot value not followed by CiValue.IllegalValue"); | 527 assert(i < values->length(), "double-slot value not followed by CiValue.IllegalValue"); |
515 assert(((oop*) values->base(T_OBJECT))[i] == CiValue::IllegalValue(), "double-slot value not followed by CiValue.IllegalValue"); | 528 assert(((oop*) values->base(T_OBJECT))[i] == CiValue::IllegalValue(), "double-slot value not followed by CiValue.IllegalValue"); |