mirror of
https://github.com/corda/corda.git
synced 2025-02-07 19:40:25 +00:00
enter exclusive state in collect function instead of requiring caller to enter that state before calling
This commit is contained in:
parent
2226627e53
commit
ebb498587f
@ -575,8 +575,6 @@ Java_java_lang_Runtime_load(Thread* t, jclass, jstring name, jboolean mapName)
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_java_lang_Runtime_gc(Thread* t, jobject)
|
||||
{
|
||||
ENTER(t, Thread::ExclusiveState);
|
||||
|
||||
collect(t, Heap::MajorCollection);
|
||||
}
|
||||
|
||||
|
@ -1447,6 +1447,8 @@ makeArrayClass(Thread* t, object spec)
|
||||
void
|
||||
removeMonitor(Thread* t, object o)
|
||||
{
|
||||
expect(t, t->state == Thread::ExclusiveState);
|
||||
|
||||
unsigned hash;
|
||||
if (DebugMonitors) {
|
||||
hash = objectHash(t, o);
|
||||
@ -1556,9 +1558,7 @@ class HeapClient: public Heap::Client {
|
||||
}
|
||||
|
||||
virtual void collect(void* context, Heap::CollectionType type) {
|
||||
Thread* t = static_cast<Thread*>(context);
|
||||
ENTER(t, Thread::ExclusiveState);
|
||||
collect(t, type);
|
||||
collect(static_cast<Thread*>(context), type);
|
||||
}
|
||||
|
||||
virtual bool isFixed(void* p) {
|
||||
@ -2084,7 +2084,6 @@ allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type,
|
||||
}
|
||||
|
||||
if (t->heap == 0) {
|
||||
ENTER(t, Thread::ExclusiveState);
|
||||
// fprintf(stderr, "gc");
|
||||
// vmPrintTrace(t);
|
||||
collect(t, Heap::MinorCollection);
|
||||
@ -2735,6 +2734,8 @@ intern(Thread* t, object s)
|
||||
void
|
||||
collect(Thread* t, Heap::CollectionType type)
|
||||
{
|
||||
ENTER(t, Thread::ExclusiveState);
|
||||
|
||||
#ifdef VM_STRESS
|
||||
bool stress = t->stress;
|
||||
if (not stress) t->stress = true;
|
||||
|
@ -1348,14 +1348,12 @@ stress(Thread* t)
|
||||
and t->state != Thread::IdleState)
|
||||
{
|
||||
t->stress = true;
|
||||
{ ENTER(t, Thread::ExclusiveState);
|
||||
|
||||
# ifdef VM_STRESS_MAJOR
|
||||
collect(t, Heap::MajorCollection);
|
||||
# else // not VM_STRESS_MAJOR
|
||||
collect(t, Heap::MinorCollection);
|
||||
# endif // not VM_STRESS_MAJOR
|
||||
}
|
||||
|
||||
t->stress = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user