Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MP_SMALL_STACK_SIZE option #538

Merged
merged 11 commits into from
Apr 4, 2024
Merged

add MP_SMALL_STACK_SIZE option #538

merged 11 commits into from
Apr 4, 2024

Commits on Mar 27, 2024

  1. add MP_SMALL_STACK_SIZE option

    This adds an option to use a heap-buffer for the usually stack-based
    `MP_WARRAY`-sized temporary buffers.
    
    Per default it will reserve a single buffer, which can be modified
    * at compile-time via the `MP_WARRAY_NUM` define
    * at run-time by calling `mp_warray_init()`
    
    The internal structure can only be created once. If one wants to modify
    the maximum number of elements, the entire structure has to be free'd
    by calling `mp_warray_free()`.
    
    In case one wants to use this option with multiple threads, one shall
    use the `mp_warray_init()` function and pass appropriate locking functions.
    
    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    bd66fcc View commit details
    Browse the repository at this point in the history
  2. Replace locking by atomic operations

    `s_warray_init()` and `s_warray_free()` are not safe and MUST NOT be called
    from multiple threads.
    
    This also removes `MP_WARRAY_NUM`, since automatic initialization will not
    be safe for more than one thread.
    
    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    18e67e1 View commit details
    Browse the repository at this point in the history
  3. Add s_mp_cmpexch_n()

    To be able to support this for MSVC as well, we have to move this into a
    separate private API function.
    
    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    795f7ba View commit details
    Browse the repository at this point in the history
  4. Add multi-threaded tests

    Output gets garbeled a bit, but we only care for the result which is
    `Tests OK/NOP/FAIL: 50/0/0`.
    
    Add `-Wno-incomplete-setjmp-declaration` since `clang-10` shipping with
    Ubuntu 20.04 seems broken... and `-Wno-unknown-warning-option` since
    `clang-8` doesn't know about this warning...
    
    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    98655a8 View commit details
    Browse the repository at this point in the history
  5. Add tests for MSVC multi-threading

    ... and fix some MSVC related (and other) things.
    
    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    fae9aa5 View commit details
    Browse the repository at this point in the history
  6. Update makefiles

    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    334465d View commit details
    Browse the repository at this point in the history

Commits on Mar 29, 2024

  1. Use Thread Local Storage for warray buffer

    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    33a9d0d View commit details
    Browse the repository at this point in the history
  2. regen

    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    513d48d View commit details
    Browse the repository at this point in the history
  3. Use appveyor build matrix

    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Mar 29, 2024
    Configuration menu
    Copy the full SHA
    4c2e177 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2024

  1. Run small-stack tests with valgrind

    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    6c70ef1 View commit details
    Browse the repository at this point in the history
  2. Disable MP_SMALL_STACK_SIZE on MSVC

    Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
    sjaeckel committed Apr 3, 2024
    Configuration menu
    Copy the full SHA
    3570e12 View commit details
    Browse the repository at this point in the history