mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
JIT-related GC safety fixes
This commit is contained in:
parent
fb29fd11d8
commit
e4fbadd051
6
makefile
6
makefile
@ -28,7 +28,7 @@ src = src
|
||||
classpath = classpath
|
||||
test = test
|
||||
|
||||
input = $(test-build)/Exceptions.class
|
||||
input = $(test-build)/GC.class
|
||||
|
||||
build-cxx = g++
|
||||
build-cc = gcc
|
||||
@ -109,10 +109,10 @@ ifeq ($(mode),debug)
|
||||
cflags += -O0 -g3
|
||||
endif
|
||||
ifeq ($(mode),stress)
|
||||
cflags += -O0 -g3 -DNDEBUG -DVM_STRESS
|
||||
cflags += -O0 -g3 -DVM_STRESS
|
||||
endif
|
||||
ifeq ($(mode),stress-major)
|
||||
cflags += -O0 -g3 -DNDEBUG -DVM_STRESS -DVM_STRESS_MAJOR
|
||||
cflags += -O0 -g3 -DVM_STRESS -DVM_STRESS_MAJOR
|
||||
endif
|
||||
ifeq ($(mode),fast)
|
||||
cflags += -O3 -g3 -DNDEBUG
|
||||
|
@ -2914,6 +2914,7 @@ finish(MyThread* t, Compiler* c, object method, Vector* objectPool,
|
||||
|
||||
if (method) {
|
||||
PROTECT(t, method);
|
||||
PROTECT(t, result);
|
||||
|
||||
for (unsigned i = 0; i < objectPool->length(); i += sizeof(PoolElement)) {
|
||||
PoolElement* e = objectPool->peek<PoolElement>(i);
|
||||
@ -3076,17 +3077,20 @@ void
|
||||
compile(MyThread* t, object method);
|
||||
|
||||
void*
|
||||
compileMethod(MyThread* t)
|
||||
compileMethod2(MyThread* t)
|
||||
{
|
||||
object node = findTraceNode(t, *static_cast<void**>(t->stack));
|
||||
PROTECT(t, node);
|
||||
|
||||
object target = resolveTarget(t, t->stack, traceNodeTarget(t, node));
|
||||
PROTECT(t, target);
|
||||
|
||||
if (LIKELY(t->exception == 0)) {
|
||||
compile(t, target);
|
||||
}
|
||||
|
||||
if (UNLIKELY(t->exception)) {
|
||||
unwind(t);
|
||||
return 0;
|
||||
} else {
|
||||
if (not traceNodeVirtualCall(t, node)) {
|
||||
Compiler* c = makeCompiler(t->m->system, 0);
|
||||
@ -3098,6 +3102,18 @@ compileMethod(MyThread* t)
|
||||
}
|
||||
}
|
||||
|
||||
void*
|
||||
compileMethod(MyThread* t)
|
||||
{
|
||||
void* r = compileMethod2(t);
|
||||
|
||||
if (UNLIKELY(t->exception)) {
|
||||
unwind(t);
|
||||
} else {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t
|
||||
invokeNative2(MyThread* t, object method)
|
||||
{
|
||||
@ -3302,7 +3318,7 @@ visitStack(MyThread* t, Heap::Visitor* v)
|
||||
void** stack = static_cast<void**>(t->stack);
|
||||
MyThread::CallTrace* trace = t->trace;
|
||||
|
||||
while (true) {
|
||||
while (stack) {
|
||||
object node = findTraceNode(t, *stack);
|
||||
if (node) {
|
||||
PROTECT(t, node);
|
||||
@ -3316,7 +3332,7 @@ visitStack(MyThread* t, Heap::Visitor* v)
|
||||
visitParameters(t, v, base, method);
|
||||
}
|
||||
|
||||
visitStackAndLocals(t, v, base, method);
|
||||
visitStackAndLocals(t, v, base, node);
|
||||
|
||||
stack = static_cast<void**>(base) + 1;
|
||||
base = *static_cast<void**>(base);
|
||||
@ -3838,8 +3854,6 @@ compile(MyThread* t, object method)
|
||||
ACQUIRE(t, t->m->classLock);
|
||||
|
||||
if (methodCompiled(t, method) == p->getDefaultCompiled(t)) {
|
||||
PROTECT(t, method);
|
||||
|
||||
Compiler* c = makeCompiler(t->m->system, p->indirectCaller);
|
||||
|
||||
object compiled = compile(t, c, method);
|
||||
|
@ -332,7 +332,7 @@ class Segment {
|
||||
}
|
||||
|
||||
void replaceWith(Segment* s) {
|
||||
system(context)->free(data);
|
||||
if (data) system(context)->free(data);
|
||||
data = s->data;
|
||||
s->data = 0;
|
||||
|
||||
@ -350,7 +350,7 @@ class Segment {
|
||||
abort(context);
|
||||
}
|
||||
} else {
|
||||
map = 0;
|
||||
assert(context, map == 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ class Context {
|
||||
ageMap(&gen1, max(1, log(TenureThreshold)), 1, 0, false),
|
||||
gen1(this, &ageMap, 0, 0),
|
||||
|
||||
nextAgeMap(&nextGen1, max(1, log(TenureThreshold)), 1, 0, false),
|
||||
nextAgeMap(&nextGen1, max(1, log(TenureThreshold)), 1, 0, false),
|
||||
nextGen1(this, &nextAgeMap, 0, 0),
|
||||
|
||||
pointerMap(&gen2, 1, 1, 0, true),
|
||||
|
@ -2777,6 +2777,11 @@ intern(Thread* t, object s)
|
||||
void
|
||||
collect(Thread* t, Heap::CollectionType type)
|
||||
{
|
||||
#ifdef VM_STRESS
|
||||
bool stress = t->stress;
|
||||
if (not stress) t->stress = true;
|
||||
#endif
|
||||
|
||||
Machine* m = t->m;
|
||||
|
||||
m->unsafe = true;
|
||||
@ -2800,6 +2805,10 @@ collect(Thread* t, Heap::CollectionType type)
|
||||
m->heapPoolIndex = 0;
|
||||
|
||||
m->fixedFootprint = 0;
|
||||
|
||||
#ifdef VM_STRESS
|
||||
if (not stress) t->stress = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user