Lines Matching defs:sm
520 static inline Bool is_sane_SecMap ( SecMap* sm ) {
521 return sm != NULL && sm->magic == SecMap_MAGIC;
557 static UWord stats__secmaps_search = 0; // # SM finds
558 static UWord stats__secmaps_search_slow = 0; // # SM lookupFMs
662 SecMap* sm = shmem__bigchunk_alloc( sizeof(SecMap) );
663 if (0) VG_(printf)("alloc_SecMap %p\n",sm);
664 tl_assert(sm);
665 sm->magic = SecMap_MAGIC;
667 sm->linesZ[i].dict[0] = SVal_NOACCESS;
668 sm->linesZ[i].dict[1] = SVal_INVALID;
669 sm->linesZ[i].dict[2] = SVal_INVALID;
670 sm->linesZ[i].dict[3] = SVal_INVALID;
672 sm->linesZ[i].ix2s[j] = 0; /* all reference dict[0] */
674 sm->linesF = NULL;
675 sm->linesF_size = 0;
680 return sm;
683 typedef struct { Addr gaKey; SecMap* sm; } SMCacheEnt;
688 SecMap* sm = NULL;
693 return smCache[0].sm;
698 return smCache[0].sm;
704 return smCache[1].sm;
709 NULL/*keyP*/, (UWord*)&sm, (UWord)gaKey )) {
710 tl_assert(sm != NULL);
714 smCache[0].sm = sm;
716 tl_assert(sm == NULL);
718 return sm;
723 SecMap* sm = shmem__find_SecMap ( ga );
724 if (LIKELY(sm)) {
725 return sm;
729 sm = shmem__alloc_SecMap();
730 tl_assert(sm);
731 VG_(addToFM)( map_shmem, (UWord)gaKey, (UWord)sm );
732 return sm;
797 SecMap* sm = shmem__find_or_alloc_SecMap(tag);
804 lineZ = &sm->linesZ[zix];
808 tl_assert(sm->linesF);
809 tl_assert(sm->linesF_size > 0);
810 tl_assert(fix >= 0 && fix < sm->linesF_size);
811 lineF = &sm->linesF[fix];
832 SecMap* sm = shmem__find_or_alloc_SecMap(tag);
839 lineZ = &sm->linesZ[zix];
846 tl_assert(sm->linesF);
847 tl_assert(sm->linesF_size > 0);
848 tl_assert(fix >= 0 && fix < sm->linesF_size);
849 lineF = &sm->linesF[fix];
856 *smp = sm;
861 void alloc_F_for_writing ( /*MOD*/SecMap* sm, /*OUT*/Word* fixp ) {
865 if (sm->linesF) {
866 tl_assert(sm->linesF_size > 0);
868 tl_assert(sm->linesF_size == 0);
871 if (sm->linesF) {
872 for (i = 0; i < sm->linesF_size; i++) {
873 if (!sm->linesF[i].inUse) {
881 new_size = sm->linesF_size==0 ? 1 : 2 * sm->linesF_size;
886 stats__secmap_linesF_allocd += (new_size - sm->linesF_size);
887 stats__secmap_linesF_bytes += (new_size - sm->linesF_size)
891 VG_(printf)("SM %p: expand F array from %d to %d\n",
892 sm, (Int)sm->linesF_size, new_size);
897 if (sm->linesF) {
898 for (i = 0; i < sm->linesF_size; i++) {
899 tl_assert(sm->linesF[i].inUse);
900 nyu[i] = sm->linesF[i];
902 VG_(memset)(sm->linesF, 0, sm->linesF_size * sizeof(LineF) );
903 HG_(free)(sm->linesF);
906 sm->linesF = nyu;
907 sm->linesF_size = new_size;
909 for (i = 0; i < sm->linesF_size; i++) {
910 if (!sm->linesF[i].inUse) {
1272 SecMap* sm;
1293 sm = NULL;
1300 find_Z_for_writing( &sm, &zix, tag );
1302 tl_assert(sm);
1304 lineZ = &sm->linesZ[zix];
1387 alloc_F_for_writing( sm, &fix );
1388 tl_assert(sm->linesF);
1389 tl_assert(sm->linesF_size > 0);
1390 tl_assert(fix >= 0 && fix < (Word)sm->linesF_size);
1391 lineF = &sm->linesF[fix];
3015 SecMap* sm = (SecMap*)secmapW;
3016 tl_assert(sm->magic == SecMap_MAGIC);
3019 LineZ* lineZ = &sm->linesZ[i];
3026 for (i = 0; i < sm->linesF_size; i++) {
3027 LineF* lineF = &sm->linesF[i];
5694 SecMap* sm;
5700 find_Z_for_writing( &sm, &zix, tag );
5701 tl_assert(sm);
5703 lineZ = &sm->linesZ[zix];