mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
fix bootimage build
This commit is contained in:
parent
84ac2e417d
commit
6519047342
@ -52,7 +52,7 @@ makeCodeImage(Thread* t, Zone* zone, BootImage* image, uint8_t* code,
|
||||
and (className == 0 or strncmp(name, className, nameSize - 6) == 0))
|
||||
{
|
||||
// fprintf(stderr, "%.*s\n", nameSize - 6, name);
|
||||
object c = resolveClass
|
||||
object c = resolveSystemClass
|
||||
(t, makeByteArray(t, "%.*s", nameSize - 6, name));
|
||||
|
||||
if (t->exception) return 0;
|
||||
@ -399,7 +399,7 @@ main(int ac, const char** av)
|
||||
enter(t, Thread::ActiveState);
|
||||
enter(t, Thread::IdleState);
|
||||
|
||||
FILE* output = fopen(av[2], "wb");
|
||||
FILE* output = vm::fopen(av[2], "wb");
|
||||
if (output == 0) {
|
||||
fprintf(stderr, "unable to open %s\n", av[2]);
|
||||
return -1;
|
||||
|
@ -186,13 +186,13 @@ Avian_java_lang_ClassLoader_defineClass
|
||||
t->m->heap->free(buffer, length);
|
||||
|
||||
if (c) {
|
||||
if (classLoaderMap(t, loader) == 0) {
|
||||
if (getClassLoaderMap(t, loader) == 0) {
|
||||
PROTECT(t, c);
|
||||
object map = makeHashMap(t, 0, 0);
|
||||
set(t, loader, ClassLoaderMap, map);
|
||||
}
|
||||
|
||||
hashMapInsert(t, classLoaderMap(t, loader), className(t, c), c,
|
||||
hashMapInsert(t, getClassLoaderMap(t, loader), className(t, c), c,
|
||||
byteArrayHash);
|
||||
}
|
||||
|
||||
|
@ -7131,7 +7131,7 @@ fixupCode(Thread* t, uintptr_t* map, unsigned size, uint8_t* code,
|
||||
void
|
||||
fixupMethods(Thread* t, BootImage* image, uint8_t* code)
|
||||
{
|
||||
for (HashMapIterator it(t, classLoaderMap(t, t->m->loader)); it.hasMore();) {
|
||||
for (HashMapIterator it(t, t->m->classMap); it.hasMore();) {
|
||||
object c = tripleSecond(t, it.next());
|
||||
|
||||
if (classMethodTable(t, c)) {
|
||||
@ -7261,8 +7261,7 @@ boot(MyThread* t, BootImage* image)
|
||||
|
||||
syncInstructionCache(code, image->codeSize);
|
||||
|
||||
object classMap = makeClassMap(t, classTable, image->classCount, heap);
|
||||
set(t, t->m->loader, ClassLoaderMap, classMap);
|
||||
t->m->classMap = makeClassMap(t, classTable, image->classCount, heap);
|
||||
|
||||
t->m->stringMap = makeStringMap(t, stringTable, image->stringCount, heap);
|
||||
|
||||
|
@ -437,7 +437,7 @@ Avian_java_lang_VMClassLoader_findLoadedClass
|
||||
{
|
||||
object loader = reinterpret_cast<object>(arguments[0]);
|
||||
|
||||
object map = classLoaderMap(t, loader);
|
||||
object map = getClassLoaderMap(t, loader);
|
||||
if (map) {
|
||||
PROTECT(t, loader);
|
||||
|
||||
@ -452,7 +452,7 @@ Avian_java_lang_VMClassLoader_findLoadedClass
|
||||
|
||||
return reinterpret_cast<int64_t>
|
||||
(hashMapFind
|
||||
(t, classLoaderMap(t, loader), n, byteArrayHash, byteArrayEqual));
|
||||
(t, getClassLoaderMap(t, loader), n, byteArrayHash, byteArrayEqual));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1934,8 +1934,7 @@ boot(Thread* t)
|
||||
classVmFlags(t, arrayBody(t, m->types, Machine::JvoidType))
|
||||
|= PrimitiveFlag;
|
||||
|
||||
object classMap = makeHashMap(t, 0, 0);
|
||||
set(t, t->m->loader, ClassLoaderMap, classMap);
|
||||
m->classMap = makeHashMap(t, 0, 0);
|
||||
|
||||
m->bootstrapClassMap = makeHashMap(t, 0, 0);
|
||||
|
||||
@ -2070,6 +2069,7 @@ Machine::Machine(System* system, Heap* heap, Finder* finder,
|
||||
shutdownLock(0),
|
||||
libraries(0),
|
||||
loader(0),
|
||||
classMap(0),
|
||||
loadClassMethod(0),
|
||||
bootstrapClassMap(0),
|
||||
monitorMap(0),
|
||||
@ -2782,8 +2782,7 @@ findLoadedSystemClass(Thread* t, object spec)
|
||||
PROTECT(t, spec);
|
||||
ACQUIRE(t, t->m->classLock);
|
||||
|
||||
return hashMapFind(t, classLoaderMap(t, t->m->loader), spec, byteArrayHash,
|
||||
byteArrayEqual);
|
||||
return hashMapFind(t, t->m->classMap, spec, byteArrayHash, byteArrayEqual);
|
||||
}
|
||||
|
||||
object
|
||||
@ -2900,7 +2899,7 @@ resolveSystemClass(Thread* t, object spec)
|
||||
ACQUIRE(t, t->m->classLock);
|
||||
|
||||
object class_ = hashMapFind
|
||||
(t, classLoaderMap(t, t->m->loader), spec, byteArrayHash, byteArrayEqual);
|
||||
(t, t->m->classMap, spec, byteArrayHash, byteArrayEqual);
|
||||
|
||||
if (class_ == 0) {
|
||||
if (byteArrayBody(t, spec, 0) == '[') {
|
||||
@ -2950,8 +2949,7 @@ resolveSystemClass(Thread* t, object spec)
|
||||
if (class_) {
|
||||
PROTECT(t, class_);
|
||||
|
||||
hashMapInsert(t, classLoaderMap(t, t->m->loader), spec, class_,
|
||||
byteArrayHash);
|
||||
hashMapInsert(t, t->m->classMap, spec, class_, byteArrayHash);
|
||||
} else if (t->exception == 0) {
|
||||
object message = makeString(t, "%s", &byteArrayBody(t, spec, 0));
|
||||
t->exception = makeClassNotFoundException(t, message);
|
||||
@ -3565,6 +3563,7 @@ void
|
||||
visitRoots(Machine* m, Heap::Visitor* v)
|
||||
{
|
||||
v->visit(&(m->loader));
|
||||
v->visit(&(m->classMap));
|
||||
v->visit(&(m->loadClassMethod));
|
||||
v->visit(&(m->bootstrapClassMap));
|
||||
v->visit(&(m->monitorMap));
|
||||
@ -3699,6 +3698,8 @@ runJavaThread(Thread* t)
|
||||
void
|
||||
runFinalizeThread(Thread* t)
|
||||
{
|
||||
fprintf(stderr, "run finalize thread\n");
|
||||
|
||||
setDaemon(t, t->javaThread, true);
|
||||
|
||||
object list = 0;
|
||||
@ -3713,6 +3714,8 @@ runFinalizeThread(Thread* t)
|
||||
}
|
||||
|
||||
if (t->m->finalizeThread == 0) {
|
||||
fprintf(stderr, "exit finalize thread\n");
|
||||
|
||||
return;
|
||||
} else {
|
||||
list = t->m->objectsToFinalize;
|
||||
|
@ -1189,6 +1189,7 @@ class Machine {
|
||||
System::Monitor* shutdownLock;
|
||||
System::Library* libraries;
|
||||
object loader;
|
||||
object classMap;
|
||||
object loadClassMethod;
|
||||
object bootstrapClassMap;
|
||||
object monitorMap;
|
||||
@ -1658,6 +1659,16 @@ instanceOf(Thread* t, object class_, object o);
|
||||
|
||||
#include "type-declarations.cpp"
|
||||
|
||||
inline object
|
||||
getClassLoaderMap(Thread* t, object loader)
|
||||
{
|
||||
if (loader == t->m->loader) {
|
||||
return t->m->classMap;
|
||||
} else {
|
||||
return classLoaderMap(t, loader);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool
|
||||
objectFixed(Thread*, object o)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user