Changeset 283371 in webkit


Ignore:
Timestamp:
Oct 1, 2021 9:19:16 AM (3 years ago)
Author:
fpizlo@apple.com
Message:

[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)
https://bugs.webkit.org/show_bug.cgi?id=231040

Reviewed by Saam Barati.

At some point a long time ago, libpas had sensible names for heap runtime configs: primitive
and typed. Then I added the "objc" category, not realizing that I was really adding support for
flexible array members. And then I added "intrinsic_primitive", but wow, what a mouthful.

This changes the heap names to:

intrinsic: singleton heaps for primitive data, like the normal fastMalloc heap
primitive: isoheaps for primitive data
typed: isoheaps for fixed-size types
flex: isoheaps for types with flexible array members

Also adds comments explaining the exact behaviors of these heaps.

Also exposes isoheaped array allocation through the bmalloc_heap API. That's not yet exposed
via the IsoHeap API, but the idea is that it will be -- just need to figure out a clean way to
do it.

  • bmalloc.xcodeproj/project.pbxproj:
  • bmalloc/bmalloc.cpp:

(bmalloc::api::enableMiniMode):

  • libpas/common.sh:
  • libpas/src/chaos/Chaos.cpp:

(main):

  • libpas/src/libpas/bmalloc_heap.c:

(bmalloc_try_iso_allocate_array):
(bmalloc_iso_allocate_array):
(bmalloc_try_iso_allocate_array_with_alignment):
(bmalloc_iso_allocate_array_with_alignment):

  • libpas/src/libpas/bmalloc_heap.h:
  • libpas/src/libpas/bmalloc_heap_config.c:
  • libpas/src/libpas/bmalloc_heap_inlines.h:

(bmalloc_try_reallocate_inline):
(bmalloc_reallocate_inline):
(bmalloc_try_iso_allocate_array_inline):
(bmalloc_try_iso_allocate_array_with_alignment_inline):
(bmalloc_iso_allocate_array_inline):
(bmalloc_iso_allocate_array_with_alignment_inline):

  • libpas/src/libpas/hotbit_heap.c:
  • libpas/src/libpas/hotbit_heap_config.c:
  • libpas/src/libpas/hotbit_heap_inlines.h:

(hotbit_try_reallocate_inline):

  • libpas/src/libpas/iso_heap.c:

(iso_try_allocate_for_flex):
(iso_try_allocate_for_objc): Deleted.

  • libpas/src/libpas/iso_heap.h:
  • libpas/src/libpas/iso_heap_config.c:
  • libpas/src/libpas/iso_heap_inlines.h:

(iso_try_reallocate_common_primitive_inline):
(iso_reallocate_common_primitive_inline):
(iso_try_allocate_for_flex_inline):
(iso_try_allocate_for_objc_inline): Deleted.

  • libpas/src/libpas/iso_heap_innards.h:
  • libpas/src/libpas/iso_test_heap.c:
  • libpas/src/libpas/iso_test_heap_config.c:
  • libpas/src/libpas/jit_heap.c:
  • libpas/src/libpas/minalign32_heap.c:
  • libpas/src/libpas/minalign32_heap_config.c:
  • libpas/src/libpas/pagesize64k_heap.c:
  • libpas/src/libpas/pagesize64k_heap_config.c:
  • libpas/src/libpas/pas_heap_config_utils.h:
  • libpas/src/libpas/pas_heap_config_utils_inlines.h:
  • libpas/src/libpas/pas_internal_config.h:
  • libpas/src/libpas/pas_large_heap.c:

(pas_large_heap_construct):

  • libpas/src/libpas/pas_try_allocate.h:
  • libpas/src/libpas/pas_try_allocate_array.h:
  • libpas/src/libpas/pas_try_allocate_intrinsic.h: Added.

(pas_try_allocate_intrinsic_impl_medium_slow_case):
(pas_try_allocate_intrinsic_impl_inline_only):

  • libpas/src/libpas/pas_try_allocate_intrinsic_primitive.h: Removed.
  • libpas/src/libpas/pas_try_allocate_primitive.h:
  • libpas/src/libpas/pas_try_reallocate.h:

(pas_try_reallocate_intrinsic_allocate_callback):
(pas_try_reallocate_intrinsic):
(pas_try_reallocate_intrinsic_primitive_allocate_callback): Deleted.
(pas_try_reallocate_intrinsic_primitive): Deleted.

  • libpas/src/libpas/thingy_heap.c:

(thingy_try_reallocate_primitive):

  • libpas/src/libpas/thingy_heap_config.c:
  • libpas/src/test/IsoHeapChaosTests.cpp:

(addIsoHeapChaosTests):

  • libpas/src/test/TestHarness.cpp:
