Merge remote branch 'origin/master' into r0.5

This commit is contained in:
Joel Dice 2010-12-21 15:28:34 -07:00
commit 5da8b96931
4 changed files with 58 additions and 8 deletions

View File

@ -4763,9 +4763,17 @@ class BranchEvent: public Event {
if (not unreachable(this)) {
if (firstConstant and secondConstant) {
if (shouldJump(c, type, size, firstConstant->value->value(),
secondConstant->value->value()))
{
int64_t firstValue = firstConstant->value->value();
int64_t secondValue = secondConstant->value->value();
if (size > BytesPerWord) {
firstValue |= findConstantSite
(c, first->nextWord)->value->value() << 32;
secondValue |= findConstantSite
(c, second->nextWord)->value->value() << 32;
}
if (shouldJump(c, type, size, firstValue, secondValue)) {
apply(c, Jump, BytesPerWord, address->source, address->source);
}
} else {

View File

@ -2258,7 +2258,7 @@ Thread::Thread(Machine* m, object javaThread, Thread* parent):
vtable(&(m->jniEnvVTable)),
m(m),
parent(parent),
peer((parent ? parent->child : 0)),
peer(0),
child(0),
waitNext(0),
state(NoState),
@ -2331,9 +2331,6 @@ Thread::init()
javaThread = m->classpath->makeThread(this, 0);
threadPeer(this, javaThread) = reinterpret_cast<jlong>(this);
} else {
peer = parent->child;
parent->child = this;
}
expect(this, m->system->success(m->system->make(&lock)));
@ -2538,6 +2535,7 @@ enter(Thread* t, Thread::State s)
-- t->m->daemonCount;
}
}
t->state = s;
t->m->stateLock->notifyAll(t->systemThread);
@ -3436,8 +3434,10 @@ postInitClass(Thread* t, object c)
ACQUIRE(t, t->m->classLock);
if (t->exception) {
object exception = t->exception;
t->exception = 0;
t->exception = makeThrowable
(t, Machine::ExceptionInInitializerErrorType, 0, 0, t->exception);
(t, Machine::ExceptionInInitializerErrorType, 0, 0, exception);
classVmFlags(t, c) |= NeedInitFlag | InitErrorFlag;
classVmFlags(t, c) &= ~InitFlag;
@ -3737,7 +3737,10 @@ collect(Thread* t, Heap::CollectionType type)
m->finalizeThread = m->processor->makeThread(m, javaThread, m->rootThread);
addThread(t, m->finalizeThread);
if (not startThread(t, m->finalizeThread)) {
removeThread(t, m->finalizeThread);
m->finalizeThread = 0;
}
}
@ -3882,6 +3885,7 @@ makeTrace(Thread* t, Processor::StackWalker* walker)
virtual bool visit(Processor::StackWalker* walker) {
if (trace == 0) {
trace = makeObjectArray(t, walker->count());
vm_assert(t, trace);
}
object e = makeTraceElement(t, walker->method(), walker->ip());

View File

@ -1757,14 +1757,45 @@ startThread(Thread* t, Thread* p)
return t->m->system->success(t->m->system->start(&(p->runnable)));
}
inline void
addThread(Thread* t, Thread* p)
{
ACQUIRE_RAW(t, t->m->stateLock);
assert(t, p->state == Thread::NoState);
p->state = Thread::IdleState;
++ t->m->liveCount;
p->peer = p->parent->child;
p->parent->child = p;
}
inline void
removeThread(Thread* t, Thread* p)
{
ACQUIRE_RAW(t, t->m->stateLock);
assert(t, p->state == Thread::IdleState);
-- t->m->liveCount;
t->m->stateLock->notifyAll(t->systemThread);
p->parent->child = p->peer;
}
inline Thread*
startThread(Thread* t, object javaThread)
{
Thread* p = t->m->processor->makeThread(t->m, javaThread, t);
addThread(t, p);
if (startThread(t, p)) {
return p;
} else {
removeThread(t, p);
return 0;
}
}
@ -1795,6 +1826,8 @@ attachThread(Machine* m, bool daemon)
Thread* t = m->processor->makeThread(m, 0, m->rootThread);
m->system->attach(&(t->runnable));
addThread(t, t);
enter(t, Thread::ActiveState);
t->javaThread = m->classpath->makeThread(t, m->rootThread);

View File

@ -60,6 +60,11 @@ public class Longs {
}
public static void main(String[] args) throws Exception {
{ long a = 0x1FFFFFFFFL;
long b = -1;
expect(a != b);
}
expect(Math.abs(-123L) == 123L);
expect(readLongFrom(new java.io.InputStream() {