mirror of
https://github.com/corda/corda.git
synced 2025-01-23 04:48:09 +00:00
Merge branch 'wip' of oss.readytalk.com:/var/local/git/avian into wip
This commit is contained in:
commit
8c8020811a
@ -33,6 +33,9 @@ public class SystemClassLoader extends ClassLoader {
|
||||
|
||||
private native boolean resourceExists(String name);
|
||||
|
||||
private static native Class resolveClass(ClassLoader loader, byte[] spec)
|
||||
throws ClassNotFoundException;
|
||||
|
||||
protected URL findResource(String name) {
|
||||
if (resourceExists(name)) {
|
||||
try {
|
||||
@ -45,11 +48,18 @@ public class SystemClassLoader extends ClassLoader {
|
||||
private static Class loadClass(ClassLoader loader,
|
||||
byte[] nameBytes, int offset, int length)
|
||||
{
|
||||
String name = new String(nameBytes, offset, length, false);
|
||||
byte[] spec = new byte[length + 1];
|
||||
System.arraycopy(nameBytes, offset, spec, 0, length);
|
||||
|
||||
try {
|
||||
return loader.loadClass(name);
|
||||
Class c = resolveClass(loader, spec);
|
||||
if (c == null) {
|
||||
throw new NoClassDefFoundError();
|
||||
}
|
||||
return c;
|
||||
} catch (ClassNotFoundException e) {
|
||||
NoClassDefFoundError error = new NoClassDefFoundError(name);
|
||||
NoClassDefFoundError error = new NoClassDefFoundError
|
||||
(new String(nameBytes, offset, length, false));
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
}
|
||||
@ -158,7 +168,7 @@ public class SystemClassLoader extends ClassLoader {
|
||||
private static void parseAnnotationTable(ClassLoader loader,
|
||||
Addendum addendum)
|
||||
{
|
||||
if (addendum != null && addendum.annotationTable != null) {
|
||||
if (addendum != null && addendum.annotationTable instanceof byte[]) {
|
||||
try {
|
||||
addendum.annotationTable = parseAnnotationTable
|
||||
(loader, addendum.pool, new ByteArrayInputStream
|
||||
|
@ -231,6 +231,16 @@ Avian_avian_SystemClassLoader_findClass
|
||||
return search(t, name, resolveSystemClass, true);
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
Avian_avian_SystemClassLoader_resolveClass
|
||||
(Thread* t, object, uintptr_t* arguments)
|
||||
{
|
||||
object loader = reinterpret_cast<object>(arguments[0]);
|
||||
object spec = reinterpret_cast<object>(arguments[1]);
|
||||
|
||||
return reinterpret_cast<int64_t>(resolveClass(t, loader, spec));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT int64_t JNICALL
|
||||
Avian_avian_SystemClassLoader_resourceExists
|
||||
(Thread* t, object, uintptr_t* arguments)
|
||||
|
@ -5327,7 +5327,7 @@ resolveTargetSites(Context* c, Event* e, SiteRecordList* frozen, Site** sites)
|
||||
c->arch->generalRegisterMask(), AnyFrameIndex);
|
||||
|
||||
Site* s = pickSourceSite
|
||||
(c, r, 0, 0, &mask, true, true, true, acceptForResolve);
|
||||
(c, r, 0, 0, &mask, false, true, true, acceptForResolve);
|
||||
|
||||
if (s == 0) {
|
||||
s = maybeMove(c, v, mask, false, true, ResolveRegisterReserveCount);
|
||||
|
14
src/gnu.cpp
14
src/gnu.cpp
@ -416,12 +416,16 @@ Avian_java_lang_VMClassLoader_loadClass
|
||||
{
|
||||
uintptr_t args[] = { 0, arguments[0] };
|
||||
|
||||
// object name = reinterpret_cast<object>(arguments[0]);
|
||||
// char n[stringLength(t, name) + 1];
|
||||
// stringChars(t, name, n);
|
||||
// fprintf(stderr, "load bootstrap class %s in %p\n", n, t->m->loader);
|
||||
// object name = reinterpret_cast<object>(arguments[0]);
|
||||
// char n[stringLength(t, name) + 1];
|
||||
// stringChars(t, name, n);
|
||||
// fprintf(stderr, "load bootstrap class %s in %p\n", n, t->m->loader);
|
||||
|
||||
return Avian_avian_SystemClassLoader_findClass(t, 0, args);
|
||||
int64_t result = Avian_avian_SystemClassLoader_findClass(t, 0, args);
|
||||
|
||||
// fprintf(stderr, "result %p\n", reinterpret_cast<void*>(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
|
@ -1910,6 +1910,10 @@ boot(Thread* t)
|
||||
(t, m->types, Machine::SystemClassLoaderType);
|
||||
set(t, m->loader, 0, loaderClass);
|
||||
|
||||
#ifdef AVIAN_GNU
|
||||
classLoaderInitialized(t, m->loader) = true;
|
||||
#endif
|
||||
|
||||
object objectClass = arrayBody(t, m->types, Machine::JobjectType);
|
||||
|
||||
object classClass = arrayBody(t, m->types, Machine::ClassType);
|
||||
@ -3355,13 +3359,13 @@ findInHierarchy(Thread* t, object class_, object name, object spec,
|
||||
}
|
||||
|
||||
if (o == 0) {
|
||||
if (find == findFieldInClass) {
|
||||
o = findInInterfaces(t, originalClass, name, spec, find);
|
||||
}
|
||||
|
||||
for (; o == 0 and class_; class_ = classSuper(t, class_)) {
|
||||
o = find(t, class_, name, spec);
|
||||
}
|
||||
|
||||
if (o == 0 and find == findFieldInClass) {
|
||||
o = findInInterfaces(t, originalClass, name, spec, find);
|
||||
}
|
||||
}
|
||||
|
||||
if (o == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user