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