fix openjdk build

This commit is contained in:
Joel Dice 2013-02-22 14:41:24 -07:00
parent 8546ca5670
commit d152f8cf74
5 changed files with 66 additions and 2 deletions

View File

@ -319,7 +319,7 @@ class MyClasspath : public Classpath {
} }
virtual void virtual void
boot(Thread* t) preBoot(Thread* t)
{ {
{ object runtimeClass = resolveClass { object runtimeClass = resolveClass
(t, root(t, Machine::BootLoader), "java/lang/Runtime", false); (t, root(t, Machine::BootLoader), "java/lang/Runtime", false);
@ -348,6 +348,12 @@ class MyClasspath : public Classpath {
JNI_OnLoad(reinterpret_cast< ::JavaVM*>(t->m), 0); JNI_OnLoad(reinterpret_cast< ::JavaVM*>(t->m), 0);
} }
virtual void
boot(Thread*)
{
// ignore
}
virtual const char* virtual const char*
bootClasspath() bootClasspath()
{ {

View File

@ -109,6 +109,12 @@ class MyClasspath : public Classpath {
vm::resolveNative(t, method); vm::resolveNative(t, method);
} }
virtual void
preBoot(Thread*)
{
// ignore
}
virtual void virtual void
boot(Thread*) boot(Thread*)
{ {

View File

@ -639,6 +639,12 @@ class MyClasspath : public Classpath {
vm::resolveNative(t, method); vm::resolveNative(t, method);
} }
virtual void
preBoot(Thread*)
{
// ignore
}
virtual void virtual void
boot(Thread* t) boot(Thread* t)
{ {
@ -786,6 +792,47 @@ class MyClasspath : public Classpath {
} }
} }
virtual object
makeDirectByteBuffer(Thread* t, void* p, jlong capacity)
{
object c = resolveClass
(t, root(t, Machine::BootLoader), "java/nio/DirectByteBuffer");
PROTECT(t, c);
object instance = makeNew(t, c);
PROTECT(t, instance);
object constructor = resolveMethod(t, c, "<init>", "(JI)V");
t->m->processor->invoke
(t, constructor, instance, reinterpret_cast<int64_t>(p),
static_cast<int32_t>(capacity));
return instance;
}
virtual void*
getDirectBufferAddress(Thread* t, object b)
{
PROTECT(t, b);
object field = resolveField(t, objectClass(t, b), "address", "J");
return reinterpret_cast<void*>
(fieldAtOffset<int64_t>(b, fieldOffset(t, field)));
}
virtual int64_t
getDirectBufferCapacity(Thread* t, object b)
{
PROTECT(t, b);
object field = resolveField
(t, objectClass(t, b), "capacity", "I");
return fieldAtOffset<int32_t>(b, fieldOffset(t, field));
}
virtual void virtual void
dispose() dispose()
{ {

View File

@ -3513,7 +3513,7 @@ boot(Thread* t, uintptr_t*)
setRoot(t, Machine::Shutdown, makeThrowable(t, Machine::ThrowableType)); setRoot(t, Machine::Shutdown, makeThrowable(t, Machine::ThrowableType));
t->m->classpath->boot(t); t->m->classpath->preBoot(t);
t->javaThread = t->m->classpath->makeThread(t, 0); t->javaThread = t->m->classpath->makeThread(t, 0);
@ -3523,6 +3523,8 @@ boot(Thread* t, uintptr_t*)
threadDaemon(t, root(t, Machine::FinalizerThread)) = true; threadDaemon(t, root(t, Machine::FinalizerThread)) = true;
t->m->classpath->boot(t);
enter(t, Thread::IdleState); enter(t, Thread::IdleState);
return 1; return 1;

View File

@ -1561,6 +1561,9 @@ class Classpath {
virtual void virtual void
resolveNative(Thread* t, object method) = 0; resolveNative(Thread* t, object method) = 0;
virtual void
preBoot(Thread* t) = 0;
virtual void virtual void
boot(Thread* t) = 0; boot(Thread* t) = 0;