Location:
trunk/Source/bmalloc
Files:
1 added
1 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r283285 r283371  
     12021-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
    1912021-09-29  Basuke Suzuki  <basuke.suzuki@sony.com>
    292
  • trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj

    r282556 r283371  
    7676                0F74B93E1F89713E00B935D3 /* CryptoRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F74B93C1F89713E00B935D3 /* CryptoRandom.h */; settings = {ATTRIBUTES = (Private, ); }; };
    7777                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, ); }; };
    7879                0F75498224869740002A4C7D /* pas_allocator_index.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7549802486973C002A4C7D /* pas_allocator_index.h */; settings = {ATTRIBUTES = (Private, ); }; };
    7980                0F75498324869742002A4C7D /* pas_compact_atomic_allocator_index_ptr.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7549812486973C002A4C7D /* pas_compact_atomic_allocator_index_ptr.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    462463                0FC40B612451499400876DA0 /* pas_segregated_view_kind.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC40A852451498C00876DA0 /* pas_segregated_view_kind.h */; settings = {ATTRIBUTES = (Private, ); }; };
    463464                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, ); }; };
    465465                0FC40B642451499400876DA0 /* pas_segregated_shared_view_inlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC40A882451498C00876DA0 /* pas_segregated_shared_view_inlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
    466466                0FC40B652451499400876DA0 /* pas_page_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 0FC40A892451498C00876DA0 /* pas_page_malloc.c */; };
     
    723723                0F74B93C1F89713E00B935D3 /* CryptoRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoRandom.h; path = bmalloc/CryptoRandom.h; sourceTree = "<group>"; };
    724724                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>"; };
    725726                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>"; };
    726727                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>"; };
     
    11131114                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>"; };
    11141115                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>"; };
    11161116                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>"; };
    11171117                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>"; };
     
    18651865                                0FC40A522451498800876DA0 /* pas_try_allocate_array.h */,
    18661866                                0FC40A392451498600876DA0 /* pas_try_allocate_common.h */,
    1867                                 0FC40A872451498C00876DA0 /* pas_try_allocate_intrinsic_primitive.h */,
     1867                                0F752D9127066FCB00ADF74D /* pas_try_allocate_intrinsic.h */,
    18681868                                0FC40A2B2451498500876DA0 /* pas_try_allocate_primitive.h */,
    18691869                                0FC40A652451498900876DA0 /* pas_try_allocate.h */,
     
    21102110                                0F7EB8231F9541B000F1ABCB /* EligibilityResult.h in Headers */,
    21112111                                0F7EB8381F9541B000F1ABCB /* EligibilityResultInlines.h in Headers */,
     2112                                0F752D9227066FCB00ADF74D /* pas_try_allocate_intrinsic.h in Headers */,
    21122113                                14895D921A3A319C0006235D /* Environment.h in Headers */,
    21132114                                FE48BD3B2321E8D700F136D0 /* FailureAction.h in Headers */,
     
    24982499                                0FC40B302451499400876DA0 /* pas_try_allocate_array.h in Headers */,
    24992500                                0FC40B182451499400876DA0 /* pas_try_allocate_common.h in Headers */,
    2500                                 0FC40B632451499400876DA0 /* pas_try_allocate_intrinsic_primitive.h in Headers */,
    25012501                                0FC40B0A2451499400876DA0 /* pas_try_allocate_primitive.h in Headers */,
    25022502                                0FC40B0F2451499400876DA0 /* pas_try_reallocate.h in Headers */,
  • trunk/Source/bmalloc/bmalloc/bmalloc.cpp

    r279867 r283371  
    201201
    202202    // 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;
    205205    bmalloc_primitive_runtime_config.base.max_segregated_object_size = 0;
    206206    bmalloc_primitive_runtime_config.base.max_bitfit_object_size = UINT_MAX;
  • trunk/Source/bmalloc/libpas/common.sh

    r279867 r283371  
    2525set -x
    2626
    27 config=Debug
     27config=Release
    2828sdk=macosx.internal
    2929archs=blank
  • trunk/Source/bmalloc/libpas/src/chaos/Chaos.cpp

    r279867 r283371  
    363363
    364364    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;
    366366
    367367    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;
    369369
    370370    pas_status_reporter_enabled = enableStatusReporter;
  • trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap.c

    r282556 r283371  
    4040
    4141pas_heap bmalloc_common_primitive_heap =
    42     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     42    PAS_INTRINSIC_HEAP_INITIALIZER(
    4343        &bmalloc_common_primitive_heap,
    4444        PAS_SIMPLE_TYPE_CREATE(1, 1),
    4545        bmalloc_common_primitive_heap_support,
    4646        BMALLOC_HEAP_CONFIG,
    47         &bmalloc_intrinsic_primitive_runtime_config.base);
     47        &bmalloc_intrinsic_runtime_config.base);
    4848
    4949pas_allocator_counts bmalloc_allocator_counts;
     
    104104{
    105105    return bmalloc_iso_allocate_inline(heap_ref);
     106}
     107
     108void* 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
     113void* 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
     118void* 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
     124void* 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);
    106128}
    107129
  • trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap.h

    r279867 r283371  
    5656PAS_API void* bmalloc_iso_allocate(pas_heap_ref* heap_ref);
    5757
     58PAS_API void* bmalloc_try_iso_allocate_array(pas_heap_ref* heap_ref, size_t count);
     59PAS_API void* bmalloc_iso_allocate_array(pas_heap_ref* heap_ref, size_t count);
     60
     61PAS_API void* bmalloc_try_iso_allocate_array_with_alignment(
     62    pas_heap_ref* heap_ref, size_t count, size_t alignment);
     63PAS_API void* bmalloc_iso_allocate_array_with_alignment(
     64    pas_heap_ref* heap_ref, size_t count, size_t alignment);
     65
    5866PAS_API pas_heap* bmalloc_heap_ref_get_heap(pas_heap_ref* heap_ref);
    5967
  • trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_config.c

    r282899 r283371  
    4242    bmalloc, BMALLOC,
    4343    .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);
    4545
    4646void bmalloc_heap_config_activate(void)
  • trunk/Source/bmalloc/libpas/src/libpas/bmalloc_heap_inlines.h

    r282556 r283371  
    3232#include "pas_deallocate.h"
    3333#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"
    3536#include "pas_try_allocate_primitive.h"
    3637#include "pas_try_reallocate.h"
     
    4041PAS_BEGIN_EXTERN_C;
    4142
    42 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     43PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    4344    bmalloc_try_allocate_impl,
    4445    BMALLOC_HEAP_CONFIG,
    45     &bmalloc_intrinsic_primitive_runtime_config.base,
     46    &bmalloc_intrinsic_runtime_config.base,
    4647    &bmalloc_allocator_counts,
    4748    pas_allocation_result_identity,
     
    5253/* Need to create a different set of allocation functions if we want to pass nontrivial alignment,
    5354   since in that case we do not want to use the fancy lookup path. */
    54 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     55PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    5556    bmalloc_try_allocate_with_alignment_impl,
    5657    BMALLOC_HEAP_CONFIG,
    57     &bmalloc_intrinsic_primitive_runtime_config.base,
     58    &bmalloc_intrinsic_runtime_config.base,
    5859    &bmalloc_allocator_counts,
    5960    pas_allocation_result_identity,
     
    6263    pas_intrinsic_heap_is_not_designated);
    6364
    64 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     65PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    6566    bmalloc_allocate_impl,
    6667    BMALLOC_HEAP_CONFIG,
    67     &bmalloc_intrinsic_primitive_runtime_config.base,
     68    &bmalloc_intrinsic_runtime_config.base,
    6869    &bmalloc_allocator_counts,
    6970    pas_allocation_result_crash_on_error,
     
    7273    pas_intrinsic_heap_is_designated);
    7374
    74 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     75PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    7576    bmalloc_allocate_with_alignment_impl,
    7677    BMALLOC_HEAP_CONFIG,
    77     &bmalloc_intrinsic_primitive_runtime_config.base,
     78    &bmalloc_intrinsic_runtime_config.base,
    7879    &bmalloc_allocator_counts,
    7980    pas_allocation_result_crash_on_error,
     
    128129                              pas_reallocate_free_mode free_mode)
    129130{
    130     return (void*)pas_try_reallocate_intrinsic_primitive(
     131    return (void*)pas_try_reallocate_intrinsic(
    131132        old_ptr,
    132133        &bmalloc_common_primitive_heap,
     
    142143                          pas_reallocate_free_mode free_mode)
    143144{
    144     return (void*)pas_try_reallocate_intrinsic_primitive(
     145    return (void*)pas_try_reallocate_intrinsic(
    145146        old_ptr,
    146147        &bmalloc_common_primitive_heap,
     
    174175{
    175176    return bmalloc_iso_allocate_impl(heap_ref).ptr;
     177}
     178
     179PAS_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
     186static 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
     192static 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
     198PAS_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
     205static 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
     211static 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;
    176215}
    177216
  • trunk/Source/bmalloc/libpas/src/libpas/hotbit_heap.c

    r279867 r283371  
    3939
    4040pas_heap hotbit_common_primitive_heap =
    41     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     41    PAS_INTRINSIC_HEAP_INITIALIZER(
    4242        &hotbit_common_primitive_heap,
    4343        PAS_SIMPLE_TYPE_CREATE(1, 1),
    4444        hotbit_common_primitive_heap_support,
    4545        HOTBIT_HEAP_CONFIG,
    46         &hotbit_intrinsic_primitive_runtime_config.base);
     46        &hotbit_intrinsic_runtime_config.base);
    4747
    4848pas_allocator_counts hotbit_allocator_counts;
  • trunk/Source/bmalloc/libpas/src/libpas/hotbit_heap_config.c

    r282556 r283371  
    4141    hotbit, HOTBIT,
    4242    .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);
    4444
    4545void hotbit_heap_config_activate(void)
  • trunk/Source/bmalloc/libpas/src/libpas/hotbit_heap_inlines.h

    r282556 r283371  
    3131#include "hotbit_heap_innards.h"
    3232#include "pas_deallocate.h"
    33 #include "pas_try_allocate_intrinsic_primitive.h"
     33#include "pas_try_allocate_intrinsic.h"
    3434#include "pas_try_reallocate.h"
    3535
     
    3838PAS_BEGIN_EXTERN_C;
    3939
    40 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     40PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    4141    hotbit_try_allocate_impl,
    4242    HOTBIT_HEAP_CONFIG,
    43     &hotbit_intrinsic_primitive_runtime_config.base,
     43    &hotbit_intrinsic_runtime_config.base,
    4444    &hotbit_allocator_counts,
    4545    pas_allocation_result_identity,
     
    5050/* Need to create a different set of allocation functions if we want to pass nontrivial alignment,
    5151   since in that case we do not want to use the fancy lookup path. */
    52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     52PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    5353    hotbit_try_allocate_with_alignment_impl,
    5454    HOTBIT_HEAP_CONFIG,
    55     &hotbit_intrinsic_primitive_runtime_config.base,
     55    &hotbit_intrinsic_runtime_config.base,
    5656    &hotbit_allocator_counts,
    5757    pas_allocation_result_identity,
     
    7575                              pas_reallocate_free_mode free_mode)
    7676{
    77     return (void*)pas_try_reallocate_intrinsic_primitive(
     77    return (void*)pas_try_reallocate_intrinsic(
    7878        old_ptr,
    7979        &hotbit_common_primitive_heap,
  • trunk/Source/bmalloc/libpas/src/libpas/iso_heap.c

    r279867 r283371  
    3737#include "pas_try_allocate.h"
    3838#include "pas_try_allocate_array.h"
    39 #include "pas_try_allocate_intrinsic_primitive.h"
     39#include "pas_try_allocate_intrinsic.h"
    4040#include "pas_try_allocate_primitive.h"
    4141#include "pas_try_reallocate.h"
     
    4545
    4646pas_heap iso_common_primitive_heap =
    47     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     47    PAS_INTRINSIC_HEAP_INITIALIZER(
    4848        &iso_common_primitive_heap,
    4949        PAS_SIMPLE_TYPE_CREATE(1, 1),
    5050        iso_common_primitive_heap_support,
    5151        ISO_HEAP_CONFIG,
    52         &iso_intrinsic_primitive_runtime_config.base);
     52        &iso_intrinsic_runtime_config.base);
    5353
    5454pas_allocator_counts iso_allocator_counts;
     
    5656pas_dynamic_primitive_heap_map iso_primitive_dynamic_heap_map =
    5757    PAS_DYNAMIC_PRIMITIVE_HEAP_MAP_INITIALIZER(iso_primitive_heap_ref_construct);
    58 pas_dynamic_primitive_heap_map iso_objc_dynamic_heap_map =
     58pas_dynamic_primitive_heap_map iso_flex_dynamic_heap_map =
    5959    PAS_DYNAMIC_PRIMITIVE_HEAP_MAP_INITIALIZER(iso_primitive_heap_ref_construct);
    6060
     
    265265}
    266266
    267 void* iso_try_allocate_for_objc(const void* cls, size_t size)
    268 {
    269     return iso_try_allocate_for_objc_inline(cls, size);
     267void* iso_try_allocate_for_flex(const void* cls, size_t size)
     268{
     269    return iso_try_allocate_for_flex_inline(cls, size);
    270270}
    271271
  • trunk/Source/bmalloc/libpas/src/libpas/iso_heap.h

    r279867 r283371  
    118118PAS_API pas_heap* iso_primitive_heap_ref_get_heap(pas_primitive_heap_ref* heap_ref);
    119119
    120 PAS_API void* iso_try_allocate_for_objc(const void* cls, size_t size);
     120PAS_API void* iso_try_allocate_for_flex(const void* cls, size_t size);
    121121
    122122PAS_API bool iso_has_object(void*);
  • trunk/Source/bmalloc/libpas/src/libpas/iso_heap_config.c

    r282556 r283371  
    3939    iso, ISO,
    4040    .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);
    4242
    4343#endif /* PAS_ENABLE_ISO */
  • trunk/Source/bmalloc/libpas/src/libpas/iso_heap_inlines.h

    r282556 r283371  
    3636#include "pas_try_allocate.h"
    3737#include "pas_try_allocate_array.h"
    38 #include "pas_try_allocate_intrinsic_primitive.h"
     38#include "pas_try_allocate_intrinsic.h"
    3939#include "pas_try_allocate_primitive.h"
    4040#include "pas_try_reallocate.h"
     
    4444PAS_BEGIN_EXTERN_C;
    4545
    46 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     46PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    4747    iso_try_allocate_common_primitive_impl,
    4848    ISO_HEAP_CONFIG,
    49     &iso_intrinsic_primitive_runtime_config.base,
     49    &iso_intrinsic_runtime_config.base,
    5050    &iso_allocator_counts,
    5151    pas_allocation_result_set_errno,
     
    5656/* Need to create a different set of allocation functions if we want to pass nontrivial alignment,
    5757   since in that case we do not want to use the fancy lookup path. */
    58 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     58PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    5959    iso_try_allocate_common_primitive_with_alignment_impl,
    6060    ISO_HEAP_CONFIG,
    61     &iso_intrinsic_primitive_runtime_config.base,
     61    &iso_intrinsic_runtime_config.base,
    6262    &iso_allocator_counts,
    6363    pas_allocation_result_set_errno,
     
    6666    pas_intrinsic_heap_is_not_designated);
    6767
    68 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     68PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    6969    iso_allocate_common_primitive_impl,
    7070    ISO_HEAP_CONFIG,
    71     &iso_intrinsic_primitive_runtime_config.base,
     71    &iso_intrinsic_runtime_config.base,
    7272    &iso_allocator_counts,
    7373    pas_allocation_result_crash_on_error,
     
    7676    pas_intrinsic_heap_is_not_designated);
    7777
    78 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     78PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    7979    iso_allocate_common_primitive_with_alignment_impl,
    8080    ISO_HEAP_CONFIG,
    81     &iso_intrinsic_primitive_runtime_config.base,
     81    &iso_intrinsic_runtime_config.base,
    8282    &iso_allocator_counts,
    8383    pas_allocation_result_crash_on_error,
     
    126126                                           pas_reallocate_free_mode free_mode)
    127127{
    128     return (void*)pas_try_reallocate_intrinsic_primitive(
     128    return (void*)pas_try_reallocate_intrinsic(
    129129        old_ptr,
    130130        &iso_common_primitive_heap,
     
    140140                                       pas_reallocate_free_mode free_mode)
    141141{
    142     return (void*)pas_try_reallocate_intrinsic_primitive(
     142    return (void*)pas_try_reallocate_intrinsic(
    143143        old_ptr,
    144144        &iso_common_primitive_heap,
     
    334334
    335335PAS_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,
    339339    &iso_allocator_counts,
    340340    pas_allocation_result_set_errno);
    341341
    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(
     342static 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(
    346346            pas_dynamic_primitive_heap_map_find(
    347                 &iso_objc_dynamic_heap_map, cls, size),
     347                &iso_flex_dynamic_heap_map, cls, size),
    348348            size, 1),
    349349        size).begin;
  • trunk/Source/bmalloc/libpas/src/libpas/iso_heap_innards.h

    r279867 r283371  
    4242
    4343PAS_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;
     44PAS_API extern pas_dynamic_primitive_heap_map iso_flex_dynamic_heap_map;
    4545
    4646PAS_END_EXTERN_C;
  • trunk/Source/bmalloc/libpas/src/libpas/iso_test_heap.c

    r282556 r283371  
    3838#include "pas_try_allocate.h"
    3939#include "pas_try_allocate_array.h"
    40 #include "pas_try_allocate_intrinsic_primitive.h"
     40#include "pas_try_allocate_intrinsic.h"
    4141
    4242pas_intrinsic_heap_support iso_test_common_primitive_heap_support =
     
    4444
    4545pas_heap iso_test_common_primitive_heap =
    46     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     46    PAS_INTRINSIC_HEAP_INITIALIZER(
    4747        &iso_test_common_primitive_heap,
    4848        PAS_SIMPLE_TYPE_CREATE(1, 1),
    4949        iso_test_common_primitive_heap_support,
    5050        ISO_TEST_HEAP_CONFIG,
    51         &iso_test_intrinsic_primitive_runtime_config.base);
     51        &iso_test_intrinsic_runtime_config.base);
    5252
    53 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     53PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    5454    test_allocate_common_primitive,
    5555    ISO_TEST_HEAP_CONFIG,
    56     &iso_test_intrinsic_primitive_runtime_config.base,
     56    &iso_test_intrinsic_runtime_config.base,
    5757    &iso_allocator_counts,
    5858    pas_allocation_result_crash_on_error,
  • trunk/Source/bmalloc/libpas/src/libpas/iso_test_heap_config.c

    r282556 r283371  
    3939    iso_test, ISO_TEST,
    4040    .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);
    4242
    4343#endif /* PAS_ENABLE_ISO_TEST */
  • trunk/Source/bmalloc/libpas/src/libpas/jit_heap.c

    r282899 r283371  
    3535#include "pas_deallocate.h"
    3636#include "pas_get_allocation_size.h"
    37 #include "pas_try_allocate_intrinsic_primitive.h"
     37#include "pas_try_allocate_intrinsic.h"
    3838#include "pas_try_shrink.h"
    3939
    40 pas_heap jit_common_primitive_heap = PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     40pas_heap jit_common_primitive_heap = PAS_INTRINSIC_HEAP_INITIALIZER(
    4141    &jit_common_primitive_heap,
    4242    NULL,
     
    6161}
    6262
    63 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     63PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    6464    jit_try_allocate_common_primitive_impl,
    6565    JIT_HEAP_CONFIG,
  • trunk/Source/bmalloc/libpas/src/libpas/minalign32_heap.c

    r282556 r283371  
    3737#include "pas_try_allocate.h"
    3838#include "pas_try_allocate_array.h"
    39 #include "pas_try_allocate_intrinsic_primitive.h"
     39#include "pas_try_allocate_intrinsic.h"
    4040
    4141pas_intrinsic_heap_support minalign32_common_primitive_heap_support =
     
    4343
    4444pas_heap minalign32_common_primitive_heap =
    45     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     45    PAS_INTRINSIC_HEAP_INITIALIZER(
    4646        &minalign32_common_primitive_heap,
    4747        PAS_SIMPLE_TYPE_CREATE(1, 1),
    4848        minalign32_common_primitive_heap_support,
    4949        MINALIGN32_HEAP_CONFIG,
    50         &minalign32_intrinsic_primitive_runtime_config.base);
     50        &minalign32_intrinsic_runtime_config.base);
    5151
    52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     52PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    5353    test_allocate_common_primitive,
    5454    MINALIGN32_HEAP_CONFIG,
    55     &minalign32_intrinsic_primitive_runtime_config.base,
     55    &minalign32_intrinsic_runtime_config.base,
    5656    &iso_allocator_counts,
    5757    pas_allocation_result_crash_on_error,
  • trunk/Source/bmalloc/libpas/src/libpas/minalign32_heap_config.c

    r282556 r283371  
    4141    minalign32, MINALIGN32,
    4242    .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);
    4444
    4545void minalign32_heap_config_activate(void)
  • trunk/Source/bmalloc/libpas/src/libpas/pagesize64k_heap.c

    r282556 r283371  
    3737#include "pas_try_allocate.h"
    3838#include "pas_try_allocate_array.h"
    39 #include "pas_try_allocate_intrinsic_primitive.h"
     39#include "pas_try_allocate_intrinsic.h"
    4040
    4141pas_intrinsic_heap_support pagesize64k_common_primitive_heap_support =
     
    4343
    4444pas_heap pagesize64k_common_primitive_heap =
    45     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     45    PAS_INTRINSIC_HEAP_INITIALIZER(
    4646        &pagesize64k_common_primitive_heap,
    4747        PAS_SIMPLE_TYPE_CREATE(1, 1),
    4848        pagesize64k_common_primitive_heap_support,
    4949        PAGESIZE64K_HEAP_CONFIG,
    50         &pagesize64k_intrinsic_primitive_runtime_config.base);
     50        &pagesize64k_intrinsic_runtime_config.base);
    5151
    52 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     52PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    5353    test_allocate_common_primitive,
    5454    PAGESIZE64K_HEAP_CONFIG,
    55     &pagesize64k_intrinsic_primitive_runtime_config.base,
     55    &pagesize64k_intrinsic_runtime_config.base,
    5656    &iso_allocator_counts,
    5757    pas_allocation_result_crash_on_error,
  • trunk/Source/bmalloc/libpas/src/libpas/pagesize64k_heap_config.c

    r282556 r283371  
    4141    pagesize64k, PAGESIZE64K,
    4242    .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);
    4444
    4545void pagesize64k_heap_config_activate(void)
  • trunk/Source/bmalloc/libpas/src/libpas/pas_heap_config_utils.h

    r282556 r283371  
    351351    PAS_API extern pas_page_header_table name ## _marge_page_header_table; \
    352352    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; \
    354354    PAS_API extern pas_basic_heap_runtime_config name ## _primitive_runtime_config; \
    355355    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; \
    357357    \
    358358    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  
    4949typedef struct {
    5050    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;
    5252} pas_basic_heap_config_definitions_arguments;
    5353
     
    5757                                               PAS_MEDIUM_SHARED_PAGE_LOG_SHIFT); \
    5858    \
    59     pas_basic_heap_runtime_config name ## _intrinsic_primitive_runtime_config = { \
     59    pas_basic_heap_runtime_config name ## _intrinsic_runtime_config = { \
    6060        .base = { \
    6161            .lookup_kind = pas_segregated_heap_lookup_primitive, \
     
    6464            .is_part_of_heap = true, \
    6565            .directory_size_bound_for_partial_views = \
    66                 PAS_INTRINSIC_PRIMITIVE_BOUND_FOR_PARTIAL_VIEWS, \
     66                PAS_INTRINSIC_BOUND_FOR_PARTIAL_VIEWS, \
    6767            .directory_size_bound_for_baseline_allocators = \
    68                 PAS_INTRINSIC_PRIMITIVE_BOUND_FOR_BASELINE_ALLOCATORS, \
     68                PAS_INTRINSIC_BOUND_FOR_BASELINE_ALLOCATORS, \
    6969            .directory_size_bound_for_no_view_cache = \
    70                 PAS_INTRINSIC_PRIMITIVE_BOUND_FOR_NO_VIEW_CACHE, \
     70                PAS_INTRINSIC_BOUND_FOR_NO_VIEW_CACHE, \
    7171            .max_segregated_object_size = \
    72                 PAS_INTRINSIC_PRIMITIVE_MAX_SEGREGATED_OBJECT_SIZE, \
     72                PAS_INTRINSIC_MAX_SEGREGATED_OBJECT_SIZE, \
    7373            .max_bitfit_object_size = \
    74                 PAS_INTRINSIC_PRIMITIVE_MAX_BITFIT_OBJECT_SIZE, \
     74                PAS_INTRINSIC_MAX_BITFIT_OBJECT_SIZE, \
    7575            .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, \
    7777        }, \
    7878        .page_caches = &name ## _page_caches \
     
    121121    }; \
    122122    \
    123     pas_basic_heap_runtime_config name ## _objc_runtime_config = { \
     123    pas_basic_heap_runtime_config name ## _flex_runtime_config = { \
    124124        .base = { \
    125125            .lookup_kind = pas_segregated_heap_lookup_primitive, \
     
    128128            .is_part_of_heap = true, \
    129129            .directory_size_bound_for_partial_views = \
    130                 PAS_OBJC_BOUND_FOR_PARTIAL_VIEWS, \
     130                PAS_FLEX_BOUND_FOR_PARTIAL_VIEWS, \
    131131            .directory_size_bound_for_baseline_allocators = \
    132                 PAS_OBJC_BOUND_FOR_BASELINE_ALLOCATORS, \
     132                PAS_FLEX_BOUND_FOR_BASELINE_ALLOCATORS, \
    133133            .directory_size_bound_for_no_view_cache = \
    134                 PAS_OBJC_BOUND_FOR_NO_VIEW_CACHE, \
     134                PAS_FLEX_BOUND_FOR_NO_VIEW_CACHE, \
    135135            .max_segregated_object_size = \
    136                 PAS_OBJC_MAX_SEGREGATED_OBJECT_SIZE, \
     136                PAS_FLEX_MAX_SEGREGATED_OBJECT_SIZE, \
    137137            .max_bitfit_object_size = \
    138                 PAS_OBJC_MAX_BITFIT_OBJECT_SIZE, \
     138                PAS_FLEX_MAX_BITFIT_OBJECT_SIZE, \
    139139            .view_cache_capacity_for_object_size = pas_heap_runtime_config_zero_view_cache_capacity, \
    140140        }, \
  • trunk/Source/bmalloc/libpas/src/libpas/pas_internal_config.h

    r282556 r283371  
    153153#define PAS_UTILITY_MAX_BITFIT_OBJECT_SIZE                      0
    154154
    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
    160162
     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. */
    161167#define PAS_PRIMITIVE_BOUND_FOR_PARTIAL_VIEWS                   0
    162168#define PAS_PRIMITIVE_BOUND_FOR_BASELINE_ALLOCATORS             0
     
    165171#define PAS_PRIMITIVE_MAX_BITFIT_OBJECT_SIZE                    UINT_MAX
    166172
     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. */
    167178#define PAS_TYPED_BOUND_FOR_PARTIAL_VIEWS                       10
    168179#define PAS_TYPED_BOUND_FOR_BASELINE_ALLOCATORS                 0
     
    171182#define PAS_TYPED_MAX_BITFIT_OBJECT_SIZE                        0
    172183
    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
    178194
    179195#endif /* PAS_INTERNAL_CONFIG_H */
  • trunk/Source/bmalloc/libpas/src/libpas/pas_large_heap.c

    r282556 r283371  
    4444{
    4545    /* Warning: anything you do here must be duplicated in
    46        pas_try_allocate_intrinsic_primitive.h. */
     46       pas_try_allocate_intrinsic.h. */
    4747   
    4848    pas_fast_large_free_heap_construct(&heap->free_heap);
  • trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate.h

    r282899 r283371  
    4040
    4141PAS_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. */
    4251
    4352typedef struct {
  • trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_array.h

    r282556 r283371  
    11/*
    2  * Copyright (c) 2018-2020 Apple Inc. All rights reserved.
     2 * Copyright (c) 2018-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838
    3939PAS_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. */
    4053
    4154static PAS_ALWAYS_INLINE pas_typed_allocation_result
  • trunk/Source/bmalloc/libpas/src/libpas/pas_try_allocate_primitive.h

    r282556 r283371  
    11/*
    2  * Copyright (c) 2019-2020 Apple Inc. All rights reserved.
     2 * Copyright (c) 2019-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3737
    3838PAS_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. */
    3957
    4058static PAS_ALWAYS_INLINE pas_allocation_result
  • trunk/Source/bmalloc/libpas/src/libpas/pas_try_reallocate.h

    r282899 r283371  
    3434#include "pas_try_allocate.h"
    3535#include "pas_try_allocate_array.h"
    36 #include "pas_try_allocate_intrinsic_primitive.h"
     36#include "pas_try_allocate_intrinsic.h"
    3737#include "pas_try_allocate_primitive.h"
    3838
     
    368368
    369369typedef 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
     373static PAS_ALWAYS_INLINE pas_typed_allocation_result
     374pas_try_reallocate_intrinsic_allocate_callback(
    375375    pas_heap* heap,
    376376    size_t new_count,
    377377    void* arg)
    378378{
    379     pas_try_reallocate_intrinsic_primitive_allocate_data* data;
     379    pas_try_reallocate_intrinsic_allocate_data* data;
    380380
    381381    PAS_UNUSED_PARAM(heap);
    382382   
    383     data = (pas_try_reallocate_intrinsic_primitive_allocate_data*)arg;
     383    data = (pas_try_reallocate_intrinsic_allocate_data*)arg;
    384384   
    385385    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),
    387387        NULL,
    388388        new_count);
     
    390390
    391391static PAS_ALWAYS_INLINE pas_allocation_result
    392 pas_try_reallocate_intrinsic_primitive(
     392pas_try_reallocate_intrinsic(
    393393    void* old_ptr,
    394394    pas_heap* heap,
    395395    size_t new_size,
    396396    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,
    398398    pas_reallocate_heap_teleport_rule teleport_rule,
    399399    pas_reallocate_free_mode free_mode)
    400400{
    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;
    404404   
    405405    return pas_typed_allocation_result_as_intrinsic_allocation_result(
     
    411411            teleport_rule,
    412412            free_mode,
    413             pas_try_reallocate_intrinsic_primitive_allocate_callback,
     413            pas_try_reallocate_intrinsic_allocate_callback,
    414414            &data));
    415415}
  • trunk/Source/bmalloc/libpas/src/libpas/thingy_heap.c

    r282556 r283371  
    3636#include "pas_try_allocate.h"
    3737#include "pas_try_allocate_array.h"
    38 #include "pas_try_allocate_intrinsic_primitive.h"
     38#include "pas_try_allocate_intrinsic.h"
    3939#include "pas_try_reallocate.h"
    4040#include "thingy_heap_config.h"
     
    4545
    4646pas_heap thingy_primitive_heap =
    47     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     47    PAS_INTRINSIC_HEAP_INITIALIZER(
    4848        &thingy_primitive_heap,
    4949        THINGY_TYPE_PRIMITIVE,
    5050        thingy_primitive_heap_support,
    5151        THINGY_HEAP_CONFIG,
    52         &thingy_intrinsic_primitive_runtime_config.base);
     52        &thingy_intrinsic_runtime_config.base);
    5353
    5454pas_intrinsic_heap_support thingy_utility_heap_support = PAS_INTRINSIC_HEAP_SUPPORT_INITIALIZER;
    5555
    5656pas_heap thingy_utility_heap =
    57     PAS_INTRINSIC_PRIMITIVE_HEAP_INITIALIZER(
     57    PAS_INTRINSIC_HEAP_INITIALIZER(
    5858        &thingy_utility_heap,
    5959        THINGY_TYPE_PRIMITIVE,
    6060        thingy_utility_heap_support,
    6161        THINGY_HEAP_CONFIG,
    62         &thingy_intrinsic_primitive_runtime_config.base);
     62        &thingy_intrinsic_runtime_config.base);
    6363
    6464pas_allocator_counts thingy_allocator_counts;
    6565
    66 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     66PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    6767    try_allocate_primitive,
    6868    THINGY_HEAP_CONFIG,
    69     &thingy_intrinsic_primitive_runtime_config.base,
     69    &thingy_intrinsic_runtime_config.base,
    7070    &thingy_allocator_counts,
    7171    pas_allocation_result_identity,
     
    9191void* thingy_try_reallocate_primitive(void* old_ptr, size_t new_size)
    9292{
    93     return (void*)pas_try_reallocate_intrinsic_primitive(
     93    return (void*)pas_try_reallocate_intrinsic(
    9494        old_ptr,
    9595        &thingy_primitive_heap,
     
    166166}
    167167
    168 PAS_CREATE_TRY_ALLOCATE_INTRINSIC_PRIMITIVE(
     168PAS_CREATE_TRY_ALLOCATE_INTRINSIC(
    169169    utility_heap_allocate,
    170170    THINGY_HEAP_CONFIG,
    171     &thingy_intrinsic_primitive_runtime_config.base,
     171    &thingy_intrinsic_runtime_config.base,
    172172    &thingy_allocator_counts,
    173173    pas_allocation_result_crash_on_error,
  • trunk/Source/bmalloc/libpas/src/libpas/thingy_heap_config.c

    r282556 r283371  
    3939    thingy, THINGY,
    4040    .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);
    4242
    4343#endif /* PAS_ENABLE_THINGY */
  • trunk/Source/bmalloc/libpas/src/test/IsoHeapChaosTests.cpp

    r282556 r283371  
    10641064                selectedAllocateCommonPrimitive = bmalloc_allocate;
    10651065                selectedAllocate = bmalloc_iso_allocate;
    1066                 selectedAllocateArray = nullptr;
     1066                selectedAllocateArray = bmalloc_iso_allocate_array_with_alignment;
    10671067                selectedDeallocate = bmalloc_deallocate;
    10681068                selectedCommonPrimitiveHeap = &bmalloc_common_primitive_heap;
  • trunk/Source/bmalloc/libpas/src/test/TestHarness.cpp

    r282556 r283371  
    8686
    8787#define FOR_EACH_RUNTIME_CONFIG(name, callback) ({ \
    88         (callback)(name ## _intrinsic_primitive_runtime_config.base); \
     88        (callback)(name ## _intrinsic_runtime_config.base); \
    8989        (callback)(name ## _primitive_runtime_config.base); \
    9090        (callback)(name ## _typed_runtime_config.base); \
    91         (callback)(name ## _objc_runtime_config.base); \
     91        (callback)(name ## _flex_runtime_config.base); \
    9292    })
    9393
Note: See TracChangeset for help on using the changeset viewer.