mirror of
https://github.com/corda/corda.git
synced 2025-05-30 14:14:29 +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
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Java_java_lang_Runtime_gc(Thread* t, jobject)
|
Java_java_lang_Runtime_gc(Thread* t, jobject)
|
||||||
{
|
{
|
||||||
ENTER(t, Thread::ExclusiveState);
|
|
||||||
|
|
||||||
collect(t, Heap::MajorCollection);
|
collect(t, Heap::MajorCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1447,6 +1447,8 @@ makeArrayClass(Thread* t, object spec)
|
|||||||
void
|
void
|
||||||
removeMonitor(Thread* t, object o)
|
removeMonitor(Thread* t, object o)
|
||||||
{
|
{
|
||||||
|
expect(t, t->state == Thread::ExclusiveState);
|
||||||
|
|
||||||
unsigned hash;
|
unsigned hash;
|
||||||
if (DebugMonitors) {
|
if (DebugMonitors) {
|
||||||
hash = objectHash(t, o);
|
hash = objectHash(t, o);
|
||||||
@ -1556,9 +1558,7 @@ class HeapClient: public Heap::Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void collect(void* context, Heap::CollectionType type) {
|
virtual void collect(void* context, Heap::CollectionType type) {
|
||||||
Thread* t = static_cast<Thread*>(context);
|
collect(static_cast<Thread*>(context), type);
|
||||||
ENTER(t, Thread::ExclusiveState);
|
|
||||||
collect(t, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isFixed(void* p) {
|
virtual bool isFixed(void* p) {
|
||||||
@ -2084,7 +2084,6 @@ allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (t->heap == 0) {
|
if (t->heap == 0) {
|
||||||
ENTER(t, Thread::ExclusiveState);
|
|
||||||
// fprintf(stderr, "gc");
|
// fprintf(stderr, "gc");
|
||||||
// vmPrintTrace(t);
|
// vmPrintTrace(t);
|
||||||
collect(t, Heap::MinorCollection);
|
collect(t, Heap::MinorCollection);
|
||||||
@ -2735,6 +2734,8 @@ intern(Thread* t, object s)
|
|||||||
void
|
void
|
||||||
collect(Thread* t, Heap::CollectionType type)
|
collect(Thread* t, Heap::CollectionType type)
|
||||||
{
|
{
|
||||||
|
ENTER(t, Thread::ExclusiveState);
|
||||||
|
|
||||||
#ifdef VM_STRESS
|
#ifdef VM_STRESS
|
||||||
bool stress = t->stress;
|
bool stress = t->stress;
|
||||||
if (not stress) t->stress = true;
|
if (not stress) t->stress = true;
|
||||||
|
@ -1348,14 +1348,12 @@ stress(Thread* t)
|
|||||||
and t->state != Thread::IdleState)
|
and t->state != Thread::IdleState)
|
||||||
{
|
{
|
||||||
t->stress = true;
|
t->stress = true;
|
||||||
{ ENTER(t, Thread::ExclusiveState);
|
|
||||||
|
|
||||||
# ifdef VM_STRESS_MAJOR
|
# ifdef VM_STRESS_MAJOR
|
||||||
collect(t, Heap::MajorCollection);
|
collect(t, Heap::MajorCollection);
|
||||||
# else // not VM_STRESS_MAJOR
|
# else // not VM_STRESS_MAJOR
|
||||||
collect(t, Heap::MinorCollection);
|
collect(t, Heap::MinorCollection);
|
||||||
# endif // not VM_STRESS_MAJOR
|
# endif // not VM_STRESS_MAJOR
|
||||||
}
|
|
||||||
|
|
||||||
t->stress = false;
|
t->stress = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user