本文整理汇总了C++中Method::is_synchronized方法的典型用法代码示例。如果您正苦于以下问题:C++ Method::is_synchronized方法的具体用法?C++ Method::is_synchronized怎么用?C++ Method::is_synchronized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method::is_synchronized方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TRACE
/*
* Get Method Modifiers
*
* For the method indicated by method, return the access flags
* via modifiers_ptr.
*
* REQUIRED Functionality.
*/
jvmtiError JNICALL
jvmtiGetMethodModifiers(jvmtiEnv* env,
jmethodID method,
jint* modifiers_ptr)
{
TRACE("GetMethodModifiers called");
SuspendEnabledChecker sec;
/*
* Check given env & current phase.
*/
jvmtiPhase phases[] = {JVMTI_PHASE_START, JVMTI_PHASE_LIVE};
CHECK_EVERYTHING();
if( !method ) return JVMTI_ERROR_NULL_POINTER;
if( !modifiers_ptr ) return JVMTI_ERROR_NULL_POINTER;
*modifiers_ptr = 0;
Method* mtd = reinterpret_cast<Method*>(method);
if( mtd->is_public() ) *modifiers_ptr |= ACC_PUBLIC;
if( mtd->is_private() ) *modifiers_ptr |= ACC_PRIVATE;
if( mtd->is_protected() ) *modifiers_ptr |= ACC_PROTECTED;
if( mtd->is_static() ) *modifiers_ptr |= ACC_STATIC;
if( mtd->is_final() ) *modifiers_ptr |= ACC_FINAL;
if( mtd->is_synchronized() ) *modifiers_ptr |= ACC_SYNCHRONIZED;
if( mtd->is_native() ) *modifiers_ptr |= ACC_NATIVE;
if( mtd->is_abstract() ) *modifiers_ptr |= ACC_ABSTRACT;
return JVMTI_ERROR_NONE;
}
示例2: k
GrowableArray<MonitorInfo*>* compiledVFrame::monitors() const {
// Natives has no scope
if (scope() == NULL) {
nmethod* nm = code();
Method* method = nm->method();
assert(method->is_native(), "");
if (!method->is_synchronized()) {
return new GrowableArray<MonitorInfo*>(0);
}
// This monitor is really only needed for UseBiasedLocking, but
// return it in all cases for now as it might be useful for stack
// traces and tools as well
GrowableArray<MonitorInfo*> *monitors = new GrowableArray<MonitorInfo*>(1);
// Casting away const
frame& fr = (frame&) _fr;
MonitorInfo* info = new MonitorInfo(
fr.get_native_receiver(), fr.get_native_monitor(), false, false);
monitors->push(info);
return monitors;
}
GrowableArray<MonitorValue*>* monitors = scope()->monitors();
if (monitors == NULL) {
return new GrowableArray<MonitorInfo*>(0);
}
GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(monitors->length());
for (int index = 0; index < monitors->length(); index++) {
MonitorValue* mv = monitors->at(index);
ScopeValue* ov = mv->owner();
StackValue *owner_sv = create_stack_value(ov); // it is an oop
if (ov->is_object() && owner_sv->obj_is_scalar_replaced()) { // The owner object was scalar replaced
assert(mv->eliminated(), "monitor should be eliminated for scalar replaced object");
// Put klass for scalar replaced object.
ScopeValue* kv = ((ObjectValue *)ov)->klass();
assert(kv->is_constant_oop(), "klass should be oop constant for scalar replaced object");
Handle k(((ConstantOopReadValue*)kv)->value()());
assert(java_lang_Class::is_instance(k()), "must be");
result->push(new MonitorInfo(k(), resolve_monitor_lock(mv->basic_lock()),
mv->eliminated(), true));
} else {
result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()),
mv->eliminated(), false));
}
}
return result;
}