fix over-agressive state reset in state mapping code; logging tweaks

This commit is contained in:
Joel Dice 2008-01-07 14:32:41 -07:00
parent 25f12ca40a
commit 259dd643e0
2 changed files with 51 additions and 19 deletions

View File

@ -3491,24 +3491,27 @@ calculateJunctions(MyThread* t, Context* context, uintptr_t* originalRoots,
case IpEvent: {
ip = context->eventLog.get2(ei);
if (DebugFrameMaps) {
fprintf(stderr, " roots at ip %3d: ", ip);
printSet(*roots);
fprintf(stderr, "\n");
fprintf(stderr, " known at ip %3d: ", ip);
printSet(*known);
fprintf(stderr, "\n");
}
if (context->visitTable[ip] > 1) {
uintptr_t* tableRoots = context->rootTable + (ip * mapSize);
uintptr_t* tableKnown = context->knownTable + (ip * mapSize);
if (DebugFrameMaps) {
fprintf(stderr, " roots at ip %3d: ", ip);
printSet(*roots);
fprintf(stderr, "\n");
fprintf(stderr, " known at ip %3d: ", ip);
printSet(*known);
fprintf(stderr, "\n");
}
for (unsigned wi = 0; wi < mapSize; ++wi) {
tableRoots[wi] &= ~(known[wi] & ~roots[wi]);
tableRoots[wi] |= known[wi] & roots[wi] & ~tableKnown[wi];
tableKnown[wi] |= known[wi];
roots[wi] = 0;
known[wi] = tableKnown[wi] & ~tableRoots[wi];
}
if (DebugFrameMaps) {
@ -3520,9 +3523,6 @@ calculateJunctions(MyThread* t, Context* context, uintptr_t* originalRoots,
printSet(*tableKnown);
fprintf(stderr, "\n");
}
memset(roots, 0, mapSize * BytesPerWord);
memset(known, 0, mapSize * BytesPerWord);
}
ei += 2;
@ -3579,6 +3579,12 @@ updateTraceElements(MyThread* t, Context* context, uintptr_t* originalRoots,
case IpEvent: {
ip = context->eventLog.get2(ei);
if (DebugFrameMaps) {
fprintf(stderr, " map at ip %3d: ", ip);
printSet(*roots);
fprintf(stderr, "\n");
}
if (context->visitTable[ip] > 1) {
uintptr_t* tableRoots = context->rootTable + (ip * mapSize);
uintptr_t* tableKnown = context->knownTable + (ip * mapSize);
@ -3609,12 +3615,6 @@ updateTraceElements(MyThread* t, Context* context, uintptr_t* originalRoots,
TraceElement* te; context->eventLog.get(ei, &te, BytesPerWord);
memcpy(te->map, roots, mapSize * BytesPerWord);
if (DebugFrameMaps) {
fprintf(stderr, " map at ip %3d: ", ip);
printSet(*roots);
fprintf(stderr, "\n");
}
ei += BytesPerWord;
} break;

View File

@ -47,6 +47,16 @@ public class GC {
}
private static void stackMap3(boolean predicate) {
if (predicate) {
Object a = null;
} else {
int a = 42;
}
System.gc();
}
private static void stackMap4(boolean predicate) {
int i = 2;
if (predicate) {
Object a = null;
@ -61,6 +71,22 @@ public class GC {
} while (i >= 0);
}
private static void noop() { }
private static void stackMap5(boolean predicate) {
if (predicate) {
noop();
}
if (predicate) {
noop();
} else {
Object a = null;
}
System.gc();
}
public static void main(String[] args) {
Object[] array = new Object[1024 * 1024];
array[0] = new Object();
@ -87,6 +113,12 @@ public class GC {
stackMap3(true);
stackMap3(false);
stackMap4(true);
stackMap4(false);
stackMap5(true);
stackMap5(false);
}
}