Changeset 283371 in webkit
- Timestamp:
- Oct 1, 2021 9:19:16 AM (3 years ago)
- Location:
- trunk/Source/bmalloc
- Files:
-
- 1 added
- 1 deleted
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/bmalloc/ChangeLog
r283285 r283371 1 2021-09-30 Filip Pizlo <fpizlo@apple.com> 2 3 [libpas] Change the names of libpas heap runtime configs to something simpler (intrinsic, primitive, typed, and flex) and add comments describing what they are (update to 32abc1fd5489e01aa1c504ae4654967047d3f072) 4 https://bugs.webkit.org/show_bug.cgi?id=231040 5 6 Reviewed by Saam Barati. 7 8 At some point a long time ago, libpas had sensible names for heap runtime configs: primitive 9 and typed. Then I added the "objc" category, not realizing that I was really adding support for 10 flexible array members. And then I added "intrinsic_primitive", but wow, what a mouthful. 11 12 This changes the heap names to: 13 14 intrinsic: singleton heaps for primitive data, like the normal fastMalloc heap 15 primitive: isoheaps for primitive data 16 typed: isoheaps for fixed-size types 17 flex: isoheaps for types with flexible array members 18 19 Also adds comments explaining the exact behaviors of these heaps. 20 21 Also exposes isoheaped array allocation through the bmalloc_heap API. That's not yet exposed 22 via the IsoHeap API, but the idea is that it will be -- just need to figure out a clean way to 23 do it. 24 25 * bmalloc.xcodeproj/project.pbxproj: 26 * bmalloc/bmalloc.cpp: 27 (bmalloc::api::enableMiniMode): 28 * libpas/common.sh: 29 * libpas/src/chaos/Chaos.cpp: 30 (main): 31 * libpas/src/libpas/bmalloc_heap.c: 32 (bmalloc_try_iso_allocate_array): 33 (bmalloc_iso_allocate_array): 34 (bmalloc_try_iso_allocate_array_with_alignment): 35 (bmalloc_iso_allocate_array_with_alignment): 36 * libpas/src/libpas/bmalloc_heap.h: 37 * libpas/src/libpas/bmalloc_heap_config.c: 38 * libpas/src/libpas/bmalloc_heap_inlines.h: 39 (bmalloc_try_reallocate_inline): 40 (bmalloc_reallocate_inline): 41 (bmalloc_try_iso_allocate_array_inline): 42 (bmalloc_try_iso_allocate_array_with_alignment_inline): 43 (bmalloc_iso_allocate_array_inline): 44 (bmalloc_iso_allocate_array_with_alignment_inline): 45 * libpas/src/libpas/hotbit_heap.c: 46 * libpas/src/libpas/hotbit_heap_config.c: 47 * libpas/src/libpas/hotbit_heap_inlines.h: 48 (hotbit_try_reallocate_inline): 49 * libpas/src/libpas/iso_heap.c: 50 (iso_try_allocate_for_flex): 51 (iso_try_allocate_for_objc): Deleted. 52 * libpas/src/libpas/iso_heap.h: 53 * libpas/src/libpas/iso_heap_config.c: 54 * libpas/src/libpas/iso_heap_inlines.h: 55 (iso_try_reallocate_common_primitive_inline): 56 (iso_reallocate_common_primitive_inline): 57 (iso_try_allocate_for_flex_inline): 58 (iso_try_allocate_for_objc_inline): Deleted. 59 * libpas/src/libpas/iso_heap_innards.h: 60 * libpas/src/libpas/iso_test_heap.c: 61 * libpas/src/libpas/iso_test_heap_config.c: 62 * libpas/src/libpas/jit_heap.c: 63 * libpas/src/libpas/minalign32_heap.c: 64 * libpas/src/libpas/minalign32_heap_config.c: 65 * libpas/src/libpas/pagesize64k_heap.c: 66 * libpas/src/libpas/pagesize64k_heap_config.c: 67 * libpas/src/libpas/pas_heap_config_utils.h: 68 * libpas/src/libpas/pas_heap_config_utils_inlines.h: 69 * libpas/src/libpas/pas_internal_config.h: 70 * libpas/src/libpas/pas_large_heap.c: 71 (pas_large_heap_construct): 72 * libpas/src/libpas/pas_try_allocate.h: 73 * libpas/src/libpas/pas_try_allocate_array.h: 74 * libpas/src/libpas/pas_try_allocate_intrinsic.h: Added. 75 (pas_try_allocate_intrinsic_impl_medium_slow_case): 76 (pas_try_allocate_intrinsic_impl_inline_only): 77 * libpas/src/libpas/pas_try_allocate_intrinsic_primitive.h: Removed. 78 * libpas/src/libpas/pas_try_allocate_primitive.h: 79 * libpas/src/libpas/pas_try_reallocate.h: 80 (pas_try_reallocate_intrinsic_allocate_callback): 81 (pas_try_reallocate_intrinsic): 82 (pas_try_reallocate_intrinsic_primitive_allocate_callback): Deleted. 83 (pas_try_reallocate_intrinsic_primitive): Deleted. 84 * libpas/src/libpas/thingy_heap.c: 85 (thingy_try_reallocate_primitive): 86 * libpas/src/libpas/thingy_heap_config.c: 87 * libpas/src/test/IsoHeapChaosTests.cpp: 88 (addIsoHeapChaosTests): 89 * libpas/src/test/TestHarness.cpp: 90 1 91 2021-09-29 Basuke Suzuki <basuke.suzuki@sony.com> 2 92 -
trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
r282556 r283371 76 76 0F74B93E1F89713E00B935D3 /* CryptoRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F74B93C1F89713E00B935D3 /* CryptoRandom.h */; settings = {ATTRIBUTES = (Private, ); }; }; 77 77 0F74B93F1F89713E00B935D3 /* CryptoRandom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F74B93D1F89713E00B935D3 /* CryptoRandom.cpp */; }; 78 0F752D9227066FCB00ADF74D /* pas_try_allocate_intrinsic.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F752D9127066FCB00ADF74D /* pas_try_allocate_intrinsic.h */; settings = {ATTRIBUTES = (Private, ); }; }; 78 79 0F75498224869740002A4C7D /* pas_allocator_index.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7549802486973C002A4C7D /* pas_allocator_index.h */; settings = {ATTRIBUTES = (Private, ); }; }; 79 80 0F75498324869742002A4C7D /* pas_compact_atomic_allocator_index_ptr.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7549812486973C002A4C7D /* pas_compact_atomic_allocator_index_ptr.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 462 463 0FC40B612451499400876DA0 /* pas_segregated_view_kind.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC40A852451498C00876DA0 /* pas_segregated_view_kind.h */; settings = {ATTRIBUTES = (Private, ); }; }; 463 464 0FC40B622451499400876DA0 /* pas_reallocate_heap_teleport_rule.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC40A862451498C00876DA0 /* pas_reallocate_heap_teleport_rule.h */; settings = {ATTRIBUTES = (Private, ); }; }; 464 0FC40B632451499400876DA0 /* pas_try_allocate_intrinsic_primitive.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC40A872451498C00876DA0 /* pas_try_allocate_intrinsic_primitive.h */; settings = {ATTRIBUTES = (Private, ); }; };465 465 0FC40B642451499400876DA0 /* pas_segregated_shared_view_inlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC40A882451498C00876DA0 /* pas_segregated_shared_view_inlines.h */; settings = {ATTRIBUTES = (Private, ); }; }; 466 466 0FC40B652451499400876DA0 /* pas_page_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FC40A892451498C00876DA0 /* pas_page_malloc.c */; }; … … 723 723 0F74B93C1F89713E00B935D3 /* CryptoRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoRandom.h; path = bmalloc/CryptoRandom.h; sourceTree = "<group>"; }; 724 724 0F74B93D1F89713E00B935D3 /* CryptoRandom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoRandom.cpp; path = bmalloc/CryptoRandom.cpp; sourceTree = "<group>"; }; 725 0F752D9127066FCB00ADF74D /* pas_try_allocate_intrinsic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pas_try_allocate_intrinsic.h; path = libpas/src/libpas/pas_try_allocate_intrinsic.h; sourceTree = "<group>"; }; 725 726 0F7549802486973C002A4C7D /* pas_allocator_index.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pas_allocator_index.h; path = libpas/src/libpas/pas_allocator_index.h; sourceTree = "<group>"; }; 726 727 0F7549812486973C002A4C7D /* pas_compact_atomic_allocator_index_ptr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pas_compact_atomic_allocator_index_ptr.h; path = libpas/src/libpas/pas_compact_atomic_allocator_index_ptr.h; sourceTree = "<group>"; }; … … 1113 1114 0FC40A852451498C00876DA0 /* pas_segregated_view_kind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pas_segregated_view_kind.h; path = libpas/src/libpas/pas_segregated_view_kind.h; sourceTree = "<group>"; }; 1114 1115 0FC40A862451498C00876DA0 /* pas_reallocate_heap_teleport_rule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pas_reallocate_heap_teleport_rule.h; path = libpas/src/libpas/pas_reallocate_heap_teleport_rule.h; sourceTree = "<group>"; }; 1115 0FC40A872451498C00876DA0 /* pas_try_allocate_intrinsic_primitive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pas_try_allocate_intrinsic_primitive.h; path = libpas/src/libpas/pas_try_allocate_intrinsic_primitive.h; sourceTree = "<group>"; };1116 1116 0FC40A882451498C00876DA0 /* pas_segregated_shared_view_inlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pas_segregated_shared_view_inlines.h; path = libpas/src/libpas/pas_segregated_shared_view_inlines.h; sourceTree = "<group>"; }; 1117 1117 0FC40A892451498C00876DA0 /* pas_page_malloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pas_page_malloc.c; path = libpas/src/libpas/pas_page_malloc.c; sourceTree = "<group>"; }; … … 1865 1865 0FC40A522451498800876DA0 /* pas_try_allocate_array.h */, 1866 1866 0FC40A392451498600876DA0 /* pas_try_allocate_common.h */, 1867 0F C40A872451498C00876DA0 /* pas_try_allocate_intrinsic_primitive.h */,1867 0F752D9127066FCB00ADF74D /* pas_try_allocate_intrinsic.h */, 1868 1868 0FC40A2B2451498500876DA0 /* pas_try_allocate_primitive.h */, 1869 1869 0FC40A652451498900876DA0 /* pas_try_allocate.h */, … … 2110 2110 0F7EB8231F9541B000F1ABCB /* EligibilityResult.h in Headers */, 2111 2111 0F7EB8381F9541B000F1ABCB /* EligibilityResultInlines.h in Headers */, 2112 0F752D9227066FCB00ADF74D /* pas_try_allocate_intrinsic.h in Headers */, 2112 2113 14895D921A3A319C0006235D /* Environment.h in Headers */, 2113 2114 FE48BD3B2321E8D700F136D0 /* FailureAction.h in Headers */, … … 2498 2499 0FC40B302451499400876DA0 /* pas_try_allocate_array.h in Headers */, 2499 2500 0FC40B182451499400876DA0 /* pas_try_allocate_common.h in Headers */, 2500 0FC40B632451499400876DA0 /* pas_try_allocate_intrinsic_primitive.h in Headers */,2501 2501 0FC40B0A2451499400876DA0 /* pas_try_allocate_primitive.h in Headers */, 2502 2502 0FC40B0F2451499400876DA0 /* pas_try_reallocate.h in Headers */, -
trunk/Source/bmalloc/bmalloc/bmalloc.cpp
r279867 r283371 201 201 202 202 // Switch to bitfit allocation for anything that isn't isoheaped. 203 bmalloc_intrinsic_ primitive_runtime_config.base.max_segregated_object_size = 0;204 bmalloc_intrinsic_ primitive_runtime_config.base.max_bitfit_object_size = UINT_MAX;203 bmalloc_intrinsic_runtime_config.base.max_segregated_object_size = 0; 204 bmalloc_intrinsic_runtime_config.base.max_bitfit_object_size = UINT_MAX; 205 205 bmalloc_primitive_runtime_config.base.max_segregated_object_size = 0; 206 206 bmalloc_primitive_runtime_config.base.max_bitfit_object_size = UINT_MAX; -
trunk/Source/bmalloc/libpas/common.sh
r279867 r283371 25 25 set -x 26 26 27 config= Debug27 config=Release 28 28 sdk=macosx.internal 29 29 archs=blank -
trunk/Source/bmalloc/libpas/src/chaos/Chaos.cpp
r279867 r283371 363 363 364 364 if (!enableBitFit) 365 iso_intrinsic_ primitive_runtime_config.base.max_bitfit_object_size = 0;365 iso_intrinsic_runtime_config.base.max_bitfit_object_size = 0; 366 366 367 367 if (!enableSegregated) 368 iso_intrinsic_ primitive_runtime_config.base.max_segregated_object_size = 0;368 iso_intrinsic_runtime_config.base.max_segregated_object_size = 0; 369 369 370 370 pas_status_reporter_enabled = enableStatusReporter; -
trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap.c
r282556 r283371 40 40 41 41 pas_heap bmalloc_common_primitive_heap = 42 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(42 PAS_INTRINSIC_HEAP_INITIALIZER( 43 43 &bmalloc_common_primitive_heap, 44 44 PAS_SIMPLE_TYPE_CREATE(1, 1), 45 45 bmalloc_common_primitive_heap_support, 46 46 BMALLOC_HEAP_CONFIG, 47 &bmalloc_intrinsic_ primitive_runtime_config.base);47 &bmalloc_intrinsic_runtime_config.base); 48 48 49 49 pas_allocator_counts bmalloc_allocator_counts; … … 104 104 { 105 105 return bmalloc_iso_allocate_inline(heap_ref); 106 } 107 108 void* bmalloc_try_iso_allocate_array(pas_heap_ref* heap_ref, size_t count) 109 { 110 return bmalloc_try_iso_allocate_array_inline(heap_ref, count); 111 } 112 113 void* bmalloc_iso_allocate_array(pas_heap_ref* heap_ref, size_t count) 114 { 115 return bmalloc_iso_allocate_array_inline(heap_ref, count); 116 } 117 118 void* bmalloc_try_iso_allocate_array_with_alignment( 119 pas_heap_ref* heap_ref, size_t count, size_t alignment) 120 { 121 return bmalloc_try_iso_allocate_array_with_alignment_inline(heap_ref, count, alignment); 122 } 123 124 void* bmalloc_iso_allocate_array_with_alignment( 125 pas_heap_ref* heap_ref, size_t count, size_t alignment) 126 { 127 return bmalloc_iso_allocate_array_with_alignment_inline(heap_ref, count, alignment); 106 128 } 107 129 -
trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap.h
r279867 r283371 56 56 PAS_API void* bmalloc_iso_allocate(pas_heap_ref* heap_ref); 57 57 58 PAS_API void* bmalloc_try_iso_allocate_array(pas_heap_ref* heap_ref, size_t count); 59 PAS_API void* bmalloc_iso_allocate_array(pas_heap_ref* heap_ref, size_t count); 60 61 PAS_API void* bmalloc_try_iso_allocate_array_with_alignment( 62 pas_heap_ref* heap_ref, size_t count, size_t alignment); 63 PAS_API void* bmalloc_iso_allocate_array_with_alignment( 64 pas_heap_ref* heap_ref, size_t count, size_t alignment); 65 58 66 PAS_API pas_heap* bmalloc_heap_ref_get_heap(pas_heap_ref* heap_ref); 59 67 -
trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_config.c
r282899 r283371 42 42 bmalloc, BMALLOC, 43 43 .allocate_page_should_zero = false, 44 .intrinsic_ primitive_view_cache_capacity = pas_heap_runtime_config_aggressive_view_cache_capacity);44 .intrinsic_view_cache_capacity = pas_heap_runtime_config_aggressive_view_cache_capacity); 45 45 46 46 void bmalloc_heap_config_activate(void) -
trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_inlines.h
r282556 r283371 32 32 #include "pas_deallocate.h" 33 33 #include "pas_try_allocate.h" 34 #include "pas_try_allocate_intrinsic_primitive.h" 34 #include "pas_try_allocate_array.h" 35 #include "pas_try_allocate_intrinsic.h" 35 36 #include "pas_try_allocate_primitive.h" 36 37 #include "pas_try_reallocate.h" … … 40 41 PAS_BEGIN_EXTERN_C; 41 42 42 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(43 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 43 44 bmalloc_try_allocate_impl, 44 45 BMALLOC_HEAP_CONFIG, 45 &bmalloc_intrinsic_ primitive_runtime_config.base,46 &bmalloc_intrinsic_runtime_config.base, 46 47 &bmalloc_allocator_counts, 47 48 pas_allocation_result_identity, … … 52 53 /* Need to create a different set of allocation functions if we want to pass nontrivial alignment, 53 54 since in that case we do not want to use the fancy lookup path. */ 54 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(55 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 55 56 bmalloc_try_allocate_with_alignment_impl, 56 57 BMALLOC_HEAP_CONFIG, 57 &bmalloc_intrinsic_ primitive_runtime_config.base,58 &bmalloc_intrinsic_runtime_config.base, 58 59 &bmalloc_allocator_counts, 59 60 pas_allocation_result_identity, … … 62 63 pas_intrinsic_heap_is_not_designated); 63 64 64 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(65 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 65 66 bmalloc_allocate_impl, 66 67 BMALLOC_HEAP_CONFIG, 67 &bmalloc_intrinsic_ primitive_runtime_config.base,68 &bmalloc_intrinsic_runtime_config.base, 68 69 &bmalloc_allocator_counts, 69 70 pas_allocation_result_crash_on_error, … … 72 73 pas_intrinsic_heap_is_designated); 73 74 74 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(75 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 75 76 bmalloc_allocate_with_alignment_impl, 76 77 BMALLOC_HEAP_CONFIG, 77 &bmalloc_intrinsic_ primitive_runtime_config.base,78 &bmalloc_intrinsic_runtime_config.base, 78 79 &bmalloc_allocator_counts, 79 80 pas_allocation_result_crash_on_error, … … 128 129 pas_reallocate_free_mode free_mode) 129 130 { 130 return (void*)pas_try_reallocate_intrinsic _primitive(131 return (void*)pas_try_reallocate_intrinsic( 131 132 old_ptr, 132 133 &bmalloc_common_primitive_heap, … … 142 143 pas_reallocate_free_mode free_mode) 143 144 { 144 return (void*)pas_try_reallocate_intrinsic _primitive(145 return (void*)pas_try_reallocate_intrinsic( 145 146 old_ptr, 146 147 &bmalloc_common_primitive_heap, … … 174 175 { 175 176 return bmalloc_iso_allocate_impl(heap_ref).ptr; 177 } 178 179 PAS_CREATE_TRY_ALLOCATE_ARRAY( 180 bmalloc_try_iso_allocate_array_impl, 181 BMALLOC_HEAP_CONFIG, 182 &bmalloc_typed_runtime_config.base, 183 &bmalloc_allocator_counts, 184 pas_allocation_result_identity); 185 186 static PAS_ALWAYS_INLINE void* bmalloc_try_iso_allocate_array_inline( 187 pas_heap_ref* heap_ref, size_t count) 188 { 189 return bmalloc_try_iso_allocate_array_impl(heap_ref, count, 1).ptr; 190 } 191 192 static PAS_ALWAYS_INLINE void* bmalloc_try_iso_allocate_array_with_alignment_inline( 193 pas_heap_ref* heap_ref, size_t count, size_t alignment) 194 { 195 return bmalloc_try_iso_allocate_array_impl(heap_ref, count, alignment).ptr; 196 } 197 198 PAS_CREATE_TRY_ALLOCATE_ARRAY( 199 bmalloc_iso_allocate_array_impl, 200 BMALLOC_HEAP_CONFIG, 201 &bmalloc_typed_runtime_config.base, 202 &bmalloc_allocator_counts, 203 pas_allocation_result_crash_on_error); 204 205 static PAS_ALWAYS_INLINE void* bmalloc_iso_allocate_array_inline( 206 pas_heap_ref* heap_ref, size_t count) 207 { 208 return bmalloc_iso_allocate_array_impl(heap_ref, count, 1).ptr; 209 } 210 211 static PAS_ALWAYS_INLINE void* bmalloc_iso_allocate_array_with_alignment_inline( 212 pas_heap_ref* heap_ref, size_t count, size_t alignment) 213 { 214 return bmalloc_iso_allocate_array_impl(heap_ref, count, alignment).ptr; 176 215 } 177 216 -
trunk/Source/bmalloc/libpas/src/libpas/hotbit_heap.c
r279867 r283371 39 39 40 40 pas_heap hotbit_common_primitive_heap = 41 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(41 PAS_INTRINSIC_HEAP_INITIALIZER( 42 42 &hotbit_common_primitive_heap, 43 43 PAS_SIMPLE_TYPE_CREATE(1, 1), 44 44 hotbit_common_primitive_heap_support, 45 45 HOTBIT_HEAP_CONFIG, 46 &hotbit_intrinsic_ primitive_runtime_config.base);46 &hotbit_intrinsic_runtime_config.base); 47 47 48 48 pas_allocator_counts hotbit_allocator_counts; -
trunk/Source/bmalloc/libpas/src/libpas/hotbit_heap_config.c
r282556 r283371 41 41 hotbit, HOTBIT, 42 42 .allocate_page_should_zero = false, 43 .intrinsic_ primitive_view_cache_capacity = pas_heap_runtime_config_aggressive_view_cache_capacity);43 .intrinsic_view_cache_capacity = pas_heap_runtime_config_aggressive_view_cache_capacity); 44 44 45 45 void hotbit_heap_config_activate(void) -
trunk/Source/bmalloc/libpas/src/libpas/hotbit_heap_inlines.h
r282556 r283371 31 31 #include "hotbit_heap_innards.h" 32 32 #include "pas_deallocate.h" 33 #include "pas_try_allocate_intrinsic _primitive.h"33 #include "pas_try_allocate_intrinsic.h" 34 34 #include "pas_try_reallocate.h" 35 35 … … 38 38 PAS_BEGIN_EXTERN_C; 39 39 40 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(40 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 41 41 hotbit_try_allocate_impl, 42 42 HOTBIT_HEAP_CONFIG, 43 &hotbit_intrinsic_ primitive_runtime_config.base,43 &hotbit_intrinsic_runtime_config.base, 44 44 &hotbit_allocator_counts, 45 45 pas_allocation_result_identity, … … 50 50 /* Need to create a different set of allocation functions if we want to pass nontrivial alignment, 51 51 since in that case we do not want to use the fancy lookup path. */ 52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 53 53 hotbit_try_allocate_with_alignment_impl, 54 54 HOTBIT_HEAP_CONFIG, 55 &hotbit_intrinsic_ primitive_runtime_config.base,55 &hotbit_intrinsic_runtime_config.base, 56 56 &hotbit_allocator_counts, 57 57 pas_allocation_result_identity, … … 75 75 pas_reallocate_free_mode free_mode) 76 76 { 77 return (void*)pas_try_reallocate_intrinsic _primitive(77 return (void*)pas_try_reallocate_intrinsic( 78 78 old_ptr, 79 79 &hotbit_common_primitive_heap, -
trunk/Source/bmalloc/libpas/src/libpas/iso_heap.c
r279867 r283371 37 37 #include "pas_try_allocate.h" 38 38 #include "pas_try_allocate_array.h" 39 #include "pas_try_allocate_intrinsic _primitive.h"39 #include "pas_try_allocate_intrinsic.h" 40 40 #include "pas_try_allocate_primitive.h" 41 41 #include "pas_try_reallocate.h" … … 45 45 46 46 pas_heap iso_common_primitive_heap = 47 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(47 PAS_INTRINSIC_HEAP_INITIALIZER( 48 48 &iso_common_primitive_heap, 49 49 PAS_SIMPLE_TYPE_CREATE(1, 1), 50 50 iso_common_primitive_heap_support, 51 51 ISO_HEAP_CONFIG, 52 &iso_intrinsic_ primitive_runtime_config.base);52 &iso_intrinsic_runtime_config.base); 53 53 54 54 pas_allocator_counts iso_allocator_counts; … … 56 56 pas_dynamic_primitive_heap_map iso_primitive_dynamic_heap_map = 57 57 PAS_DYNAMIC_PRIMITIVE_HEAP_MAP_INITIALIZER(iso_primitive_heap_ref_construct); 58 pas_dynamic_primitive_heap_map iso_ objc_dynamic_heap_map =58 pas_dynamic_primitive_heap_map iso_flex_dynamic_heap_map = 59 59 PAS_DYNAMIC_PRIMITIVE_HEAP_MAP_INITIALIZER(iso_primitive_heap_ref_construct); 60 60 … … 265 265 } 266 266 267 void* iso_try_allocate_for_ objc(const void* cls, size_t size)268 { 269 return iso_try_allocate_for_ objc_inline(cls, size);267 void* iso_try_allocate_for_flex(const void* cls, size_t size) 268 { 269 return iso_try_allocate_for_flex_inline(cls, size); 270 270 } 271 271 -
trunk/Source/bmalloc/libpas/src/libpas/iso_heap.h
r279867 r283371 118 118 PAS_API pas_heap* iso_primitive_heap_ref_get_heap(pas_primitive_heap_ref* heap_ref); 119 119 120 PAS_API void* iso_try_allocate_for_ objc(const void* cls, size_t size);120 PAS_API void* iso_try_allocate_for_flex(const void* cls, size_t size); 121 121 122 122 PAS_API bool iso_has_object(void*); -
trunk/Source/bmalloc/libpas/src/libpas/iso_heap_config.c
r282556 r283371 39 39 iso, ISO, 40 40 .allocate_page_should_zero = false, 41 .intrinsic_ primitive_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity);41 .intrinsic_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity); 42 42 43 43 #endif /* PAS_ENABLE_ISO */ -
trunk/Source/bmalloc/libpas/src/libpas/iso_heap_inlines.h
r282556 r283371 36 36 #include "pas_try_allocate.h" 37 37 #include "pas_try_allocate_array.h" 38 #include "pas_try_allocate_intrinsic _primitive.h"38 #include "pas_try_allocate_intrinsic.h" 39 39 #include "pas_try_allocate_primitive.h" 40 40 #include "pas_try_reallocate.h" … … 44 44 PAS_BEGIN_EXTERN_C; 45 45 46 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(46 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 47 47 iso_try_allocate_common_primitive_impl, 48 48 ISO_HEAP_CONFIG, 49 &iso_intrinsic_ primitive_runtime_config.base,49 &iso_intrinsic_runtime_config.base, 50 50 &iso_allocator_counts, 51 51 pas_allocation_result_set_errno, … … 56 56 /* Need to create a different set of allocation functions if we want to pass nontrivial alignment, 57 57 since in that case we do not want to use the fancy lookup path. */ 58 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(58 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 59 59 iso_try_allocate_common_primitive_with_alignment_impl, 60 60 ISO_HEAP_CONFIG, 61 &iso_intrinsic_ primitive_runtime_config.base,61 &iso_intrinsic_runtime_config.base, 62 62 &iso_allocator_counts, 63 63 pas_allocation_result_set_errno, … … 66 66 pas_intrinsic_heap_is_not_designated); 67 67 68 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(68 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 69 69 iso_allocate_common_primitive_impl, 70 70 ISO_HEAP_CONFIG, 71 &iso_intrinsic_ primitive_runtime_config.base,71 &iso_intrinsic_runtime_config.base, 72 72 &iso_allocator_counts, 73 73 pas_allocation_result_crash_on_error, … … 76 76 pas_intrinsic_heap_is_not_designated); 77 77 78 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(78 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 79 79 iso_allocate_common_primitive_with_alignment_impl, 80 80 ISO_HEAP_CONFIG, 81 &iso_intrinsic_ primitive_runtime_config.base,81 &iso_intrinsic_runtime_config.base, 82 82 &iso_allocator_counts, 83 83 pas_allocation_result_crash_on_error, … … 126 126 pas_reallocate_free_mode free_mode) 127 127 { 128 return (void*)pas_try_reallocate_intrinsic _primitive(128 return (void*)pas_try_reallocate_intrinsic( 129 129 old_ptr, 130 130 &iso_common_primitive_heap, … … 140 140 pas_reallocate_free_mode free_mode) 141 141 { 142 return (void*)pas_try_reallocate_intrinsic _primitive(142 return (void*)pas_try_reallocate_intrinsic( 143 143 old_ptr, 144 144 &iso_common_primitive_heap, … … 334 334 335 335 PAS_CREATE_TRY_ALLOCATE_PRIMITIVE( 336 iso_try_allocate_for_ objc_impl,337 ISO_HEAP_CONFIG, 338 &iso_ objc_runtime_config.base,336 iso_try_allocate_for_flex_impl, 337 ISO_HEAP_CONFIG, 338 &iso_flex_runtime_config.base, 339 339 &iso_allocator_counts, 340 340 pas_allocation_result_set_errno); 341 341 342 static PAS_ALWAYS_INLINE void* iso_try_allocate_for_ objc_inline(const void* cls, size_t size)343 { 344 return (void*)pas_allocation_result_zero( 345 iso_try_allocate_for_ objc_impl(342 static PAS_ALWAYS_INLINE void* iso_try_allocate_for_flex_inline(const void* cls, size_t size) 343 { 344 return (void*)pas_allocation_result_zero( 345 iso_try_allocate_for_flex_impl( 346 346 pas_dynamic_primitive_heap_map_find( 347 &iso_ objc_dynamic_heap_map, cls, size),347 &iso_flex_dynamic_heap_map, cls, size), 348 348 size, 1), 349 349 size).begin; -
trunk/Source/bmalloc/libpas/src/libpas/iso_heap_innards.h
r279867 r283371 42 42 43 43 PAS_API extern pas_dynamic_primitive_heap_map iso_primitive_dynamic_heap_map; 44 PAS_API extern pas_dynamic_primitive_heap_map iso_ objc_dynamic_heap_map;44 PAS_API extern pas_dynamic_primitive_heap_map iso_flex_dynamic_heap_map; 45 45 46 46 PAS_END_EXTERN_C; -
trunk/Source/bmalloc/libpas/src/libpas/iso_test_heap.c
r282556 r283371 38 38 #include "pas_try_allocate.h" 39 39 #include "pas_try_allocate_array.h" 40 #include "pas_try_allocate_intrinsic _primitive.h"40 #include "pas_try_allocate_intrinsic.h" 41 41 42 42 pas_intrinsic_heap_support iso_test_common_primitive_heap_support = … … 44 44 45 45 pas_heap iso_test_common_primitive_heap = 46 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(46 PAS_INTRINSIC_HEAP_INITIALIZER( 47 47 &iso_test_common_primitive_heap, 48 48 PAS_SIMPLE_TYPE_CREATE(1, 1), 49 49 iso_test_common_primitive_heap_support, 50 50 ISO_TEST_HEAP_CONFIG, 51 &iso_test_intrinsic_ primitive_runtime_config.base);51 &iso_test_intrinsic_runtime_config.base); 52 52 53 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(53 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 54 54 test_allocate_common_primitive, 55 55 ISO_TEST_HEAP_CONFIG, 56 &iso_test_intrinsic_ primitive_runtime_config.base,56 &iso_test_intrinsic_runtime_config.base, 57 57 &iso_allocator_counts, 58 58 pas_allocation_result_crash_on_error, -
trunk/Source/bmalloc/libpas/src/libpas/iso_test_heap_config.c
r282556 r283371 39 39 iso_test, ISO_TEST, 40 40 .allocate_page_should_zero = false, 41 .intrinsic_ primitive_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity);41 .intrinsic_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity); 42 42 43 43 #endif /* PAS_ENABLE_ISO_TEST */ -
trunk/Source/bmalloc/libpas/src/libpas/jit_heap.c
r282899 r283371 35 35 #include "pas_deallocate.h" 36 36 #include "pas_get_allocation_size.h" 37 #include "pas_try_allocate_intrinsic _primitive.h"37 #include "pas_try_allocate_intrinsic.h" 38 38 #include "pas_try_shrink.h" 39 39 40 pas_heap jit_common_primitive_heap = PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(40 pas_heap jit_common_primitive_heap = PAS_INTRINSIC_HEAP_INITIALIZER( 41 41 &jit_common_primitive_heap, 42 42 NULL, … … 61 61 } 62 62 63 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(63 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 64 64 jit_try_allocate_common_primitive_impl, 65 65 JIT_HEAP_CONFIG, -
trunk/Source/bmalloc/libpas/src/libpas/minalign32_heap.c
r282556 r283371 37 37 #include "pas_try_allocate.h" 38 38 #include "pas_try_allocate_array.h" 39 #include "pas_try_allocate_intrinsic _primitive.h"39 #include "pas_try_allocate_intrinsic.h" 40 40 41 41 pas_intrinsic_heap_support minalign32_common_primitive_heap_support = … … 43 43 44 44 pas_heap minalign32_common_primitive_heap = 45 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(45 PAS_INTRINSIC_HEAP_INITIALIZER( 46 46 &minalign32_common_primitive_heap, 47 47 PAS_SIMPLE_TYPE_CREATE(1, 1), 48 48 minalign32_common_primitive_heap_support, 49 49 MINALIGN32_HEAP_CONFIG, 50 &minalign32_intrinsic_ primitive_runtime_config.base);50 &minalign32_intrinsic_runtime_config.base); 51 51 52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 53 53 test_allocate_common_primitive, 54 54 MINALIGN32_HEAP_CONFIG, 55 &minalign32_intrinsic_ primitive_runtime_config.base,55 &minalign32_intrinsic_runtime_config.base, 56 56 &iso_allocator_counts, 57 57 pas_allocation_result_crash_on_error, -
trunk/Source/bmalloc/libpas/src/libpas/minalign32_heap_config.c
r282556 r283371 41 41 minalign32, MINALIGN32, 42 42 .allocate_page_should_zero = false, 43 .intrinsic_ primitive_view_cache_capacity = pas_heap_runtime_config_aggressive_view_cache_capacity);43 .intrinsic_view_cache_capacity = pas_heap_runtime_config_aggressive_view_cache_capacity); 44 44 45 45 void minalign32_heap_config_activate(void) -
trunk/Source/bmalloc/libpas/src/libpas/pagesize64k_heap.c
r282556 r283371 37 37 #include "pas_try_allocate.h" 38 38 #include "pas_try_allocate_array.h" 39 #include "pas_try_allocate_intrinsic _primitive.h"39 #include "pas_try_allocate_intrinsic.h" 40 40 41 41 pas_intrinsic_heap_support pagesize64k_common_primitive_heap_support = … … 43 43 44 44 pas_heap pagesize64k_common_primitive_heap = 45 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(45 PAS_INTRINSIC_HEAP_INITIALIZER( 46 46 &pagesize64k_common_primitive_heap, 47 47 PAS_SIMPLE_TYPE_CREATE(1, 1), 48 48 pagesize64k_common_primitive_heap_support, 49 49 PAGESIZE64K_HEAP_CONFIG, 50 &pagesize64k_intrinsic_ primitive_runtime_config.base);50 &pagesize64k_intrinsic_runtime_config.base); 51 51 52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 53 53 test_allocate_common_primitive, 54 54 PAGESIZE64K_HEAP_CONFIG, 55 &pagesize64k_intrinsic_ primitive_runtime_config.base,55 &pagesize64k_intrinsic_runtime_config.base, 56 56 &iso_allocator_counts, 57 57 pas_allocation_result_crash_on_error, -
trunk/Source/bmalloc/libpas/src/libpas/pagesize64k_heap_config.c
r282556 r283371 41 41 pagesize64k, PAGESIZE64K, 42 42 .allocate_page_should_zero = false, 43 .intrinsic_ primitive_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity);43 .intrinsic_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity); 44 44 45 45 void pagesize64k_heap_config_activate(void) -
trunk/Source/bmalloc/libpas/src/libpas/pas_heap_config_utils.h
r282556 r283371 351 351 PAS_API extern pas_page_header_table name ## _marge_page_header_table; \ 352 352 PAS_API extern pas_basic_heap_page_caches name ## _page_caches; \ 353 PAS_API extern pas_basic_heap_runtime_config name ## _intrinsic_ primitive_runtime_config; \353 PAS_API extern pas_basic_heap_runtime_config name ## _intrinsic_runtime_config; \ 354 354 PAS_API extern pas_basic_heap_runtime_config name ## _primitive_runtime_config; \ 355 355 PAS_API extern pas_basic_heap_runtime_config name ## _typed_runtime_config; \ 356 PAS_API extern pas_basic_heap_runtime_config name ## _ objc_runtime_config; \356 PAS_API extern pas_basic_heap_runtime_config name ## _flex_runtime_config; \ 357 357 \ 358 358 PAS_API extern pas_basic_heap_config_root_data name ## _root_data; \ -
trunk/Source/bmalloc/libpas/src/libpas/pas_heap_config_utils_inlines.h
r282556 r283371 49 49 typedef struct { 50 50 bool allocate_page_should_zero; 51 pas_heap_runtime_config_view_cache_capacity_for_object_size_callback intrinsic_ primitive_view_cache_capacity;51 pas_heap_runtime_config_view_cache_capacity_for_object_size_callback intrinsic_view_cache_capacity; 52 52 } pas_basic_heap_config_definitions_arguments; 53 53 … … 57 57 PAS_MEDIUM_SHARED_PAGE_LOG_SHIFT); \ 58 58 \ 59 pas_basic_heap_runtime_config name ## _intrinsic_ primitive_runtime_config = { \59 pas_basic_heap_runtime_config name ## _intrinsic_runtime_config = { \ 60 60 .base = { \ 61 61 .lookup_kind = pas_segregated_heap_lookup_primitive, \ … … 64 64 .is_part_of_heap = true, \ 65 65 .directory_size_bound_for_partial_views = \ 66 PAS_INTRINSIC_ PRIMITIVE_BOUND_FOR_PARTIAL_VIEWS, \66 PAS_INTRINSIC_BOUND_FOR_PARTIAL_VIEWS, \ 67 67 .directory_size_bound_for_baseline_allocators = \ 68 PAS_INTRINSIC_ PRIMITIVE_BOUND_FOR_BASELINE_ALLOCATORS, \68 PAS_INTRINSIC_BOUND_FOR_BASELINE_ALLOCATORS, \ 69 69 .directory_size_bound_for_no_view_cache = \ 70 PAS_INTRINSIC_ PRIMITIVE_BOUND_FOR_NO_VIEW_CACHE, \70 PAS_INTRINSIC_BOUND_FOR_NO_VIEW_CACHE, \ 71 71 .max_segregated_object_size = \ 72 PAS_INTRINSIC_ PRIMITIVE_MAX_SEGREGATED_OBJECT_SIZE, \72 PAS_INTRINSIC_MAX_SEGREGATED_OBJECT_SIZE, \ 73 73 .max_bitfit_object_size = \ 74 PAS_INTRINSIC_ PRIMITIVE_MAX_BITFIT_OBJECT_SIZE, \74 PAS_INTRINSIC_MAX_BITFIT_OBJECT_SIZE, \ 75 75 .view_cache_capacity_for_object_size = \ 76 ((pas_basic_heap_config_definitions_arguments){__VA_ARGS__}).intrinsic_ primitive_view_cache_capacity, \76 ((pas_basic_heap_config_definitions_arguments){__VA_ARGS__}).intrinsic_view_cache_capacity, \ 77 77 }, \ 78 78 .page_caches = &name ## _page_caches \ … … 121 121 }; \ 122 122 \ 123 pas_basic_heap_runtime_config name ## _ objc_runtime_config = { \123 pas_basic_heap_runtime_config name ## _flex_runtime_config = { \ 124 124 .base = { \ 125 125 .lookup_kind = pas_segregated_heap_lookup_primitive, \ … … 128 128 .is_part_of_heap = true, \ 129 129 .directory_size_bound_for_partial_views = \ 130 PAS_ OBJC_BOUND_FOR_PARTIAL_VIEWS, \130 PAS_FLEX_BOUND_FOR_PARTIAL_VIEWS, \ 131 131 .directory_size_bound_for_baseline_allocators = \ 132 PAS_ OBJC_BOUND_FOR_BASELINE_ALLOCATORS, \132 PAS_FLEX_BOUND_FOR_BASELINE_ALLOCATORS, \ 133 133 .directory_size_bound_for_no_view_cache = \ 134 PAS_ OBJC_BOUND_FOR_NO_VIEW_CACHE, \134 PAS_FLEX_BOUND_FOR_NO_VIEW_CACHE, \ 135 135 .max_segregated_object_size = \ 136 PAS_ OBJC_MAX_SEGREGATED_OBJECT_SIZE, \136 PAS_FLEX_MAX_SEGREGATED_OBJECT_SIZE, \ 137 137 .max_bitfit_object_size = \ 138 PAS_ OBJC_MAX_BITFIT_OBJECT_SIZE, \138 PAS_FLEX_MAX_BITFIT_OBJECT_SIZE, \ 139 139 .view_cache_capacity_for_object_size = pas_heap_runtime_config_zero_view_cache_capacity, \ 140 140 }, \ -
trunk/Source/bmalloc/libpas/src/libpas/pas_internal_config.h
r282556 r283371 153 153 #define PAS_UTILITY_MAX_BITFIT_OBJECT_SIZE 0 154 154 155 #define PAS_INTRINSIC_PRIMITIVE_BOUND_FOR_PARTIAL_VIEWS 0 156 #define PAS_INTRINSIC_PRIMITIVE_BOUND_FOR_BASELINE_ALLOCATORS 0 157 #define PAS_INTRINSIC_PRIMITIVE_BOUND_FOR_NO_VIEW_CACHE 0 158 #define PAS_INTRINSIC_PRIMITIVE_MAX_SEGREGATED_OBJECT_SIZE UINT_MAX 159 #define PAS_INTRINSIC_PRIMITIVE_MAX_BITFIT_OBJECT_SIZE UINT_MAX 155 /* Intrinsic heaps are for global, singleton, process-wide heaps -- so the "not isoheaped" heap, the 156 thing you get from regular malloc. */ 157 #define PAS_INTRINSIC_BOUND_FOR_PARTIAL_VIEWS 0 158 #define PAS_INTRINSIC_BOUND_FOR_BASELINE_ALLOCATORS 0 159 #define PAS_INTRINSIC_BOUND_FOR_NO_VIEW_CACHE 0 160 #define PAS_INTRINSIC_MAX_SEGREGATED_OBJECT_SIZE UINT_MAX 161 #define PAS_INTRINSIC_MAX_BITFIT_OBJECT_SIZE UINT_MAX 160 162 163 /* This is for heaps that hold primitives but should be kept separate from the main heap. So, the 164 tuning has to be such that we are efficient for lots of small heaps. But, there's no restriction 165 on whether the data in the heap is reused in any particular way -- we run this with a type size 166 of 1. */ 161 167 #define PAS_PRIMITIVE_BOUND_FOR_PARTIAL_VIEWS 0 162 168 #define PAS_PRIMITIVE_BOUND_FOR_BASELINE_ALLOCATORS 0 … … 165 171 #define PAS_PRIMITIVE_MAX_BITFIT_OBJECT_SIZE UINT_MAX 166 172 173 /* This is for heaps that hold typed objects. These objects have a certain size. We may allocate 174 arrays of these objects. The type may tell us an alignment requirement in addition to a size. 175 The alignment requirement is taken together with the minalign argument (the allocator uses 176 whichever is bigger), but it's a bit more optimal to convey alignment using the alignment part 177 of the type than by passing it to minalign. */ 167 178 #define PAS_TYPED_BOUND_FOR_PARTIAL_VIEWS 10 168 179 #define PAS_TYPED_BOUND_FOR_BASELINE_ALLOCATORS 0 … … 171 182 #define PAS_TYPED_MAX_BITFIT_OBJECT_SIZE 0 172 183 173 #define PAS_OBJC_BOUND_FOR_PARTIAL_VIEWS 10 174 #define PAS_OBJC_BOUND_FOR_BASELINE_ALLOCATORS 10 175 #define PAS_OBJC_BOUND_FOR_NO_VIEW_CACHE UINT_MAX 176 #define PAS_OBJC_MAX_SEGREGATED_OBJECT_SIZE UINT_MAX 177 #define PAS_OBJC_MAX_BITFIT_OBJECT_SIZE 0 184 /* This is for heaps of flexible array member objects. These are variable-sized objects of a certain 185 type. We should assume that different-sized instances can only be overlapped at the header. 186 Implementing these as segregated heaps is valid since sizes get segregated and different-sized 187 objects will only overlap at the header. However, FIXME: we need flex heaps to use a large heap 188 that won't overlap objects in these heaps as if they were arrays. */ 189 #define PAS_FLEX_BOUND_FOR_PARTIAL_VIEWS 10 190 #define PAS_FLEX_BOUND_FOR_BASELINE_ALLOCATORS 10 191 #define PAS_FLEX_BOUND_FOR_NO_VIEW_CACHE UINT_MAX 192 #define PAS_FLEX_MAX_SEGREGATED_OBJECT_SIZE UINT_MAX 193 #define PAS_FLEX_MAX_BITFIT_OBJECT_SIZE 0 178 194 179 195 #endif /* PAS_INTERNAL_CONFIG_H */ -
trunk/Source/bmalloc/libpas/src/libpas/pas_large_heap.c
r282556 r283371 44 44 { 45 45 /* Warning: anything you do here must be duplicated in 46 pas_try_allocate_intrinsic _primitive.h. */46 pas_try_allocate_intrinsic.h. */ 47 47 48 48 pas_fast_large_free_heap_construct(&heap->free_heap); -
trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate.h
r282899 r283371 40 40 41 41 PAS_BEGIN_EXTERN_C; 42 43 /* This is for heaps that hold typed objects. These objects have a certain size. We may allocate 44 arrays of these objects, but the entrypoints in this header are for the case where we are allocating 45 just a single instance. We my allocate these objects with any alignment, but the entrypoints in this 46 header are for the case where we are allocating with the alignment that was specified in the 47 heap_ref's type. 48 49 If you want to allocate with nontrivial count (i.e. an array) or nontrivial alignment (i.e. memalign) 50 then use the pas_try_allocate_array.h entrypoints. */ 42 51 43 52 typedef struct { -
trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_array.h
r282556 r283371 1 1 /* 2 * Copyright (c) 2018-202 0Apple Inc. All rights reserved.2 * Copyright (c) 2018-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 38 38 39 39 PAS_BEGIN_EXTERN_C; 40 41 /* This is for heaps that hold typed objects. These objects have a certain size. We may allocate 42 arrays of these objects. The type may tell us an alignment requirement in addition to a size. 43 The alignment requirement is taken together with the minalign argument (the allocator uses 44 whichever is bigger), but it's a bit more optimal to convey alignment using the alignment part 45 of the type than by passing it to minalign. 46 47 The entrypoints in this file are for the most general case of allocating in the typed heap. You 48 can pass any count that is >= 1 and any alignment that is >= 1. Note that these entrypoints have 49 optimizations for alignment == 1 and you get the most benefit from those optimizations if you 50 really pass the constant "1" for alignment (this causes the special memalign logic to be statically 51 killed off by the compiler). If you know that count == 1 and alignment == 1, then you're better off 52 using the pas_try_allocate.h entrypoints. */ 40 53 41 54 static PAS_ALWAYS_INLINE pas_typed_allocation_result -
trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_primitive.h
r282556 r283371 1 1 /* 2 * Copyright (c) 2019-202 0Apple Inc. All rights reserved.2 * Copyright (c) 2019-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 37 37 38 38 PAS_BEGIN_EXTERN_C; 39 40 /* This header provides entrypoints for both primitive and flex heaps. You select the mode by passing 41 either the primitive heap_runtuime_config or the flex heap_runtime_config. 42 43 Primitive heaps are for objects that should be kept separate from the main heap but that otherwise 44 don't have any interesting type. So, they are like intrinsic heaps, but the tuning has to be such 45 that we are efficient for lots of small heaps. But, there's no restriction on whether the data in 46 the heap is reused in any particular way -- we run this with a type size of 1. 47 48 These have all the functionality of intrinsic heaps but are tuned to allow for there to be a 49 variable number of heaps. While libpas knows about every intrinsic heap that a heap_config may 50 have, libpas allows primitive heaps to be created by libpas clients. 51 52 Flex heaps are for flexible array members. Currently we tune them almost exactly like primitive 53 heaps except that bitfit is disabled for flex. 54 55 FIXME: Flex heaps should provide stronger isolation in the large heap. That can be achieved while 56 still keeping these entrypoints. It's just a different large heap reuse policy. */ 39 57 40 58 static PAS_ALWAYS_INLINE pas_allocation_result -
trunk/Source/bmalloc/libpas/src/libpas/pas_try_reallocate.h
r282899 r283371 34 34 #include "pas_try_allocate.h" 35 35 #include "pas_try_allocate_array.h" 36 #include "pas_try_allocate_intrinsic _primitive.h"36 #include "pas_try_allocate_intrinsic.h" 37 37 #include "pas_try_allocate_primitive.h" 38 38 … … 368 368 369 369 typedef struct { 370 pas_try_allocate_intrinsic_ primitive_for_realloc try_allocate_intrinsic_primitive;371 } pas_try_reallocate_intrinsic_ primitive_allocate_data;372 373 static PAS_ALWAYS_INLINE pas_typed_allocation_result 374 pas_try_reallocate_intrinsic_ primitive_allocate_callback(370 pas_try_allocate_intrinsic_for_realloc try_allocate_intrinsic; 371 } pas_try_reallocate_intrinsic_allocate_data; 372 373 static PAS_ALWAYS_INLINE pas_typed_allocation_result 374 pas_try_reallocate_intrinsic_allocate_callback( 375 375 pas_heap* heap, 376 376 size_t new_count, 377 377 void* arg) 378 378 { 379 pas_try_reallocate_intrinsic_ primitive_allocate_data* data;379 pas_try_reallocate_intrinsic_allocate_data* data; 380 380 381 381 PAS_UNUSED_PARAM(heap); 382 382 383 data = (pas_try_reallocate_intrinsic_ primitive_allocate_data*)arg;383 data = (pas_try_reallocate_intrinsic_allocate_data*)arg; 384 384 385 385 return pas_typed_allocation_result_create_with_intrinsic_allocation_result( 386 data->try_allocate_intrinsic _primitive(new_count),386 data->try_allocate_intrinsic(new_count), 387 387 NULL, 388 388 new_count); … … 390 390 391 391 static PAS_ALWAYS_INLINE pas_allocation_result 392 pas_try_reallocate_intrinsic _primitive(392 pas_try_reallocate_intrinsic( 393 393 void* old_ptr, 394 394 pas_heap* heap, 395 395 size_t new_size, 396 396 pas_heap_config config, 397 pas_try_allocate_intrinsic_ primitive_for_realloc try_allocate_intrinsic_primitive,397 pas_try_allocate_intrinsic_for_realloc try_allocate_intrinsic, 398 398 pas_reallocate_heap_teleport_rule teleport_rule, 399 399 pas_reallocate_free_mode free_mode) 400 400 { 401 pas_try_reallocate_intrinsic_ primitive_allocate_data data;402 403 data.try_allocate_intrinsic _primitive = try_allocate_intrinsic_primitive;401 pas_try_reallocate_intrinsic_allocate_data data; 402 403 data.try_allocate_intrinsic = try_allocate_intrinsic; 404 404 405 405 return pas_typed_allocation_result_as_intrinsic_allocation_result( … … 411 411 teleport_rule, 412 412 free_mode, 413 pas_try_reallocate_intrinsic_ primitive_allocate_callback,413 pas_try_reallocate_intrinsic_allocate_callback, 414 414 &data)); 415 415 } -
trunk/Source/bmalloc/libpas/src/libpas/thingy_heap.c
r282556 r283371 36 36 #include "pas_try_allocate.h" 37 37 #include "pas_try_allocate_array.h" 38 #include "pas_try_allocate_intrinsic _primitive.h"38 #include "pas_try_allocate_intrinsic.h" 39 39 #include "pas_try_reallocate.h" 40 40 #include "thingy_heap_config.h" … … 45 45 46 46 pas_heap thingy_primitive_heap = 47 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(47 PAS_INTRINSIC_HEAP_INITIALIZER( 48 48 &thingy_primitive_heap, 49 49 THINGY_TYPE_PRIMITIVE, 50 50 thingy_primitive_heap_support, 51 51 THINGY_HEAP_CONFIG, 52 &thingy_intrinsic_ primitive_runtime_config.base);52 &thingy_intrinsic_runtime_config.base); 53 53 54 54 pas_intrinsic_heap_support thingy_utility_heap_support = PAS_INTRINSIC_HEAP_SUPPORT_INITIALIZER; 55 55 56 56 pas_heap thingy_utility_heap = 57 PAS_INTRINSIC_ PRIMITIVE_HEAP_INITIALIZER(57 PAS_INTRINSIC_HEAP_INITIALIZER( 58 58 &thingy_utility_heap, 59 59 THINGY_TYPE_PRIMITIVE, 60 60 thingy_utility_heap_support, 61 61 THINGY_HEAP_CONFIG, 62 &thingy_intrinsic_ primitive_runtime_config.base);62 &thingy_intrinsic_runtime_config.base); 63 63 64 64 pas_allocator_counts thingy_allocator_counts; 65 65 66 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(66 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 67 67 try_allocate_primitive, 68 68 THINGY_HEAP_CONFIG, 69 &thingy_intrinsic_ primitive_runtime_config.base,69 &thingy_intrinsic_runtime_config.base, 70 70 &thingy_allocator_counts, 71 71 pas_allocation_result_identity, … … 91 91 void* thingy_try_reallocate_primitive(void* old_ptr, size_t new_size) 92 92 { 93 return (void*)pas_try_reallocate_intrinsic _primitive(93 return (void*)pas_try_reallocate_intrinsic( 94 94 old_ptr, 95 95 &thingy_primitive_heap, … … 166 166 } 167 167 168 PAS_CREATE_TRY_ALLOCATE_INTRINSIC _PRIMITIVE(168 PAS_CREATE_TRY_ALLOCATE_INTRINSIC( 169 169 utility_heap_allocate, 170 170 THINGY_HEAP_CONFIG, 171 &thingy_intrinsic_ primitive_runtime_config.base,171 &thingy_intrinsic_runtime_config.base, 172 172 &thingy_allocator_counts, 173 173 pas_allocation_result_crash_on_error, -
trunk/Source/bmalloc/libpas/src/libpas/thingy_heap_config.c
r282556 r283371 39 39 thingy, THINGY, 40 40 .allocate_page_should_zero = true, 41 .intrinsic_ primitive_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity);41 .intrinsic_view_cache_capacity = pas_heap_runtime_config_zero_view_cache_capacity); 42 42 43 43 #endif /* PAS_ENABLE_THINGY */ -
trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp
r282556 r283371 1064 1064 selectedAllocateCommonPrimitive = bmalloc_allocate; 1065 1065 selectedAllocate = bmalloc_iso_allocate; 1066 selectedAllocateArray = nullptr;1066 selectedAllocateArray = bmalloc_iso_allocate_array_with_alignment; 1067 1067 selectedDeallocate = bmalloc_deallocate; 1068 1068 selectedCommonPrimitiveHeap = &bmalloc_common_primitive_heap; -
trunk/Source/bmalloc/libpas/src/test/TestHarness.cpp
r282556 r283371 86 86 87 87 #define FOR_EACH_RUNTIME_CONFIG(name, callback) ({ \ 88 (callback)(name ## _intrinsic_ primitive_runtime_config.base); \88 (callback)(name ## _intrinsic_runtime_config.base); \ 89 89 (callback)(name ## _primitive_runtime_config.base); \ 90 90 (callback)(name ## _typed_runtime_config.base); \ 91 (callback)(name ## _ objc_runtime_config.base); \91 (callback)(name ## _flex_runtime_config.base); \ 92 92 }) 93 93
Note: See TracChangeset
for help on using the changeset viewer.