MCPcopy Create free account
hub / github.com/boostorg/build / GC_add_map_entry

Function GC_add_map_entry

v2/engine/boehm_gc/obj_map.c:51–76  ·  view source on GitHub ↗

Add a heap block map for objects of size granules to obj_map. */ Return FALSE on failure. */ A size of 0 granules is used for large objects. */

Source from the content-addressed store, hash-verified

49/* Return FALSE on failure. */
50/* A size of 0 granules is used for large objects. */
51GC_bool GC_add_map_entry(size_t granules)
52{
53 unsigned displ;
54 short * new_map;
55
56 if (granules > BYTES_TO_GRANULES(MAXOBJBYTES)) granules = 0;
57 if (GC_obj_map[granules] != 0) {
58 return(TRUE);
59 }
60 new_map = (short *)GC_scratch_alloc(MAP_LEN * sizeof(short));
61 if (new_map == 0) return(FALSE);
62 if (GC_print_stats)
63 GC_printf("Adding block map for size of %u granules (%u bytes)\n",
64 (unsigned)granules, (unsigned)(GRANULES_TO_BYTES(granules)));
65 if (granules == 0) {
66 for (displ = 0; displ < BYTES_TO_GRANULES(HBLKSIZE); displ++) {
67 new_map[displ] = 1; /* Nonzero to get us out of marker fast path. */
68 }
69 } else {
70 for (displ = 0; displ < BYTES_TO_GRANULES(HBLKSIZE); displ++) {
71 new_map[displ] = (short)(displ % granules);
72 }
73 }
74 GC_obj_map[granules] = new_map;
75 return(TRUE);
76}
77#endif
78
79static GC_bool offsets_initialized = FALSE;

Callers 1

setup_headerFunction · 0.85

Calls 2

GC_scratch_allocFunction · 0.85
GC_printfFunction · 0.85

Tested by

no test coverage detected