remove Machine::lastLibrary and rename firstLibrary to libraries

This commit is contained in:
Joel Dice 2008-01-29 08:19:15 -07:00
parent 7a262d0578
commit d693393293
4 changed files with 10 additions and 12 deletions

View File

@ -527,7 +527,8 @@ Java_java_lang_Runtime_load(Thread* t, jclass, jstring name, jboolean mapName)
}
}
for (System::Library* lib = t->m->firstLibrary; lib; lib = lib->next()) {
System::Library* last;
for (System::Library* lib = t->m->libraries; lib; lib = lib->next()) {
if (lib->name()
and strcmp(lib->name(), n) == 0
and lib->mapName() == mapName)
@ -535,12 +536,12 @@ Java_java_lang_Runtime_load(Thread* t, jclass, jstring name, jboolean mapName)
// already loaded
return;
}
last = lib;
}
System::Library* lib;
if (LIKELY(t->m->system->success(t->m->system->load(&lib, n, mapName)))) {
t->m->lastLibrary->setNext(lib);
t->m->lastLibrary = lib;
last->setNext(lib);
} else {
object message = makeString(t, "library not found: %s", n);
t->exception = makeUnsatisfiedLinkError(t, message);

View File

@ -1652,7 +1652,7 @@ Machine::Machine(System* system, Heap* heap, Finder* finder,
heapLock(0),
classLock(0),
referenceLock(0),
firstLibrary(0),
libraries(0),
loader(0),
bootstrapClassMap(0),
monitorMap(0),
@ -1676,12 +1676,10 @@ Machine::Machine(System* system, Heap* heap, Finder* finder,
not system->success(system->make(&heapLock)) or
not system->success(system->make(&classLock)) or
not system->success(system->make(&referenceLock)) or
not system->success(system->load(&firstLibrary, 0, false)))
not system->success(system->load(&libraries, 0, false)))
{
system->abort();
}
lastLibrary = firstLibrary;
}
void
@ -1693,8 +1691,8 @@ Machine::dispose()
classLock->dispose();
referenceLock->dispose();
if (firstLibrary) {
firstLibrary->disposeAll();
if (libraries) {
libraries->disposeAll();
}
for (Reference* r = jniReferences; r;) {

View File

@ -1141,8 +1141,7 @@ class Machine {
System::Monitor* heapLock;
System::Monitor* classLock;
System::Monitor* referenceLock;
System::Library* firstLibrary;
System::Library* lastLibrary;
System::Library* libraries;
object loader;
object bootstrapClassMap;
object monitorMap;

View File

@ -121,7 +121,7 @@ makeJNIName(Thread* t, char* name, object method, bool decorate)
void*
resolveNativeMethod(Thread* t, const char* undecorated, const char* decorated)
{
for (System::Library* lib = t->m->firstLibrary; lib; lib = lib->next()) {
for (System::Library* lib = t->m->libraries; lib; lib = lib->next()) {
void* p = lib->resolve(undecorated);
if (p) {
return p;