comparison src/share/vm/runtime/vframe.cpp @ 818:b109e761e927

6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14 Summary: Disable escape analysis when jvmti/debugger is used. Add support for EA ibto SA. Reviewed-by: never
author kvn
date Tue, 09 Jun 2009 16:19:10 -0700
parents eacd97c88873
children bd02caa94611
comparison
equal deleted inserted replaced
793:eacd97c88873 818:b109e761e927
104 oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : NULL); 104 oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : NULL);
105 oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : NULL); 105 oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : NULL);
106 106
107 for (int index = (mons->length()-1); index >= 0; index--) { 107 for (int index = (mons->length()-1); index >= 0; index--) {
108 MonitorInfo* monitor = mons->at(index); 108 MonitorInfo* monitor = mons->at(index);
109 if (monitor->eliminated() && is_compiled_frame()) continue; // skip eliminated monitor
109 oop obj = monitor->owner(); 110 oop obj = monitor->owner();
110 if (obj == NULL) continue; // skip unowned monitor 111 if (obj == NULL) continue; // skip unowned monitor
111 // 112 //
112 // Skip the monitor that the thread is blocked to enter or waiting on 113 // Skip the monitor that the thread is blocked to enter or waiting on
113 // 114 //
160 GrowableArray<MonitorInfo*>* mons = monitors(); 161 GrowableArray<MonitorInfo*>* mons = monitors();
161 if (!mons->is_empty()) { 162 if (!mons->is_empty()) {
162 bool found_first_monitor = false; 163 bool found_first_monitor = false;
163 for (int index = (mons->length()-1); index >= 0; index--) { 164 for (int index = (mons->length()-1); index >= 0; index--) {
164 MonitorInfo* monitor = mons->at(index); 165 MonitorInfo* monitor = mons->at(index);
166 if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code
167 if (monitor->owner_is_scalar_replaced()) {
168 Klass* k = Klass::cast(monitor->owner_klass());
169 st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name());
170 } else {
171 oop obj = monitor->owner();
172 if (obj != NULL) {
173 print_locked_object_class_name(st, obj, "eliminated");
174 }
175 }
176 continue;
177 }
165 if (monitor->owner() != NULL) { 178 if (monitor->owner() != NULL) {
166 179
167 // First, assume we have the monitor locked. If we haven't found an 180 // First, assume we have the monitor locked. If we haven't found an
168 // owned monitor before and this is the first frame, then we need to 181 // owned monitor before and this is the first frame, then we need to
169 // see if we have completed the lock or we are blocked trying to 182 // see if we have completed the lock or we are blocked trying to
170 // acquire it - we can only be blocked if the monitor is inflated 183 // acquire it - we can only be blocked if the monitor is inflated
171 184
172 const char *lock_state = "locked"; // assume we have the monitor locked 185 const char *lock_state = "locked"; // assume we have the monitor locked
173 if (!found_first_monitor && frame_count == 0) { 186 if (!found_first_monitor && frame_count == 0) {
174 markOop mark = monitor->owner()->mark(); 187 markOop mark = monitor->owner()->mark();
175 if (mark->has_monitor() && 188 if (mark->has_monitor() &&
176 mark->monitor() == thread()->current_pending_monitor()) { 189 mark->monitor() == thread()->current_pending_monitor()) {
177 lock_state = "waiting to lock"; 190 lock_state = "waiting to lock";
178 } 191 }
179 } 192 }
180 193
181 found_first_monitor = true; 194 found_first_monitor = true;
182 print_locked_object_class_name(st, monitor->owner(), lock_state); 195 print_locked_object_class_name(st, monitor->owner(), lock_state);
183 } 196 }
204 GrowableArray<MonitorInfo*>* interpretedVFrame::monitors() const { 217 GrowableArray<MonitorInfo*>* interpretedVFrame::monitors() const {
205 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(5); 218 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(5);
206 for (BasicObjectLock* current = (fr().previous_monitor_in_interpreter_frame(fr().interpreter_frame_monitor_begin())); 219 for (BasicObjectLock* current = (fr().previous_monitor_in_interpreter_frame(fr().interpreter_frame_monitor_begin()));
207 current >= fr().interpreter_frame_monitor_end(); 220 current >= fr().interpreter_frame_monitor_end();
208 current = fr().previous_monitor_in_interpreter_frame(current)) { 221 current = fr().previous_monitor_in_interpreter_frame(current)) {
209 result->push(new MonitorInfo(current->obj(), current->lock(), false)); 222 result->push(new MonitorInfo(current->obj(), current->lock(), false, false));
210 } 223 }
211 return result; 224 return result;
212 } 225 }
213 226
214 int interpretedVFrame::bci() const { 227 int interpretedVFrame::bci() const {
529 GrowableArray<MonitorInfo*>* list = monitors(); 542 GrowableArray<MonitorInfo*>* list = monitors();
530 if (list->is_empty()) return; 543 if (list->is_empty()) return;
531 tty->print_cr("\tmonitor list:"); 544 tty->print_cr("\tmonitor list:");
532 for (int index = (list->length()-1); index >= 0; index--) { 545 for (int index = (list->length()-1); index >= 0; index--) {
533 MonitorInfo* monitor = list->at(index); 546 MonitorInfo* monitor = list->at(index);
534 tty->print("\t obj\t"); monitor->owner()->print_value(); 547 tty->print("\t obj\t");
535 tty->print("(" INTPTR_FORMAT ")", (address)monitor->owner()); 548 if (monitor->owner_is_scalar_replaced()) {
549 Klass* k = Klass::cast(monitor->owner_klass());
550 tty->print("( is scalar replaced %s)", k->external_name());
551 } else if (monitor->owner() == NULL) {
552 tty->print("( null )");
553 } else {
554 monitor->owner()->print_value();
555 tty->print("(" INTPTR_FORMAT ")", (address)monitor->owner());
556 }
557 if (monitor->eliminated() && is_compiled_frame())
558 tty->print(" ( lock is eliminated )");
536 tty->cr(); 559 tty->cr();
537 tty->print("\t "); 560 tty->print("\t ");
538 monitor->lock()->print_on(tty); 561 monitor->lock()->print_on(tty);
539 tty->cr(); 562 tty->cr();
540 } 563 }