Lines Matching refs:segment

114 	rtl_arena_segment_type * segment = (rtl_arena_segment_type*)(obj);  in rtl_arena_segment_constructor()  local
116 QUEUE_START_NAMED(segment, s); in rtl_arena_segment_constructor()
117 QUEUE_START_NAMED(segment, f); in rtl_arena_segment_constructor()
131 rtl_arena_segment_type * segment = (rtl_arena_segment_type*)(obj); in rtl_arena_segment_destructor()
133 OSL_ASSERT(QUEUE_STARTED_NAMED(segment, s)); in rtl_arena_segment_destructor()
134 OSL_ASSERT(QUEUE_STARTED_NAMED(segment, f)); in rtl_arena_segment_destructor()
251 rtl_arena_segment_type * segment in rtl_arena_freelist_insert() argument
256 head = &(arena->m_freelist_head[highbit(segment->m_size) - 1]); in rtl_arena_freelist_insert()
257 QUEUE_INSERT_TAIL_NAMED(head, segment, f); in rtl_arena_freelist_insert()
274 rtl_arena_segment_type * segment in rtl_arena_freelist_remove() argument
277 if ((segment->m_fnext->m_type == RTL_ARENA_SEGMENT_TYPE_HEAD) && in rtl_arena_freelist_remove()
278 (segment->m_fprev->m_type == RTL_ARENA_SEGMENT_TYPE_HEAD) ) in rtl_arena_freelist_remove()
282 head = segment->m_fprev; in rtl_arena_freelist_remove()
286 QUEUE_REMOVE_NAMED(segment, f); in rtl_arena_freelist_remove()
395 rtl_arena_segment_type * segment in rtl_arena_hash_insert() argument
400 ppSegment = &(arena->m_hash_table[RTL_ARENA_HASH_INDEX(arena, segment->m_addr)]); in rtl_arena_hash_insert()
402 segment->m_fnext = (*ppSegment); in rtl_arena_hash_insert()
403 (*ppSegment) = segment; in rtl_arena_hash_insert()
406 arena->m_stats.m_mem_alloc += segment->m_size; in rtl_arena_hash_insert()
424 rtl_arena_segment_type *segment, **segpp; in rtl_arena_hash_remove() local
432 while ((segment = *segpp) != NULL) in rtl_arena_hash_remove()
434 if (segment->m_addr == addr) in rtl_arena_hash_remove()
436 *segpp = segment->m_fnext, segment->m_fnext = segment->m_fprev = segment; in rtl_arena_hash_remove()
442 segpp = &(segment->m_fnext); in rtl_arena_hash_remove()
445 OSL_POSTCOND(segment != NULL, "rtl_arena_hash_remove(): bad free."); in rtl_arena_hash_remove()
446 if (segment != NULL) in rtl_arena_hash_remove()
448 OSL_POSTCOND(segment->m_size == size, "rtl_arena_hash_remove(): wrong size."); in rtl_arena_hash_remove()
451 arena->m_stats.m_mem_alloc -= segment->m_size; in rtl_arena_hash_remove()
473 return (segment); in rtl_arena_hash_remove()
500 rtl_arena_segment_type *head, *segment; in rtl_arena_segment_alloc() local
503 for (segment = head->m_fnext; segment != head; segment = segment->m_fnext) in rtl_arena_segment_alloc()
505 if (segment->m_size >= size) in rtl_arena_segment_alloc()
508 (*ppSegment) = segment; in rtl_arena_segment_alloc()
604 rtl_arena_segment_type * segment in rtl_arena_segment_coalesce() argument
610 OSL_ASSERT(segment->m_type == RTL_ARENA_SEGMENT_TYPE_USED); in rtl_arena_segment_coalesce()
611 segment->m_type = RTL_ARENA_SEGMENT_TYPE_FREE; in rtl_arena_segment_coalesce()
614 next = segment->m_snext; in rtl_arena_segment_coalesce()
617 OSL_ASSERT(segment->m_addr + segment->m_size == next->m_addr); in rtl_arena_segment_coalesce()
618 segment->m_size += next->m_size; in rtl_arena_segment_coalesce()
631 prev = segment->m_sprev; in rtl_arena_segment_coalesce()
634 OSL_ASSERT(prev->m_addr + prev->m_size == segment->m_addr); in rtl_arena_segment_coalesce()
635 segment->m_addr = prev->m_addr; in rtl_arena_segment_coalesce()
636 segment->m_size += prev->m_size; in rtl_arena_segment_coalesce()
805 rtl_arena_segment_type * head, * segment; in rtl_arena_deactivate() local
855 while ((segment = arena->m_hash_table[i]) != NULL) in rtl_arena_deactivate()
858 arena->m_hash_table[i] = segment->m_fnext, segment->m_fnext = segment->m_fprev = segment; in rtl_arena_deactivate()
861 rtl_arena_segment_coalesce (arena, segment); in rtl_arena_deactivate()
864 rtl_arena_freelist_insert (arena, segment); in rtl_arena_deactivate()
884 for (segment = head->m_snext; segment != head; segment = head->m_snext) in rtl_arena_deactivate()
886 if (segment->m_type == RTL_ARENA_SEGMENT_TYPE_FREE) in rtl_arena_deactivate()
889 rtl_arena_freelist_remove (arena, segment); in rtl_arena_deactivate()
894 OSL_ASSERT(segment->m_type == RTL_ARENA_SEGMENT_TYPE_SPAN); in rtl_arena_deactivate()
898 QUEUE_REMOVE_NAMED(segment, s); in rtl_arena_deactivate()
901 rtl_arena_segment_put (arena, &segment); in rtl_arena_deactivate()
906 for (segment = head->m_snext; segment != head; segment = head->m_snext) in rtl_arena_deactivate()
909 QUEUE_REMOVE_NAMED(segment, s); in rtl_arena_deactivate()
914 for (segment = head->m_snext; segment != head; segment = head->m_snext) in rtl_arena_deactivate()
917 OSL_ASSERT(segment->m_type == RTL_ARENA_SEGMENT_TYPE_SPAN); in rtl_arena_deactivate()
920 QUEUE_REMOVE_NAMED(segment, s); in rtl_arena_deactivate()
923 rtl_machdep_free (gp_machdep_arena, (void*)(segment->m_addr), segment->m_size); in rtl_arena_deactivate()
1026 rtl_arena_segment_type *segment = 0; in rtl_arena_alloc() local
1029 if (rtl_arena_segment_alloc (arena, size, &segment) || in rtl_arena_alloc()
1030 rtl_arena_segment_create(arena, size, &segment) ) in rtl_arena_alloc()
1036 OSL_ASSERT(segment->m_type == RTL_ARENA_SEGMENT_TYPE_FREE); in rtl_arena_alloc()
1037 segment->m_type = RTL_ARENA_SEGMENT_TYPE_USED; in rtl_arena_alloc()
1040 OSL_ASSERT(segment->m_size >= size); in rtl_arena_alloc()
1041 oversize = segment->m_size - size; in rtl_arena_alloc()
1048 segment->m_size = size; in rtl_arena_alloc()
1050 remainder->m_addr = segment->m_addr + segment->m_size; in rtl_arena_alloc()
1053 QUEUE_INSERT_HEAD_NAMED(segment, remainder, s); in rtl_arena_alloc()
1059 rtl_arena_hash_insert (arena, segment); in rtl_arena_alloc()
1062 OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x77777777, segment->m_size)); in rtl_arena_alloc()
1063 VALGRIND_MEMPOOL_ALLOC(arena, segment->m_addr, segment->m_size); in rtl_arena_alloc()
1065 (*pSize) = segment->m_size; in rtl_arena_alloc()
1066 addr = (void*)(segment->m_addr); in rtl_arena_alloc()
1099 rtl_arena_segment_type * segment; in rtl_arena_free() local
1103 segment = rtl_arena_hash_remove (arena, (sal_uIntPtr)(addr), size); in rtl_arena_free()
1104 if (segment != 0) in rtl_arena_free()
1109 VALGRIND_MEMPOOL_FREE(arena, segment->m_addr); in rtl_arena_free()
1110 … /* OSL_DEBUG_ONLY() */ VALGRIND_MAKE_MEM_UNDEFINED(segment->m_addr, segment->m_size); in rtl_arena_free()
1111 OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x33333333, segment->m_size)); in rtl_arena_free()
1114 rtl_arena_segment_coalesce (arena, segment); in rtl_arena_free()
1117 next = segment->m_snext, prev = segment->m_sprev; in rtl_arena_free()
1124 OSL_ASSERT((prev->m_addr == segment->m_addr) && in rtl_arena_free()
1125 (prev->m_size == segment->m_size) ); in rtl_arena_free()
1133 QUEUE_REMOVE_NAMED(segment, s); in rtl_arena_free()
1136 rtl_arena_segment_put (arena, &segment); in rtl_arena_free()
1154 rtl_arena_freelist_insert (arena, segment); in rtl_arena_free()