Diff
Modified: trunk/Source/bmalloc/ChangeLog (287382 => 287383)
--- trunk/Source/bmalloc/ChangeLog 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/ChangeLog 2021-12-23 04:04:25 UTC (rev 287383)
@@ -1,3 +1,69 @@
+2021-12-22 Yusuke Suzuki <[email protected]>
+
+ [libpas] Make pas_heap_type constant
+ https://bugs.webkit.org/show_bug.cgi?id=234486
+
+ Reviewed by Filip Pizlo.
+
+ Currently, pas_heap_type data is placed in __DATA segment since it is not constant.
+ But they are actually a constant value, so we should put them in __DATA_CONST segment.
+
+ Still, we can have mutable type information if we want: we can const-cast the type
+ in each derived pas_heap_type's functions (and we should define these types with non
+ constant way). But currently, we have no such a type.
+
+ * bmalloc/IsoHeap.h:
+ (bmalloc::api::IsoHeap::provideHeap):
+ * bmalloc/bmalloc.cpp:
+ (bmalloc::api::mallocOutOfLine):
+ * libpas/src/libpas/bmalloc_heap.c:
+ * libpas/src/libpas/bmalloc_heap_innards.h:
+ * libpas/src/libpas/bmalloc_heap_ref.h:
+ * libpas/src/libpas/bmalloc_type.c:
+ (bmalloc_type_dump):
+ (bmalloc_type_as_heap_type_dump):
+ * libpas/src/libpas/bmalloc_type.h:
+ (bmalloc_type_size):
+ (bmalloc_type_alignment):
+ (bmalloc_type_name):
+ (bmalloc_type_as_heap_type_get_type_size):
+ (bmalloc_type_as_heap_type_get_type_alignment):
+ * libpas/src/libpas/iso_heap.c:
+ (iso_heap_ref_construct):
+ (iso_primitive_heap_ref_construct):
+ * libpas/src/libpas/iso_heap_ref.h:
+ * libpas/src/libpas/jit_heap_config.c:
+ (jit_type_dump):
+ * libpas/src/libpas/jit_heap_config.h:
+ (jit_type_size):
+ (jit_type_alignment):
+ * libpas/src/libpas/pas_heap.h:
+ * libpas/src/libpas/pas_heap_config.h:
+ * libpas/src/libpas/pas_heap_ref_prefix.h:
+ * libpas/src/libpas/pas_large_heap.c:
+ (allocate_impl):
+ (pas_large_heap_try_shrink):
+ * libpas/src/libpas/pas_simple_type.c:
+ (pas_simple_type_as_heap_type_dump):
+ * libpas/src/libpas/pas_simple_type.h:
+ (pas_simple_type_get_key_data):
+ (pas_simple_type_create_with_key_data):
+ (pas_simple_type_as_heap_type_get_type_size):
+ (pas_simple_type_as_heap_type_get_type_alignment):
+ * libpas/src/libpas/pas_try_allocate.h:
+ (pas_try_allocate_impl_casual_case):
+ * libpas/src/libpas/pas_try_allocate_array.h:
+ * libpas/src/libpas/pas_try_allocate_common.h:
+ (pas_try_allocate_common_impl_slow):
+ * libpas/src/libpas/pas_try_allocate_intrinsic.h:
+ * libpas/src/libpas/pas_try_reallocate.h:
+ (pas_try_reallocate_array_by_count):
+ * libpas/src/test/ExpendableMemoryTests.cpp:
+ * libpas/src/test/IsoHeapChaosTests.cpp:
+ (std::addAllTests):
+ * libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp:
+ (std::createIsolatedHeapRef):
+
2021-12-19 Yusuke Suzuki <[email protected]>
[libpas] Add macros to disable bmalloc core so that libpas can be enabled on 64-bit watchOS
Modified: trunk/Source/bmalloc/bmalloc/IsoHeap.h (287382 => 287383)
--- trunk/Source/bmalloc/bmalloc/IsoHeap.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/bmalloc/IsoHeap.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -91,7 +91,7 @@
static pas_heap_ref& provideHeap()
{
- static bmalloc_type type = BMALLOC_TYPE_INITIALIZER(sizeof(LibPasBmallocHeapType), alignof(LibPasBmallocHeapType), __PRETTY_FUNCTION__);
+ static const bmalloc_type type = BMALLOC_TYPE_INITIALIZER(sizeof(LibPasBmallocHeapType), alignof(LibPasBmallocHeapType), __PRETTY_FUNCTION__);
static pas_heap_ref heap = BMALLOC_HEAP_REF_INITIALIZER(&type);
return heap;
}
Modified: trunk/Source/bmalloc/bmalloc/bmalloc.cpp (287382 => 287383)
--- trunk/Source/bmalloc/bmalloc/bmalloc.cpp 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/bmalloc/bmalloc.cpp 2021-12-23 04:04:25 UTC (rev 287383)
@@ -40,8 +40,8 @@
#if BUSE(LIBPAS)
namespace {
-bmalloc_type primitiveGigacageType = BMALLOC_TYPE_INITIALIZER(1, 1, "Primitive Gigacage");
-bmalloc_type jsValueGigacageType = BMALLOC_TYPE_INITIALIZER(1, 1, "JSValue Gigacage");
+static const bmalloc_type primitiveGigacageType = BMALLOC_TYPE_INITIALIZER(1, 1, "Primitive Gigacage");
+static const bmalloc_type jsValueGigacageType = BMALLOC_TYPE_INITIALIZER(1, 1, "JSValue Gigacage");
} // anonymous namespace
pas_primitive_heap_ref gigacageHeaps[Gigacage::NumberOfKinds] = {
Modified: trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap.c (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap.c 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap.c 2021-12-23 04:04:25 UTC (rev 287383)
@@ -38,7 +38,7 @@
PAS_BEGIN_EXTERN_C;
-bmalloc_type bmalloc_common_primitive_type = BMALLOC_TYPE_INITIALIZER(1, 1, "Common Primitive");
+const bmalloc_type bmalloc_common_primitive_type = BMALLOC_TYPE_INITIALIZER(1, 1, "Common Primitive");
pas_intrinsic_heap_support bmalloc_common_primitive_heap_support =
PAS_INTRINSIC_HEAP_SUPPORT_INITIALIZER;
Modified: trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_innards.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_innards.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_innards.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -37,7 +37,7 @@
PAS_BEGIN_EXTERN_C;
-PAS_API extern bmalloc_type bmalloc_common_primitive_type;
+PAS_API extern const bmalloc_type bmalloc_common_primitive_type;
PAS_API extern pas_heap bmalloc_common_primitive_heap;
PAS_API extern pas_intrinsic_heap_support bmalloc_common_primitive_heap_support;
PAS_API extern pas_allocator_counts bmalloc_allocator_counts;
Modified: trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_ref.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_ref.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_ref.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -33,7 +33,7 @@
#define BMALLOC_HEAP_REF_INITIALIZER(passed_type) \
((pas_heap_ref){ \
- .type = (pas_heap_type*)(passed_type), \
+ .type = (const pas_heap_type*)(passed_type), \
.heap = NULL, \
.allocator_index = 0 \
})
Modified: trunk/Source/bmalloc/libpas/src/libpas/bmalloc_type.c (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/bmalloc_type.c 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/bmalloc_type.c 2021-12-23 04:04:25 UTC (rev 287383)
@@ -102,7 +102,7 @@
pas_stream_printf(stream, "%s", name);
}
-void bmalloc_type_dump(bmalloc_type* type, pas_stream* stream)
+void bmalloc_type_dump(const bmalloc_type* type, pas_stream* stream)
{
pas_stream_printf(
stream, "Size = %zu, Alignment = %zu, Type = ",
@@ -111,9 +111,9 @@
bmalloc_type_name_dump(stream, bmalloc_type_name(type));
}
-void bmalloc_type_as_heap_type_dump(pas_heap_type* type, pas_stream* stream)
+void bmalloc_type_as_heap_type_dump(const pas_heap_type* type, pas_stream* stream)
{
- bmalloc_type_dump((bmalloc_type*)type, stream);
+ bmalloc_type_dump((const bmalloc_type*)type, stream);
}
#endif /* LIBPAS_ENABLED */
Modified: trunk/Source/bmalloc/libpas/src/libpas/bmalloc_type.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/bmalloc_type.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/bmalloc_type.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -48,17 +48,17 @@
/* It's a bit better to use these getters instead of accessing the type struct directly because we want to be
able to change the shape of the struct. */
-static inline size_t bmalloc_type_size(bmalloc_type* type)
+static inline size_t bmalloc_type_size(const bmalloc_type* type)
{
return type->size;
}
-static inline size_t bmalloc_type_alignment(bmalloc_type* type)
+static inline size_t bmalloc_type_alignment(const bmalloc_type* type)
{
return type->alignment;
}
-static inline const char* bmalloc_type_name(bmalloc_type* type)
+static inline const char* bmalloc_type_name(const bmalloc_type* type)
{
return type->name;
}
@@ -68,19 +68,19 @@
PAS_API bool bmalloc_type_try_name_dump(pas_stream* stream, const char* name);
PAS_API void bmalloc_type_name_dump(pas_stream* stream, const char* name);
-PAS_API void bmalloc_type_dump(bmalloc_type* type, pas_stream* stream);
+PAS_API void bmalloc_type_dump(const bmalloc_type* type, pas_stream* stream);
-static inline size_t bmalloc_type_as_heap_type_get_type_size(pas_heap_type* type)
+static inline size_t bmalloc_type_as_heap_type_get_type_size(const pas_heap_type* type)
{
- return bmalloc_type_size((bmalloc_type*)type);
+ return bmalloc_type_size((const bmalloc_type*)type);
}
-static inline size_t bmalloc_type_as_heap_type_get_type_alignment(pas_heap_type* type)
+static inline size_t bmalloc_type_as_heap_type_get_type_alignment(const pas_heap_type* type)
{
- return bmalloc_type_alignment((bmalloc_type*)type);
+ return bmalloc_type_alignment((const bmalloc_type*)type);
}
-PAS_API void bmalloc_type_as_heap_type_dump(pas_heap_type* type, pas_stream* stream);
+PAS_API void bmalloc_type_as_heap_type_dump(const pas_heap_type* type, pas_stream* stream);
PAS_END_EXTERN_C;
Modified: trunk/Source/bmalloc/libpas/src/libpas/iso_heap.c (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/iso_heap.c 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/iso_heap.c 2021-12-23 04:04:25 UTC (rev 287383)
@@ -144,7 +144,7 @@
void iso_heap_ref_construct(pas_heap_ref* heap_ref,
pas_simple_type type)
{
- heap_ref->type = (pas_heap_type*)type;
+ heap_ref->type = (const pas_heap_type*)type;
heap_ref->heap = NULL;
heap_ref->allocator_index = 0;
}
@@ -204,7 +204,7 @@
{
PAS_ASSERT(pas_simple_type_size(type) == 1);
PAS_ASSERT(pas_simple_type_alignment(type) == 1);
- heap_ref->base.type = (pas_heap_type*)type;
+ heap_ref->base.type = (const pas_heap_type*)type;
heap_ref->base.heap = NULL;
heap_ref->base.allocator_index = 0;
heap_ref->cached_index = UINT_MAX;
Modified: trunk/Source/bmalloc/libpas/src/libpas/iso_heap_ref.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/iso_heap_ref.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/iso_heap_ref.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -36,7 +36,7 @@
#define ISO_HEAP_REF_INITIALIZER_WITH_ALIGNMENT(type_size, alignment) \
((pas_heap_ref){ \
- .type = (pas_heap_type*)PAS_SIMPLE_TYPE_CREATE((type_size), (alignment)), \
+ .type = (const pas_heap_type*)PAS_SIMPLE_TYPE_CREATE((type_size), (alignment)), \
.heap = NULL, \
ISO_HEAP_REF_INITIALIZER_TLC_PART \
})
Modified: trunk/Source/bmalloc/libpas/src/libpas/jit_heap_config.c (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/jit_heap_config.c 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/jit_heap_config.c 2021-12-23 04:04:25 UTC (rev 287383)
@@ -45,7 +45,7 @@
PAS_BEGIN_EXTERN_C;
-void jit_type_dump(pas_heap_type* type, pas_stream* stream)
+void jit_type_dump(const pas_heap_type* type, pas_stream* stream)
{
PAS_ASSERT(!type);
pas_stream_printf(stream, "JIT");
Modified: trunk/Source/bmalloc/libpas/src/libpas/jit_heap_config.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/jit_heap_config.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/jit_heap_config.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -51,18 +51,18 @@
PAS_API void jit_heap_config_activate(void);
-static PAS_ALWAYS_INLINE size_t jit_type_size(pas_heap_type* type)
+static PAS_ALWAYS_INLINE size_t jit_type_size(const pas_heap_type* type)
{
PAS_TESTING_ASSERT(!type);
return 1;
}
-static PAS_ALWAYS_INLINE size_t jit_type_alignment(pas_heap_type* type)
+static PAS_ALWAYS_INLINE size_t jit_type_alignment(const pas_heap_type* type)
{
PAS_TESTING_ASSERT(!type);
return 1;
}
-PAS_API void jit_type_dump(pas_heap_type* type, pas_stream* stream);
+PAS_API void jit_type_dump(const pas_heap_type* type, pas_stream* stream);
PAS_API pas_page_base* jit_page_header_for_boundary_remote(pas_enumerator* enumerator, void* boundary);
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_heap.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_heap.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_heap.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -45,7 +45,7 @@
struct pas_heap {
pas_segregated_heap segregated_heap;
pas_large_heap large_heap;
- pas_heap_type* type;
+ const pas_heap_type* type;
pas_heap_ref* heap_ref;
pas_compact_heap_ptr next_heap;
pas_heap_config_kind config_kind : 6;
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_heap_config.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_heap_config.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_heap_config.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -63,9 +63,9 @@
typedef void (*pas_heap_config_activate_callback)(void);
-typedef size_t (*pas_heap_config_get_type_size)(pas_heap_type*);
-typedef size_t (*pas_heap_config_get_type_alignment)(pas_heap_type*);
-typedef void (*pas_heap_config_dump_type)(pas_heap_type*, pas_stream* stream);
+typedef size_t (*pas_heap_config_get_type_size)(const pas_heap_type*);
+typedef size_t (*pas_heap_config_get_type_alignment)(const pas_heap_type*);
+typedef void (*pas_heap_config_dump_type)(const pas_heap_type*, pas_stream* stream);
typedef pas_fast_megapage_kind (*pas_heap_config_fast_megapage_kind_func)(uintptr_t begin);
typedef pas_page_base* (*pas_heap_config_page_header_func)(uintptr_t begin);
typedef pas_aligned_allocation_result (*pas_heap_config_aligned_allocator)(
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_heap_ref_prefix.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_heap_ref_prefix.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_heap_ref_prefix.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -33,7 +33,7 @@
typedef struct __pas_heap __pas_heap;
struct __pas_heap_ref {
- __pas_heap_type* type;
+ const __pas_heap_type* type;
__pas_heap* heap; /* initialize to NULL */
unsigned allocator_index; /* initialize to 0 */
};
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_large_heap.c (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_large_heap.c 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_large_heap.c 2021-12-23 04:04:25 UTC (rev 287383)
@@ -97,7 +97,7 @@
static const bool verbose = false;
pas_allocation_result result;
- pas_heap_type* type;
+ const pas_heap_type* type;
pas_large_free_heap_config config;
aligned_allocator_data data;
@@ -227,7 +227,7 @@
pas_large_map_entry map_entry;
pas_large_free_heap_config config;
pas_large_heap* heap;
- pas_heap_type* type;
+ const pas_heap_type* type;
size_t alignment;
pas_heap_lock_assert_held();
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_simple_type.c (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_simple_type.c 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_simple_type.c 2021-12-23 04:04:25 UTC (rev 287383)
@@ -41,7 +41,7 @@
pas_stream_printf(stream, ", Key = %p", pas_simple_type_key(type));
}
-void pas_simple_type_as_heap_type_dump(pas_heap_type* type, pas_stream* stream)
+void pas_simple_type_as_heap_type_dump(const pas_heap_type* type, pas_stream* stream)
{
pas_simple_type_dump((pas_simple_type)type, stream);
}
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_simple_type.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_simple_type.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_simple_type.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -73,10 +73,10 @@
return type >> PAS_SIMPLE_TYPE_DATA_BIT;
}
-static inline pas_simple_type_with_key_data* pas_simple_type_get_key_data(pas_simple_type type)
+static inline const pas_simple_type_with_key_data* pas_simple_type_get_key_data(pas_simple_type type)
{
PAS_ASSERT(pas_simple_type_has_key(type));
- return (pas_simple_type_with_key_data*)(type & PAS_SIMPLE_TYPE_DATA_PTR_MASK);
+ return (const pas_simple_type_with_key_data*)(type & PAS_SIMPLE_TYPE_DATA_PTR_MASK);
}
static inline pas_simple_type pas_simple_type_unwrap(pas_simple_type type)
@@ -118,7 +118,7 @@
}
static inline pas_simple_type pas_simple_type_create_with_key_data(
- pas_simple_type_with_key_data* data)
+ const pas_simple_type_with_key_data* data)
{
pas_simple_type result;
@@ -132,17 +132,17 @@
PAS_API void pas_simple_type_dump(pas_simple_type type, pas_stream* stream);
-static inline size_t pas_simple_type_as_heap_type_get_type_size(pas_heap_type* type)
+static inline size_t pas_simple_type_as_heap_type_get_type_size(const pas_heap_type* type)
{
return pas_simple_type_size((pas_simple_type)type);
}
-static inline size_t pas_simple_type_as_heap_type_get_type_alignment(pas_heap_type* type)
+static inline size_t pas_simple_type_as_heap_type_get_type_alignment(const pas_heap_type* type)
{
return pas_simple_type_alignment((pas_simple_type)type);
}
-PAS_API void pas_simple_type_as_heap_type_dump(pas_heap_type* type, pas_stream* stream);
+PAS_API void pas_simple_type_as_heap_type_dump(const pas_heap_type* type, pas_stream* stream);
PAS_END_EXTERN_C;
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -53,7 +53,7 @@
pas_heap_config config,
pas_try_allocate_common try_allocate_common)
{
- pas_heap_type* type;
+ const pas_heap_type* type;
size_t type_size;
pas_local_allocator_result allocator;
unsigned allocator_index;
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_array.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_array.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_array.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -200,7 +200,7 @@
static PAS_ALWAYS_INLINE pas_allocation_result name ## _by_count( \
pas_heap_ref* heap_ref, size_t count, size_t alignment) \
{ \
- pas_heap_type* type; \
+ const pas_heap_type* type; \
size_t type_size; \
size_t size; \
\
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_common.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -107,7 +107,7 @@
pas_baseline_allocator_result baseline_allocator_result;
pas_allocation_result result;
pas_heap* heap;
- pas_heap_type* type;
+ const pas_heap_type* type;
pas_segregated_size_directory* directory;
unsigned* cached_index;
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_intrinsic.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_intrinsic.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_intrinsic.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -67,7 +67,7 @@
.index = 0, \
.table_state = pas_heap_table_state_uninitialized, \
}, \
- .type = (pas_heap_type*)(primitive_type), \
+ .type = (const pas_heap_type*)(primitive_type), \
.heap_ref = NULL, \
.next_heap = PAS_COMPACT_PTR_INITIALIZER, \
.config_kind = (passed_config).kind, \
Modified: trunk/Source/bmalloc/libpas/src/libpas/pas_try_reallocate.h (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/libpas/pas_try_reallocate.h 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/libpas/pas_try_reallocate.h 2021-12-23 04:04:25 UTC (rev 287383)
@@ -515,7 +515,7 @@
pas_reallocate_heap_teleport_rule teleport_rule,
pas_reallocate_free_mode free_mode)
{
- pas_heap_type* type;
+ const pas_heap_type* type;
size_t type_size;
size_t new_size;
Modified: trunk/Source/bmalloc/libpas/src/test/ExpendableMemoryTests.cpp (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/test/ExpendableMemoryTests.cpp 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/test/ExpendableMemoryTests.cpp 2021-12-23 04:04:25 UTC (rev 287383)
@@ -38,7 +38,7 @@
namespace {
-bmalloc_type theType = BMALLOC_TYPE_INITIALIZER(42, 2, "foo");
+static const bmalloc_type theType = BMALLOC_TYPE_INITIALIZER(42, 2, "foo");
pas_heap_ref theHeap = BMALLOC_HEAP_REF_INITIALIZER(&theType);
void testPayloadImpl(pas_heap_ref& heap, bool firstRun)
Modified: trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp 2021-12-23 04:04:25 UTC (rev 287383)
@@ -90,7 +90,6 @@
}
#if PAS_ENABLE_BMALLOC
-bmalloc_type gigacageType;
pas_primitive_heap_ref gigacageHeapRef;
void* gigacageAllocate(size_t size)
@@ -1135,7 +1134,7 @@
TestScope iso(
"bmalloc-gigacage",
[] () {
- gigacageType = BMALLOC_TYPE_INITIALIZER(1, 1, "Gigacage");
+ static const bmalloc_type gigacageType = BMALLOC_TYPE_INITIALIZER(1, 1, "Gigacage");
gigacageHeapRef = BMALLOC_AUXILIARY_HEAP_REF_INITIALIZER(&gigacageType);
size_t reservationSize = 1000000000;
Modified: trunk/Source/bmalloc/libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp (287382 => 287383)
--- trunk/Source/bmalloc/libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp 2021-12-23 03:10:16 UTC (rev 287382)
+++ trunk/Source/bmalloc/libpas/src/test/ThingyAndUtilityHeapAllocationTests.cpp 2021-12-23 04:04:25 UTC (rev 287383)
@@ -379,7 +379,7 @@
pas_heap_ref* createIsolatedHeapRef(size_t size, size_t alignment)
{
pas_heap_ref* heapRef = new pas_heap_ref;
- heapRef->type = reinterpret_cast<pas_heap_type*>(PAS_SIMPLE_TYPE_CREATE(size, alignment));
+ heapRef->type = reinterpret_cast<const pas_heap_type*>(PAS_SIMPLE_TYPE_CREATE(size, alignment));
heapRef->heap = nullptr;
#if TLC
heapRef->allocator_index = 0;