本文整理汇总了C++中MonitorInfo::eliminated方法的典型用法代码示例。如果您正苦于以下问题:C++ MonitorInfo::eliminated方法的具体用法?C++ MonitorInfo::eliminated怎么用?C++ MonitorInfo::eliminated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonitorInfo
的用法示例。
在下文中一共展示了MonitorInfo::eliminated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print
void javaVFrame::print() {
ResourceMark rm;
vframe::print();
tty->print("\t");
method()->print_value();
tty->cr();
tty->print_cr("\tbci: %d", bci());
print_stack_values("locals", locals());
print_stack_values("expressions", expressions());
GrowableArray<MonitorInfo*>* list = monitors();
if (list->is_empty()) return;
tty->print_cr("\tmonitor list:");
for (int index = (list->length()-1); index >= 0; index--) {
MonitorInfo* monitor = list->at(index);
tty->print("\t obj\t");
if (monitor->owner_is_scalar_replaced()) {
Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());
tty->print("( is scalar replaced %s)", k->external_name());
} else if (monitor->owner() == NULL) {
tty->print("( null )");
} else {
monitor->owner()->print_value();
tty->print("(" INTPTR_FORMAT ")", (address)monitor->owner());
}
if (monitor->eliminated() && is_compiled_frame())
tty->print(" ( lock is eliminated )");
tty->cr();
tty->print("\t ");
monitor->lock()->print_on(tty);
tty->cr();
}
}
示例2: assert
GrowableArray<MonitorInfo*>* javaVFrame::locked_monitors() {
assert(SafepointSynchronize::is_at_safepoint() || JavaThread::current() == thread(),
"must be at safepoint or it's a java frame of the current thread");
GrowableArray<MonitorInfo*>* mons = monitors();
GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(mons->length());
if (mons->is_empty()) return result;
bool found_first_monitor = false;
ObjectMonitor *pending_monitor = thread()->current_pending_monitor();
ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor();
oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : (oop) NULL);
oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : (oop) NULL);
for (int index = (mons->length()-1); index >= 0; index--) {
MonitorInfo* monitor = mons->at(index);
if (monitor->eliminated() && is_compiled_frame()) continue; // skip eliminated monitor
oop obj = monitor->owner();
if (obj == NULL) continue; // skip unowned monitor
//
// Skip the monitor that the thread is blocked to enter or waiting on
//
if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) {
continue;
}
found_first_monitor = true;
result->append(monitor);
}
return result;
}
示例3: print_lock_info_on
void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) {
ResourceMark rm;
// If this is the first frame, and java.lang.Object.wait(...) then print out the receiver.
if (frame_count == 0) {
if (method()->name() == vmSymbols::wait_name() &&
method()->method_holder()->name() == vmSymbols::java_lang_Object()) {
StackValueCollection* locs = locals();
if (!locs->is_empty()) {
StackValue* sv = locs->at(0);
if (sv->type() == T_OBJECT) {
Handle o = locs->at(0)->get_obj();
print_locked_object_class_name(st, o, "waiting on");
}
}
} else if (thread()->current_park_blocker() != NULL) {
oop obj = thread()->current_park_blocker();
Klass* k = obj->klass();
st->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", "parking to wait for ", (address)obj, k->external_name());
}
}
// Print out all monitors that we have locked or are trying to lock
GrowableArray<MonitorInfo*>* mons = monitors();
if (!mons->is_empty()) {
bool found_first_monitor = false;
for (int index = (mons->length()-1); index >= 0; index--) {
MonitorInfo* monitor = mons->at(index);
if (monitor->eliminated() && is_compiled_frame()) { // Eliminated in compiled code
if (monitor->owner_is_scalar_replaced()) {
Klass* k = java_lang_Class::as_Klass(monitor->owner_klass());
st->print("\t- eliminated <owner is scalar replaced> (a %s)", k->external_name());
} else {
oop obj = monitor->owner();
if (obj != NULL) {
print_locked_object_class_name(st, obj, "eliminated");
}
}
continue;
}
if (monitor->owner() != NULL) {
// First, assume we have the monitor locked. If we haven't found an
// owned monitor before and this is the first frame, then we need to
// see if we have completed the lock or we are blocked trying to
// acquire it - we can only be blocked if the monitor is inflated
const char *lock_state = "locked"; // assume we have the monitor locked
if (!found_first_monitor && frame_count == 0) {
markOop mark = monitor->owner()->mark();
if (mark->has_monitor() &&
mark->monitor() == thread()->current_pending_monitor()) {
lock_state = "waiting to lock";
}
}
found_first_monitor = true;
print_locked_object_class_name(st, monitor->owner(), lock_state);
}
}
}
}