本文整理汇总了C++中Klass::signature_name方法的典型用法代码示例。如果您正苦于以下问题:C++ Klass::signature_name方法的具体用法?C++ Klass::signature_name怎么用?C++ Klass::signature_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Klass
的用法示例。
在下文中一共展示了Klass::signature_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oop_at
oop AOTCompiledMethod::oop_at(int index) const {
if (index == 0) { // 0 is reserved
return NULL;
}
Metadata** entry = _metadata_got + (index - 1);
intptr_t meta = (intptr_t)*entry;
if ((meta & 1) == 1) {
// already resolved
Klass* k = (Klass*)(meta & ~1);
return k->java_mirror();
}
// The entry is string which we need to resolve.
const char* meta_name = _heap->get_name_at((int)meta);
int klass_len = build_u2_from((address)meta_name);
const char* klass_name = meta_name + 2;
// Quick check the current method's holder.
Klass* k = _method->method_holder();
ResourceMark rm; // for signature_name()
if (strncmp(k->signature_name(), klass_name, klass_len) != 0) { // Does not match?
// Search klass in got cells in DSO which have this compiled method.
k = _heap->get_klass_from_got(klass_name, klass_len, _method);
}
int method_name_len = build_u2_from((address)klass_name + klass_len);
guarantee(method_name_len == 0, "only klass is expected here");
meta = ((intptr_t)k) | 1;
*entry = (Metadata*)meta; // Should be atomic on x64
return k->java_mirror();
}
示例2: metadata_at
Metadata* AOTCompiledMethod::metadata_at(int index) const {
if (index == 0) { // 0 is reserved
return NULL;
}
assert(index - 1 < _metadata_size, "");
{
Metadata** entry = _metadata_got + (index - 1);
intptr_t meta = (intptr_t)*entry;
if ((meta & 1) == 1) {
// already resolved
Metadata *m = (Metadata*)(meta & ~1);
return m;
}
// The entry is string which we need to resolve.
const char* meta_name = _heap->get_name_at((int)meta);
int klass_len = build_u2_from((address)meta_name);
const char* klass_name = meta_name + 2;
// Quick check the current method's holder.
Klass* k = _method->method_holder();
bool klass_matched = true;
ResourceMark rm; // for signature_name() and find_method()
if (strncmp(k->signature_name(), klass_name, klass_len) != 0) { // Does not match?
// Search klass in got cells in DSO which have this compiled method.
k = _heap->get_klass_from_got(klass_name, klass_len, _method);
klass_matched = false;
}
int method_name_len = build_u2_from((address)klass_name + klass_len);
if (method_name_len == 0) { // Array or Klass name only?
meta = ((intptr_t)k) | 1;
*entry = (Metadata*)meta; // Should be atomic on x64
return (Metadata*)k;
} else { // Method
// Quick check the current method's name.
Method* m = _method;
int signature_len = build_u2_from((address)klass_name + klass_len + 2 + method_name_len);
int full_len = 2 + klass_len + 2 + method_name_len + 2 + signature_len;
if (!klass_matched || memcmp(_name, meta_name, full_len) != 0) { // Does not match?
Thread* thread = Thread::current();
KlassHandle klass = KlassHandle(thread, k);
const char* method_name = klass_name + klass_len;
m = AOTCodeHeap::find_method(klass, thread, method_name);
}
meta = ((intptr_t)m) | 1;
*entry = (Metadata*)meta; // Should be atomic on x64
return (Metadata*)m;
}
}
ShouldNotReachHere(); return NULL;
}