Home | History | Annotate | Download | only in helgrind

Lines Matching refs:VTS

153    but VTS ticks, which isn't realistic.
172 It is a maximum sized VTS, so has (1 << SCALARTS_N_TYMBITS)
281 is the VTS to be used for reads, viW for writes. Usually they
1782 // SECTION BEGIN vts primitives //
1854 /* A VTS contains .ts, its vector clock, and also .id, a field to hold
1865 VTS;
1867 /* Allocate a VTS capable of storing 'sizeTS' entries. */
1868 static VTS* VTS__new ( HChar* who, UInt sizeTS );
1870 /* Make a clone of 'vts', sizing the new array to exactly match the
1872 static VTS* VTS__clone ( HChar* who, VTS* vts );
1874 /* Make a clone of 'vts' with the thrids in 'thrids' removed. The new
1878 static VTS* VTS__subtract ( HChar* who, VTS* vts, XArray* thridsToDel );
1880 /* Delete this VTS in its entirety. */
1881 static void VTS__delete ( VTS* vts );
1883 /* Create a new singleton VTS in 'out'. Caller must have
1886 static void VTS__singleton ( /*OUT*/VTS* out, Thr* thr, ULong tym );
1888 /* Create in 'out' a VTS which is the same as 'vts' except with
1889 vts[me]++, so to speak. Caller must have pre-allocated 'out'
1891 static void VTS__tick ( /*OUT*/VTS* out, Thr* me, VTS* vts );
1893 /* Create in 'out' a VTS which is the join (max) of 'a' and
1896 static void VTS__join ( /*OUT*/VTS* out, VTS* a, VTS* b );
1910 static UInt VTS__cmpLEQ ( VTS* a, VTS* b );
1915 static Word VTS__cmp_structural ( VTS* a, VTS* b );
1917 /* Debugging only. Display the given VTS in the buffer. */
1918 static void VTS__show ( HChar* buf, Int nBuf, VTS* vts );
1920 /* Debugging only. Return vts[index], so to speak. */
1921 static ULong VTS__indexAt_SLOW ( VTS* vts, Thr* idx );
1923 /* Notify the VTS machinery that a thread has been declared
1932 static Bool is_sane_VTS ( VTS* vts )
1936 if (!vts) return False;
1937 if (!vts->ts) return False;
1938 if (vts->usedTS > vts->sizeTS) return False;
1939 n = vts->usedTS;
1941 st1 = &vts->ts[0];
1948 st1 = &vts->ts[i];
1949 st2 = &vts->ts[i+1];
1960 /* Create a new, empty VTS.
1962 static VTS* VTS__new ( HChar* who, UInt sizeTS )
1964 VTS* vts = HG_(zalloc)(who, sizeof(VTS) + (sizeTS+1) * sizeof(ScalarTS));
1965 tl_assert(vts->usedTS == 0);
1966 vts->sizeTS = sizeTS;
1967 *(ULong*)(&vts->ts[sizeTS]) = 0x0ddC0ffeeBadF00dULL;
1968 return vts;
1971 /* Clone this VTS.
1973 static VTS* VTS__clone ( HChar* who, VTS* vts )
1975 tl_assert(vts);
1976 tl_assert( *(ULong*)(&vts->ts[vts->sizeTS]) == 0x0ddC0ffeeBadF00dULL);
1977 UInt nTS = vts->usedTS;
1978 VTS* clone = VTS__new(who, nTS);
1979 clone->id = vts->id;
1984 clone->ts[i] = vts->ts[i];
1991 /* Make a clone of a VTS with specified ThrIDs removed. 'thridsToDel'
1995 static VTS* VTS__subtract ( HChar* who, VTS* vts, XArray* thridsToDel )
1998 tl_assert(vts);
2000 tl_assert( *(ULong*)(&vts->ts[vts->sizeTS]) == 0x0ddC0ffeeBadF00dULL);
2001 UInt nTS = vts->usedTS;
2005 ThrID thrid = vts->ts[i].thrid;
2011 VTS* res = VTS__new(who, nReq);
2014 ThrID thrid = vts->ts[i].thrid;
2017 res->ts[j++] = vts->ts[i];
2027 /* Delete this VTS in its entirety.
2029 static void VTS__delete ( VTS* vts )
2031 tl_assert(vts);
2032 tl_assert(vts->usedTS <= vts->sizeTS);
2033 tl_assert( *(ULong*)(&vts->ts[vts->sizeTS]) == 0x0ddC0ffeeBadF00dULL);
2034 HG_(free)(vts);
2038 /* Create a new singleton VTS.
2040 static void VTS__singleton ( /*OUT*/VTS* out, Thr* thr, ULong tym )
2053 /* Return a new VTS in which vts[me]++, so to speak. 'vts' itself is
2056 static void VTS__tick ( /*OUT*/VTS* out, Thr* me, VTS* vts )
2066 if (vts->usedTS >= ThrID_MAX_VALID)
2068 tl_assert(out->sizeTS >= 1 + vts->usedTS);
2072 tl_assert(is_sane_VTS(vts));
2073 n = vts->usedTS;
2077 ScalarTS* here = &vts->ts[i];
2101 ScalarTS* here = &vts->ts[i];
2119 ScalarTS* here2 = &vts->ts[i];
2126 tl_assert(out->usedTS == vts->usedTS + (found ? 0 : 1));
2131 /* Return a new VTS constructed as the join (max) of the 2 args.
2134 static void VTS__join ( /*OUT*/VTS* out, VTS* a, VTS* b )
2237 static UInt/*ThrID*/ VTS__cmpLEQ ( VTS* a, VTS* b )
2330 Word VTS__cmp_structural ( VTS* a, VTS* b )
2383 /* Debugging only. Display the given VTS in the buffer.
2385 void VTS__show ( HChar* buf, Int nBuf, VTS* vts )
2391 tl_assert(vts && vts->ts);
2395 n = vts->usedTS;
2398 st = &vts->ts[i];
2415 /* Debugging only. Return vts[index], so to speak.
2417 ULong VTS__indexAt_SLOW ( VTS* vts, Thr* idx )
2422 tl_assert(vts && vts->ts);
2423 n = vts->usedTS;
2425 ScalarTS* st = &vts->ts[i];
2462 // SECTION END vts primitives //
2480 // VTS set //
2484 static WordFM* /* WordFM VTS* void */ vts_set = NULL;
2495 /* Given a VTS, look in vts_set to see if we already have a
2499 static Bool vts_set__find__or__clone_and_add ( /*OUT*/VTS** res, VTS* cand )
2510 *res = (VTS*)keyW;
2515 VTS* clone = VTS__clone( "libhb.vts_set_focaa.1", cand );
2526 // VTS table //
2532 /* A type to hold VTS table entries. Invariants:
2533 If .vts == NULL, then this entry is not in use, so:
2537 If .vts != NULL, then this entry is in use:
2538 - .vts is findable in vts_set
2539 - .vts->id == this entry number
2545 VTS* vts; /* vts, in vts_set */
2552 /* The VTS table. */
2555 /* An index into the VTS table, indicating the start of the list of
2579 tl_assert(ie->vts == NULL);
2596 tl_assert(ie->vts == NULL);
2611 te.vts = NULL;
2626 tl_assert(ie->vts); /* else it's not in use */
2628 tl_assert(ie->vts->id == ii);
2638 tl_assert(ie->vts); /* else it's not in use */
2640 tl_assert(ie->vts->id == ii);
2649 static VtsID vts_tab__find__or__clone_and_add ( VTS* cand )
2651 VTS* in_tab = NULL;
2660 tl_assert(ie->vts == in_tab);
2665 ie->vts = in_tab;
2686 if (ie->vts) {
2746 /* ---------- BEGIN VTS GC ---------- */
2773 if (te->vts == NULL) {
2780 tl_assert(te->vts->id == i);
2783 &oldK, &oldV, (UWord)te->vts );
2786 tl_assert(oldK == (UWord)te->vts); /* else what did delFromFM find?! */
2787 /* now free the VTS itself */
2788 VTS__delete(te->vts);
2789 te->vts = NULL;
2816 "libhb: VTS GC: #%u old size %lu live %lu (%2llu%%)\n",
2819 /* ---------- END VTS GC ---------- */
2821 /* Decide whether to do VTS pruning. We have one of three
2844 /* ---------- BEGIN VTS PRUNING ---------- */
2875 /* WordFM VTS* void */
2881 /* Visit each old VTS. For each one:
2889 VTS, new VtsID) in the tree, and set
2903 /* For each old VTS .. */
2905 VTS* old_vts = old_te->vts;
2920 VTS* new_vts = VTS__subtract("libhb.vts_tab__do_GC.new_vts",
2926 /* Get rid of the old VTS and the tree entry. It's a bit more
2930 of each VTS and hence spiking memory use. */
2937 /* now free the VTS itself */
2939 old_te->vts = NULL;
2948 VTS* identical_version = NULL;
2966 new_te.vts = new_vts;
2982 * the old VTS table, with its .remap entries set,
2983 and with all .vts == NULL.
2984 * the old VTS tree should be empty, since it and the old VTSs
2987 * the new VTS table, with all .rc == 0, all .freelink and .remap
2989 * the new VTS tree.
3071 tl_assert(te->vts == NULL);
3101 VTS* vts = (VTS*)wordK;
3102 tl_assert(vts->id != VtsID_INVALID);
3103 VtsTE* te = VG_(indexXA)( vts_tab, vts->id );
3104 tl_assert(te->vts == vts);
3113 tl_assert(te->vts);
3114 tl_assert(te->vts->id == i);
3126 "libhb: VTS PR: #%u before %lu (avg sz %lu) "
3138 /* ---------- END VTS PRUNING ---------- */
3144 // Vts IDs //
3149 /* A temporary, max-sized VTS which is used as a temporary (the first
3151 static VTS* temp_max_sized_VTS = NULL;
3198 // if (!ve->vts)
3200 // tl_assert(ve->vts->id == vi);
3204 static VTS* VtsID__to_VTS ( VtsID vi ) {
3206 tl_assert(te->vts);
3207 return te->vts;
3212 VTS* vts = VtsID__to_VTS(vi);
3213 VTS__show( buf, sizeof(buf)-1, vts );
3223 VTS *v1, *v2;
3253 VTS *vts1, *vts2;
3280 /* create a singleton VTS, namely [thr:1] */
3289 VTS* vts = VtsID__to_VTS(vi);
3291 VTS__tick(temp_max_sized_VTS, idx,vts);
3295 /* index into a VTS (only for assertions) */
3297 VTS* vts = VtsID__to_VTS(vi);
3298 return VTS__indexAt_SLOW( vts, idx );
3308 VTS *vts1, *vts2;
5005 /* We can't indefinitely collect stack traces at VTS
6207 VTS singleton, tick and join operations. */
6385 VG_(printf)("sizeof(VTS) = %lu\n", sizeof(VTS));
6417 /* Tell the VTS mechanism this thread has exited, so it can
6418 participate in VTS pruning. Note this can only happen if the
6449 a Seg that points at a VTS is its one-and-only owner, and ditto for
6450 a SO that points at a VTS. */
6568 /* Deal with degenerate case: 'so' has no vts, so there has been