Additional provenance preservation
This commit is contained in:
@@ -363,7 +363,7 @@ namespace snmalloc
|
||||
Metaslab& meta = super->get_meta(slab);
|
||||
|
||||
sizeclass_t sc = meta.sizeclass;
|
||||
size_t slab_end = static_cast<size_t>(address_cast(slab) + SLAB_SIZE);
|
||||
void* slab_end = pointer_offset(slab, SLAB_SIZE);
|
||||
|
||||
return external_pointer<location>(p, sc, slab_end);
|
||||
}
|
||||
@@ -372,8 +372,7 @@ namespace snmalloc
|
||||
Mediumslab* slab = Mediumslab::get(p);
|
||||
|
||||
sizeclass_t sc = slab->get_sizeclass();
|
||||
size_t slab_end =
|
||||
static_cast<size_t>(address_cast(slab) + SUPERSLAB_SIZE);
|
||||
void* slab_end = pointer_offset(slab, SUPERSLAB_SIZE);
|
||||
|
||||
return external_pointer<location>(p, sc, slab_end);
|
||||
}
|
||||
@@ -755,16 +754,23 @@ namespace snmalloc
|
||||
|
||||
template<Boundary location>
|
||||
static uintptr_t
|
||||
external_pointer(void* p, sizeclass_t sizeclass, size_t end_point)
|
||||
external_pointer(void* p, sizeclass_t sizeclass, void* end_point)
|
||||
{
|
||||
size_t rsize = sizeclass_to_size(sizeclass);
|
||||
size_t end_point_correction = location == End ?
|
||||
(end_point - 1) :
|
||||
(location == OnePastEnd ? end_point : (end_point - rsize));
|
||||
size_t offset_from_end =
|
||||
(end_point - 1) - static_cast<size_t>(address_cast(p));
|
||||
size_t end_to_end = round_by_sizeclass(rsize, offset_from_end);
|
||||
return end_point_correction - end_to_end;
|
||||
|
||||
void* end_point_correction = location == End ?
|
||||
(static_cast<uint8_t*>(end_point) - 1) :
|
||||
(location == OnePastEnd ? end_point :
|
||||
(static_cast<uint8_t*>(end_point) - rsize));
|
||||
|
||||
ptrdiff_t offset_from_end =
|
||||
(static_cast<uint8_t*>(end_point) - 1) - static_cast<uint8_t*>(p);
|
||||
|
||||
size_t end_to_end =
|
||||
round_by_sizeclass(rsize, static_cast<size_t>(offset_from_end));
|
||||
|
||||
return address_cast<uint8_t>(
|
||||
static_cast<uint8_t*>(end_point_correction) - end_to_end);
|
||||
}
|
||||
|
||||
void init_message_queue()
|
||||
|
||||
Reference in New Issue
Block a user