Merge pull request #229 from dicej/preBoot

fix broken Android build due to 617bd85
This commit is contained in:
Joshua Warner 2014-04-11 21:54:34 -06:00
commit 2fff3a6e13
5 changed files with 26 additions and 5 deletions

View File

@ -1571,6 +1571,8 @@ class Classpath {
virtual void
preBoot(Thread* t) = 0;
virtual bool mayInitClasses() = 0;
virtual void
boot(Thread* t) = 0;

View File

@ -228,9 +228,8 @@ translateStackTrace(Thread* t, object raw)
class MyClasspath : public Classpath {
public:
MyClasspath(Allocator* allocator):
allocator(allocator),
tzdata(0)
MyClasspath(Allocator* allocator)
: allocator(allocator), tzdata(0), mayInitClasses_(false)
{ }
virtual object
@ -493,6 +492,13 @@ class MyClasspath : public Classpath {
JniConstants::init(reinterpret_cast<_JNIEnv*>(t));
JNI_OnLoad(reinterpret_cast< ::JavaVM*>(t->m), 0);
mayInitClasses_ = true;
}
virtual bool mayInitClasses()
{
return mayInitClasses_;
}
virtual void
@ -579,6 +585,7 @@ class MyClasspath : public Classpath {
Allocator* allocator;
System::Region* tzdata;
bool mayInitClasses_;
};
int64_t JNICALL

View File

@ -121,6 +121,11 @@ class MyClasspath : public Classpath {
// ignore
}
virtual bool mayInitClasses()
{
return true;
}
virtual void
boot(Thread*)
{

View File

@ -681,6 +681,11 @@ class MyClasspath : public Classpath {
// ignore
}
virtual bool mayInitClasses()
{
return true;
}
virtual void
boot(Thread* t)
{

View File

@ -354,9 +354,11 @@ findClass(Thread* t, uintptr_t* arguments)
: root(t, Machine::AppLoader),
n);
PROTECT(t, c);
if (t->m->classpath->mayInitClasses()) {
PROTECT(t, c);
initClass(t, c);
initClass(t, c);
}
return reinterpret_cast<uint64_t>(makeLocalReference(t, getJClass(t, c)));
}