diff --git a/src/heap.cpp b/src/heap.cpp index f437955d35..8ec6820f71 100644 --- a/src/heap.cpp +++ b/src/heap.cpp @@ -1419,7 +1419,8 @@ makeHeap(System* system) return Reachable; } else if (c.nextGen2.contains(p) or (c.gen2.contains(p) - and c.gen2.indexOf(p) >= c.gen2Base)) + and (c.mode == ::MinorCollection + or c.gen2.indexOf(p) >= c.gen2Base))) { return Tenured; } else if (wasCollected(&c, p)) { diff --git a/src/machine.cpp b/src/machine.cpp index f1281b4984..32595d35ab 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -1341,6 +1341,11 @@ Thread::dispose() systemThread = 0; } +#ifdef VM_STRESS + vm->system->free(heap); + heap = 0; +#endif // VM_STRESS + if (allocator) { allocator->free(this); } @@ -1377,7 +1382,8 @@ enter(Thread* t, Thread::State s) switch (s) { case Thread::ExclusiveState: { - assert(t, t->state == Thread::ActiveState); + assert(t, t->state == Thread::ActiveState + or t->state == Thread::ExitState); while (t->vm->exclusive) { // another thread got here first. diff --git a/src/machine.h b/src/machine.h index 3a708c1825..1718a5416c 100644 --- a/src/machine.h +++ b/src/machine.h @@ -22,7 +22,7 @@ namespace vm { const bool Verbose = false; -const bool DebugRun = true; +const bool DebugRun = false; const bool DebugStack = false; const bool DebugMonitors = false; @@ -1221,7 +1221,10 @@ collect(Thread* t, Heap::CollectionType type); inline void stress(Thread* t) { - if ((not t->stress) and t->state != Thread::NoState) { + if ((not t->stress) + and t->state != Thread::NoState + and t->state != Thread::IdleState) + { t->stress = true; { ENTER(t, Thread::ExclusiveState); diff --git a/src/run.cpp b/src/run.cpp index d313449913..bf2d2cb7af 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -396,6 +396,8 @@ invokeNative(Thread* t, object method) return VoidField; } + PROTECT(t, data); + pushFrame(t, method); unsigned count = methodParameterCount(t, method);