Allow avian.bootstrap to accept multiple libraries

This commit is contained in:
Alexey Pelykh 2013-01-31 14:54:23 +02:00
parent 9b9bc1de00
commit e523547b19
3 changed files with 32 additions and 11 deletions

View File

@ -3709,16 +3709,6 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable)
} // namespace vm
#define BOOTSTRAP_PROPERTY "avian.bootstrap"
#define CRASHDIR_PROPERTY "avian.crash.dir"
#define EMBED_PREFIX_PROPERTY "avian.embed.prefix"
#define CLASSPATH_PROPERTY "java.class.path"
#define JAVA_HOME_PROPERTY "java.home"
#define BOOTCLASSPATH_PREPEND_OPTION "bootclasspath/p"
#define BOOTCLASSPATH_OPTION "bootclasspath"
#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a"
#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a"
extern "C" JNIEXPORT jint JNICALL
JNI_GetDefaultJavaVMInitArgs(void*)
{

View File

@ -13,6 +13,16 @@
#include "machine.h"
#define BOOTSTRAP_PROPERTY "avian.bootstrap"
#define CRASHDIR_PROPERTY "avian.crash.dir"
#define EMBED_PREFIX_PROPERTY "avian.embed.prefix"
#define CLASSPATH_PROPERTY "java.class.path"
#define JAVA_HOME_PROPERTY "java.home"
#define BOOTCLASSPATH_PREPEND_OPTION "bootclasspath/p"
#define BOOTCLASSPATH_OPTION "bootclasspath"
#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a"
#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a"
namespace vm {
void

View File

@ -3008,6 +3008,13 @@ Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
populateJNITables(&javaVMVTable, &jniEnvVTable);
const char* bootstrapProperty = strdup(findProperty(this, BOOTSTRAP_PROPERTY));
const char* bootstrapPropertyEnd = bootstrapProperty + (bootstrapProperty ? strlen(bootstrapProperty) : 0);
char* codeLibraryName = (char*)bootstrapProperty;
char* codeLibraryNameEnd = 0;
if (codeLibraryName && (codeLibraryNameEnd = strchr(codeLibraryName, system->pathSeparator())))
*codeLibraryNameEnd = 0;
if (not system->success(system->make(&localThread)) or
not system->success(system->make(&stateLock)) or
not system->success(system->make(&heapLock)) or
@ -3015,10 +3022,24 @@ Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
not system->success(system->make(&referenceLock)) or
not system->success(system->make(&shutdownLock)) or
not system->success
(system->load(&libraries, findProperty(this, "avian.bootstrap"))))
(system->load(&libraries, bootstrapProperty)))
{
system->abort();
}
System::Library* additionalLibrary = 0;
while (codeLibraryNameEnd && codeLibraryNameEnd + 1 < bootstrapPropertyEnd) {
codeLibraryName = codeLibraryNameEnd + 1;
codeLibraryNameEnd = strchr(codeLibraryName, system->pathSeparator());
if (codeLibraryNameEnd)
*codeLibraryNameEnd = 0;
if (!system->success(system->load(&additionalLibrary, codeLibraryName)))
system->abort();
libraries->setNext(additionalLibrary);
}
free((void*)bootstrapProperty);
}
void