diff options
| author | David Jones | 2007-07-20 11:09:49 +0100 |
|---|---|---|
| committer | David Jones | 2007-07-20 11:09:49 +0100 |
| commit | 7739f79926304c17eb6e06a35063ea2a8a06acff (patch) | |
| tree | 458a418b1e84d0173f39378e5568962dd9771f8b /mps/code | |
| parent | d97d0920afae7f612240e5a528a0f61c82bd8d08 (diff) | |
| download | emacs-7739f79926304c17eb6e06a35063ea2a8a06acff.tar.gz emacs-7739f79926304c17eb6e06a35063ea2a8a06acff.zip | |
Mps: why code in diagnostic, "correct" newsize diagnostics.
Copied from Perforce
Change: 162956
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/chain.h | 6 | ||||
| -rw-r--r-- | mps/code/mpmst.h | 1 | ||||
| -rw-r--r-- | mps/code/trace.c | 42 |
3 files changed, 44 insertions, 5 deletions
diff --git a/mps/code/chain.h b/mps/code/chain.h index d37a46ccde4..785c25e2349 100644 --- a/mps/code/chain.h +++ b/mps/code/chain.h | |||
| @@ -51,6 +51,12 @@ typedef struct PoolGenStruct { | |||
| 51 | RingStruct genRing; | 51 | RingStruct genRing; |
| 52 | Size totalSize; /* total size of segs in gen in this pool */ | 52 | Size totalSize; /* total size of segs in gen in this pool */ |
| 53 | Size newSize; /* size allocated since last GC */ | 53 | Size newSize; /* size allocated since last GC */ |
| 54 | /* newSize when TraceCreate is called. This is for diagnostic */ | ||
| 55 | /* purposes only. It's used in a DIAG message emitted in TraceStart; */ | ||
| 56 | /* at that time, newSize has already been diminished by Whiten so we */ | ||
| 57 | /* can't use that value. This will not work well with multiple */ | ||
| 58 | /* traces. */ | ||
| 59 | Size newSizeAtCreate; | ||
| 54 | } PoolGenStruct; | 60 | } PoolGenStruct; |
| 55 | 61 | ||
| 56 | 62 | ||
diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 35ff8ac6d9b..739c95a449d 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h | |||
| @@ -511,6 +511,7 @@ typedef struct TraceStruct { | |||
| 511 | Sig sig; /* <design/sig/> */ | 511 | Sig sig; /* <design/sig/> */ |
| 512 | TraceId ti; /* index into TraceSets */ | 512 | TraceId ti; /* index into TraceSets */ |
| 513 | Arena arena; /* owning arena */ | 513 | Arena arena; /* owning arena */ |
| 514 | int why; /* why the trace began */ | ||
| 514 | ZoneSet white; /* zones in the white set */ | 515 | ZoneSet white; /* zones in the white set */ |
| 515 | ZoneSet mayMove; /* zones containing possibly moving objs */ | 516 | ZoneSet mayMove; /* zones containing possibly moving objs */ |
| 516 | TraceState state; /* current state of trace */ | 517 | TraceState state; /* current state of trace */ |
diff --git a/mps/code/trace.c b/mps/code/trace.c index 9e1dd3a56c2..aaa730b325f 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c | |||
| @@ -836,6 +836,33 @@ static void traceFlip(Trace trace) | |||
| 836 | return; | 836 | return; |
| 837 | } | 837 | } |
| 838 | 838 | ||
| 839 | /* traceCopySizes -- preserve size information for later use | ||
| 840 | * | ||
| 841 | * A PoolGen's newSize is important information that we want to emit in | ||
| 842 | * a diagnostic message at TraceStart. In order to do that we must copy | ||
| 843 | * the information before Whiten changes it. This function does that. | ||
| 844 | */ | ||
| 845 | |||
| 846 | static void traceCopySizes(Trace trace) | ||
| 847 | { | ||
| 848 | Ring node, nextNode; | ||
| 849 | int i; | ||
| 850 | Arena arena = trace->arena; | ||
| 851 | |||
| 852 | RING_FOR(node, &arena->chainRing, nextNode) { | ||
| 853 | Chain chain = RING_ELT(Chain, chainRing, node); | ||
| 854 | |||
| 855 | for(i = 0; i < chain->genCount; ++i) { | ||
| 856 | Ring n, nn; | ||
| 857 | GenDesc desc = &chain->gens[i]; | ||
| 858 | RING_FOR(n, &desc->locusRing, nn) { | ||
| 859 | PoolGen gen = RING_ELT(PoolGen, genRing, n); | ||
| 860 | gen->newSizeAtCreate = gen->newSize; | ||
| 861 | } | ||
| 862 | } | ||
| 863 | } | ||
| 864 | return; | ||
| 865 | } | ||
| 839 | 866 | ||
| 840 | /* TraceCreate -- create a Trace object | 867 | /* TraceCreate -- create a Trace object |
| 841 | * | 868 | * |
| @@ -871,6 +898,10 @@ found: | |||
| 871 | AVER(trace->sig == SigInvalid); /* <design/arena/#trace.invalid> */ | 898 | AVER(trace->sig == SigInvalid); /* <design/arena/#trace.invalid> */ |
| 872 | 899 | ||
| 873 | trace->arena = arena; | 900 | trace->arena = arena; |
| 901 | trace->why = why; | ||
| 902 | TraceStartMessageInit(arena, &trace->startMessage); | ||
| 903 | traceStartWhyToString(trace->startMessage.why, | ||
| 904 | sizeof trace->startMessage.why, why); | ||
| 874 | trace->white = ZoneSetEMPTY; | 905 | trace->white = ZoneSetEMPTY; |
| 875 | trace->mayMove = ZoneSetEMPTY; | 906 | trace->mayMove = ZoneSetEMPTY; |
| 876 | trace->ti = ti; | 907 | trace->ti = ti; |
| @@ -906,9 +937,6 @@ found: | |||
| 906 | trace->preservedInPlaceSize = (Size)0; /* see .message.data */ | 937 | trace->preservedInPlaceSize = (Size)0; /* see .message.data */ |
| 907 | STATISTIC(trace->reclaimCount = (Count)0); | 938 | STATISTIC(trace->reclaimCount = (Count)0); |
| 908 | STATISTIC(trace->reclaimSize = (Size)0); | 939 | STATISTIC(trace->reclaimSize = (Size)0); |
| 909 | TraceStartMessageInit(arena, &trace->startMessage); | ||
| 910 | traceStartWhyToString(trace->startMessage.why, | ||
| 911 | sizeof trace->startMessage.why, why); | ||
| 912 | trace->sig = TraceSig; | 940 | trace->sig = TraceSig; |
| 913 | arena->busyTraces = TraceSetAdd(arena->busyTraces, trace); | 941 | arena->busyTraces = TraceSetAdd(arena->busyTraces, trace); |
| 914 | AVERT(Trace, trace); | 942 | AVERT(Trace, trace); |
| @@ -919,6 +947,8 @@ found: | |||
| 919 | /* @@@@ This is a short-term fix for request.dylan.160098. */ | 947 | /* @@@@ This is a short-term fix for request.dylan.160098. */ |
| 920 | ShieldSuspend(arena); | 948 | ShieldSuspend(arena); |
| 921 | 949 | ||
| 950 | traceCopySizes(trace); | ||
| 951 | |||
| 922 | *traceReturn = trace; | 952 | *traceReturn = trace; |
| 923 | return ResOK; | 953 | return ResOK; |
| 924 | } | 954 | } |
| @@ -1825,7 +1855,8 @@ void TraceStart(Trace trace, double mortality, double finishingTime) | |||
| 1825 | } | 1855 | } |
| 1826 | 1856 | ||
| 1827 | DIAG_WRITEF(( DIAG_STREAM, | 1857 | DIAG_WRITEF(( DIAG_STREAM, |
| 1828 | "MPS: TraceStart\n", | 1858 | "MPS: TraceStart, because code $U: $S\n", |
| 1859 | trace->why, trace->startMessage.why, | ||
| 1829 | NULL )); | 1860 | NULL )); |
| 1830 | { /* @@ */ | 1861 | { /* @@ */ |
| 1831 | /* Iterate over all chains, all GenDescs within a chain, and all */ | 1862 | /* Iterate over all chains, all GenDescs within a chain, and all */ |
| @@ -1850,7 +1881,8 @@ void TraceStart(Trace trace, double mortality, double finishingTime) | |||
| 1850 | PoolGen gen = RING_ELT(PoolGen, genRing, n); | 1881 | PoolGen gen = RING_ELT(PoolGen, genRing, n); |
| 1851 | DIAG_WRITEF(( DIAG_STREAM, | 1882 | DIAG_WRITEF(( DIAG_STREAM, |
| 1852 | "MPS: PoolGen $U", gen->nr, | 1883 | "MPS: PoolGen $U", gen->nr, |
| 1853 | " totalSize $U newSize $U\n", gen->totalSize, gen->newSize, | 1884 | " totalSize $U", gen->totalSize, |
| 1885 | " newSize $U\n", gen->newSizeAtCreate, | ||
| 1854 | NULL )); | 1886 | NULL )); |
| 1855 | } | 1887 | } |
| 1856 | } | 1888 | } |