本文整理汇总了C++中methodHandle::set_is_prefixed_native方法的典型用法代码示例。如果您正苦于以下问题:C++ methodHandle::set_is_prefixed_native方法的具体用法?C++ methodHandle::set_is_prefixed_native怎么用?C++ methodHandle::set_is_prefixed_native使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类methodHandle
的用法示例。
在下文中一共展示了methodHandle::set_is_prefixed_native方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lookup_entry_prefixed
// Check if there are any JVM TI prefixes which have been applied to the native method name.
// If any are found, remove them before attemping the look up of the
// native implementation again.
// See SetNativeMethodPrefix in the JVM TI Spec for more details.
address NativeLookup::lookup_entry_prefixed(methodHandle method, bool& in_base_library, TRAPS) {
ResourceMark rm(THREAD);
int prefix_count;
char** prefixes = JvmtiExport::get_all_native_method_prefixes(&prefix_count);
char* in_name = method->name()->as_C_string();
char* wrapper_name = in_name;
// last applied prefix will be first -- go backwards
for (int i = prefix_count-1; i >= 0; i--) {
char* prefix = prefixes[i];
size_t prefix_len = strlen(prefix);
if (strncmp(prefix, wrapper_name, prefix_len) == 0) {
// has this prefix remove it
wrapper_name += prefix_len;
}
}
if (wrapper_name != in_name) {
// we have a name for a wrapping method
int wrapper_name_len = (int)strlen(wrapper_name);
TempNewSymbol wrapper_symbol = SymbolTable::probe(wrapper_name, wrapper_name_len);
if (wrapper_symbol != NULL) {
KlassHandle kh(method->method_holder());
methodOop wrapper_method = Klass::cast(kh())->lookup_method(wrapper_symbol,
method->signature());
if (wrapper_method != NULL && !wrapper_method->is_native()) {
// we found a wrapper method, use its native entry
method->set_is_prefixed_native();
return lookup_entry(wrapper_method, in_base_library, THREAD);
}
}
}
return NULL;
}