• Home
  • Raw
  • Download

Lines Matching refs:mc

81 void delete_MC_Chunk (MC_Chunk* mc);
99 static void add_to_freed_queue ( MC_Chunk* mc ) in add_to_freed_queue() argument
102 const int l = (mc->szB >= MC_(clo_freelist_big_blocks) ? 0 : 1); in add_to_freed_queue()
109 mc->next = NULL; in add_to_freed_queue()
110 freed_list_end[l] = freed_list_start[l] = mc; in add_to_freed_queue()
113 if (mc->szB >= MC_(clo_freelist_vol)) { in add_to_freed_queue()
114 mc->next = freed_list_start[l]; in add_to_freed_queue()
115 freed_list_start[l] = mc; in add_to_freed_queue()
117 mc->next = NULL; in add_to_freed_queue()
118 freed_list_end[l]->next = mc; in add_to_freed_queue()
119 freed_list_end[l] = mc; in add_to_freed_queue()
122 VG_(free_queue_volume) += (Long)mc->szB; in add_to_freed_queue()
175 MC_Chunk* mc; in MC_() local
176 mc = freed_list_start[i]; in MC_()
177 while (mc) { in MC_()
178 if (VG_(addr_is_in_block)( a, mc->data, mc->szB, in MC_()
180 return mc; in MC_()
181 mc = mc->next; in MC_()
193 MC_Chunk* mc = VG_(allocEltPA)(MC_(chunk_poolalloc)); in create_MC_Chunk() local
194 mc->data = p; in create_MC_Chunk()
195 mc->szB = szB; in create_MC_Chunk()
196 mc->allockind = kind; in create_MC_Chunk()
198 case 2: mc->where[1] = 0; // fallback to 1 in create_MC_Chunk()
199 case 1: mc->where[0] = 0; // fallback to 0 in create_MC_Chunk()
203 MC_(set_allocated_at) (tid, mc); in create_MC_Chunk()
214 if (!MC_(check_mem_is_noaccess)( (Addr)mc, sizeof(MC_Chunk), NULL )) { in create_MC_Chunk()
217 return mc; in create_MC_Chunk()
221 void delete_MC_Chunk (MC_Chunk* mc) in delete_MC_Chunk() argument
223 VG_(freeEltPA) (MC_(chunk_poolalloc), mc); in delete_MC_Chunk()
227 static Bool in_block_list (VgHashTable block_list, MC_Chunk* mc) in in_block_list() argument
229 MC_Chunk* found_mc = VG_(HT_lookup) ( block_list, (UWord)mc->data ); in in_block_list()
231 tl_assert (found_mc->data == mc->data); in in_block_list()
241 if (found_mc->szB != mc->szB in in_block_list()
242 || found_mc->allockind != mc->allockind) in in_block_list()
244 tl_assert (found_mc == mc); in in_block_list()
251 static Bool live_block (MC_Chunk* mc) in live_block() argument
253 if (mc->allockind == MC_AllocCustom) { in live_block()
257 if ( in_block_list (mp->chunks, mc) ) in live_block()
264 return in_block_list ( MC_(malloc_list), mc ); in live_block()
267 ExeContext* MC_(allocated_at) (MC_Chunk* mc) in MC_()
271 case KS_alloc: return mc->where[0]; in MC_()
273 case KS_alloc_then_free: return (live_block(mc) ? in MC_()
274 mc->where[0] : VG_(null_ExeContext) ()); in MC_()
275 case KS_alloc_and_free: return mc->where[0]; in MC_()
280 ExeContext* MC_(freed_at) (MC_Chunk* mc) in MC_()
285 case KS_free: return (mc->where[0] ? in MC_()
286 mc->where[0] : VG_(null_ExeContext) ()); in MC_()
287 case KS_alloc_then_free: return (live_block(mc) ? in MC_()
288 VG_(null_ExeContext) () : mc->where[0]); in MC_()
289 case KS_alloc_and_free: return (mc->where[1] ? in MC_()
290 mc->where[1] : VG_(null_ExeContext) ()); in MC_()
295 void MC_(set_allocated_at) (ThreadId tid, MC_Chunk* mc) in MC_()
305 mc->where[0] = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ ); in MC_()
308 void MC_(set_freed_at) (ThreadId tid, MC_Chunk* mc) in MC_()
319 mc->where[pos] = VG_(record_ExeContext) ( tid, 0/*first_ip_delta*/ ); in MC_()
370 MC_Chunk* mc; in MC_() local
393 mc = create_MC_Chunk (tid, p, szB, kind); in MC_()
394 VG_(HT_add_node)( table, mc ); in MC_()
399 UInt ecu = VG_(get_ECU_from_ExeContext)(MC_(allocated_at)(mc)); in MC_()
458 void die_and_free_mem ( ThreadId tid, MC_Chunk* mc, SizeT rzB ) in die_and_free_mem() argument
462 if (MC_(clo_free_fill) != -1 && MC_AllocCustom != mc->allockind ) { in die_and_free_mem()
464 VG_(memset)((void*)mc->data, MC_(clo_free_fill), mc->szB); in die_and_free_mem()
469 MC_(make_mem_noaccess)( mc->data-rzB, mc->szB + 2*rzB ); in die_and_free_mem()
472 MC_(set_freed_at) (tid, mc); in die_and_free_mem()
474 add_to_freed_queue ( mc ); in die_and_free_mem()
483 void record_freemismatch_error (ThreadId tid, MC_Chunk* mc) in record_freemismatch_error() argument
491 VG_(HT_add_node)( MC_(malloc_list), mc ); in record_freemismatch_error()
492 MC_(record_freemismatch_error) ( tid, mc ); in record_freemismatch_error()
493 if ((mc != VG_(HT_remove) ( MC_(malloc_list), (UWord)mc->data ))) in record_freemismatch_error()
499 MC_Chunk* mc; in MC_() local
503 mc = VG_(HT_remove) ( MC_(malloc_list), (UWord)p ); in MC_()
504 if (mc == NULL) { in MC_()
508 if (kind != mc->allockind) { in MC_()
509 tl_assert(p == mc->data); in MC_()
510 record_freemismatch_error ( tid, mc ); in MC_()
512 die_and_free_mem ( tid, mc, rzB ); in MC_()
650 MC_Chunk* mc = VG_(HT_lookup) ( MC_(malloc_list), (UWord)p ); in MC_() local
654 return ( mc ? mc->szB : 0 ); in MC_()
664 MC_Chunk* mc = VG_(HT_lookup) ( MC_(malloc_list), (UWord)p ); in MC_() local
665 if (!mc || mc->szB != oldSizeB || newSizeB == 0) { in MC_()
675 mc->szB = newSizeB; in MC_()
737 MC_Chunk* mc; in MC_() local
757 while ( (mc = VG_(HT_Next)(mp->chunks)) ) { in MC_()
760 MC_(make_mem_noaccess)(mc->data-mp->rzB, mc->szB + 2*mp->rzB ); in MC_()
886 MC_Chunk* mc; in MC_() local
901 mc = VG_(HT_remove)(mp->chunks, (UWord)addr); in MC_()
902 if (mc == NULL) { in MC_()
910 pool, addr, mc->szB + 0UL); in MC_()
913 die_and_free_mem ( tid, mc, mp->rzB ); in MC_()
921 MC_Chunk* mc; in MC_() local
950 mc = (MC_Chunk*) chunks[i]; in MC_()
952 lo = mc->data; in MC_()
953 hi = mc->szB == 0 ? mc->data : mc->data + mc->szB - 1; in MC_()
970 if (VG_(HT_remove)(mp->chunks, (UWord)mc->data) == NULL) { in MC_()
971 MC_(record_free_error)(tid, (Addr)mc->data); in MC_()
976 die_and_free_mem ( tid, mc, mp->rzB ); in MC_()
985 if (VG_(HT_remove)(mp->chunks, (UWord)mc->data) == NULL) { in MC_()
986 MC_(record_free_error)(tid, (Addr)mc->data); in MC_()
992 if (mc->data < addr) { in MC_()
993 min = mc->data; in MC_()
997 lo = mc->data; in MC_()
1000 if (mc->data + szB > addr + szB) { in MC_()
1001 max = mc->data + szB; in MC_()
1005 hi = mc->data + szB; in MC_()
1020 mc->data = lo; in MC_()
1021 mc->szB = (UInt) (hi - lo); in MC_()
1022 VG_(HT_add_node)( mp->chunks, mc ); in MC_()
1057 MC_Chunk* mc; in MC_() local
1074 mc = VG_(HT_remove)(mp->chunks, (UWord)addrA); in MC_()
1075 if (mc == NULL) { in MC_()
1080 mc->data = addrB; in MC_()
1081 mc->szB = szB; in MC_()
1082 VG_(HT_add_node)( mp->chunks, mc ); in MC_()
1105 MC_Chunk* mc; in MC_() local
1116 while ( (mc = VG_(HT_Next)(MC_(malloc_list))) ) { in MC_()
1118 nbytes += (ULong)mc->szB; in MC_()