mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
when looking up native methods, check for both the undecorated and decorated symbol before moving on to the next library
This commit is contained in:
parent
008ac07079
commit
d68c2e6e2c
@ -119,12 +119,17 @@ makeJNIName(Thread* t, char* name, object method, bool decorate)
|
||||
}
|
||||
|
||||
void*
|
||||
resolveNativeMethod(Thread* t, const char* name)
|
||||
resolveNativeMethod(Thread* t, const char* undecorated, const char* decorated)
|
||||
{
|
||||
for (System::Library* lib = t->m->firstLibrary; lib; lib = lib->next()) {
|
||||
void* p = lib->resolve(name);
|
||||
void* p = lib->resolve(undecorated);
|
||||
if (p) {
|
||||
return p;
|
||||
} else {
|
||||
p = lib->resolve(decorated);
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,12 +141,17 @@ resolveNativeMethod(Thread* t, const char* name)
|
||||
namespace vm {
|
||||
|
||||
void*
|
||||
resolveNativeMethod(Thread* t, object method, bool decorate)
|
||||
resolveNativeMethod2(Thread* t, object method)
|
||||
{
|
||||
unsigned size = jniNameLength(t, method, decorate);
|
||||
char name[size + 5]; // extra 5 is for code below
|
||||
makeJNIName(t, name, method, decorate);
|
||||
void* p = ::resolveNativeMethod(t, name);
|
||||
unsigned undecoratedSize = jniNameLength(t, method, false);
|
||||
char undecorated[undecoratedSize + 5]; // extra 5 is for code below
|
||||
makeJNIName(t, undecorated, method, false);
|
||||
|
||||
unsigned decoratedSize = jniNameLength(t, method, true);
|
||||
char decorated[decoratedSize + 5]; // extra 5 is for code below
|
||||
makeJNIName(t, decorated, method, true);
|
||||
|
||||
void* p = ::resolveNativeMethod(t, undecorated, decorated);
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
@ -154,9 +164,13 @@ resolveNativeMethod(Thread* t, object method, bool decorate)
|
||||
++ footprint;
|
||||
}
|
||||
|
||||
snprintf(name + size - 1, 5, "@%d", footprint * BytesPerWord);
|
||||
snprintf(undecorated + undecoratedSize - 1, 5, "@%d",
|
||||
footprint * BytesPerWord);
|
||||
|
||||
p = resolveNativeMethod(t, reinterpret_cast<const int8_t*>(name));
|
||||
snprintf(decorated + decoratedSize - 1, 5, "@%d",
|
||||
footprint * BytesPerWord);
|
||||
|
||||
p = resolveNativeMethod(t, undecorated, decorated);
|
||||
if (p) {
|
||||
return p;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ findMethod(Thread* t, object method, object class_)
|
||||
}
|
||||
|
||||
void*
|
||||
resolveNativeMethod(Thread* t, object method, bool decorate);
|
||||
resolveNativeMethod2(Thread* t, object method);
|
||||
|
||||
inline void*
|
||||
resolveNativeMethod(Thread* t, object method)
|
||||
@ -133,12 +133,7 @@ resolveNativeMethod(Thread* t, object method)
|
||||
if (methodCode(t, method)) {
|
||||
return pointerValue(t, methodCode(t, method));
|
||||
} else {
|
||||
void* p = resolveNativeMethod(t, method, false);
|
||||
if (p) {
|
||||
return p;
|
||||
} else {
|
||||
return resolveNativeMethod(t, method, true);
|
||||
}
|
||||
return resolveNativeMethod2(t, method);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user