Introduce platform-agnostic ALWAYS_INLINE macro #27575

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:230504-inline changing 4 files +23 −11
  1. hebasto commented at 5:49 pm on May 4, 2023: member
    Split from #24773 as requested in #24773 (comment).
  2. DrahtBot commented at 5:49 pm on May 4, 2023: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK theuni, fanquake

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #24773 (Enable HW-accelerated implementations of SHA256 for MSVC builds by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. maflcko added the label DrahtBot Guix build requested on May 4, 2023
  4. in src/attributes.h:24 in d66232f625 outdated
    15@@ -16,4 +16,12 @@
    16 #  define LIFETIMEBOUND
    17 #endif
    18 
    19+#if defined(__GNUC__)
    20+#  define ALWAYS_INLINE inline __attribute__((always_inline))
    21+#elif defined(_MSC_VER)
    22+#  define ALWAYS_INLINE __forceinline
    23+#else
    24+#  define ALWAYS_INLINE inline
    


    theuni commented at 7:08 pm on May 4, 2023:

    I think it’d be better to error in this case so that we can add another platform exception if necessary. IIRC for the places that we use it, inlining is critical and we might want to design functions differently for platforms where it’s not possible.

    Especially given the gcc semantics:

    Failure to inline such a function is diagnosed as an error.

    As-is, I think this is currently a theoretical regression as we might now compile on a platform that would be an error on master.


    hebasto commented at 7:15 pm on May 4, 2023:
    Mind suggesting an error wording?

    theuni commented at 7:51 pm on May 4, 2023:
    How about: #error No known always_inline attribute for this platform.

    hebasto commented at 7:59 pm on May 4, 2023:
    Thanks! Updated.
  5. theuni changes_requested
  6. theuni commented at 7:13 pm on May 4, 2023: member
    Concept ACK.
  7. hebasto force-pushed on May 4, 2023
  8. Introduce platform-agnostic `ALWAYS_INLINE` macro
    `<attributes.h>` has been included in anticipation of the following
    commit.
    e16c22fe02
  9. scripted-diff: Use platform-agnostic `ALWAYS_INLINE` macro
    -BEGIN VERIFY SCRIPT-
    sed -i 's/ inline __attribute__((always_inline)) / ALWAYS_INLINE /g' $(git grep -l "inline __attribute__((always_inline))")
    sed -i 's/ inline  __attribute__((always_inline)) / ALWAYS_INLINE /g' $(git grep -l "inline  __attribute__((always_inline))")
    -END VERIFY SCRIPT-
    3f19875d66
  10. hebasto force-pushed on May 4, 2023
  11. hebasto commented at 7:59 pm on May 4, 2023: member

    Updated d66232f625a0781da2f4269cd8c5199ded2f43da -> 3f19875d667522412408d06873e87ff8150e49c4 (pr27575.01 -> pr27575.03, diff):

  12. DrahtBot removed the label DrahtBot Guix build requested on May 4, 2023
  13. theuni approved
  14. theuni commented at 7:22 pm on May 8, 2023: member
    utACK 3f19875d667522412408d06873e87ff8150e49c4
  15. DrahtBot added the label DrahtBot Guix build requested on May 9, 2023
  16. DrahtBot commented at 12:27 pm on May 9, 2023: contributor

    Guix builds

    File commit fa53611cf1b2ab2f49470ba75ee29a94a7b89105(master) commit d179d749e611ff9b2e6f339db940d7047b5839a8(master and this pull)
    SHA256SUMS.part a926c0d34bfbdcad... 12d68e8280fc191b...
    *-aarch64-linux-gnu-debug.tar.gz 163a8f60dd616570... 945adbfb0c02975c...
    *-aarch64-linux-gnu.tar.gz b77781360a714e5b... e93ac2fc7f2d2a05...
    *-arm-linux-gnueabihf-debug.tar.gz 14e94cfef0742385... c9c57feca999a5d2...
    *-arm-linux-gnueabihf.tar.gz 7cec718d874e98c0... 40c68f222fe3655f...
    *-powerpc64-linux-gnu-debug.tar.gz 55c53bb7314c17c9... 429a4c2185b51bd1...
    *-powerpc64-linux-gnu.tar.gz dd7a3f300323f1dc... 4937ab90b143dfc5...
    *-powerpc64le-linux-gnu-debug.tar.gz 73afe8f75e5aece9... 98994794305f5754...
    *-powerpc64le-linux-gnu.tar.gz 5f2d881ceaba899d... a27aadace3d0b2ab...
    *-riscv64-linux-gnu-debug.tar.gz f41fa430c59d39a4... 7a461106deee0708...
    *-riscv64-linux-gnu.tar.gz 661b41a6d9528c7a... cde23d48e9e208da...
    *-x86_64-linux-gnu-debug.tar.gz 0e8c6161d8542b03... 37e7d0b3d28ef5ec...
    *-x86_64-linux-gnu.tar.gz 32988f6959b35357... 06eb7380aa451240...
    *.tar.gz c97a743e67b67c4b... 7c3fa569ab59d34f...
    guix_build.log 72977f2167a4f143... 62c3b127d5059386...
    guix_build.log.diff 002cff8f4f7c028a...
  17. DrahtBot removed the label DrahtBot Guix build requested on May 9, 2023
  18. fanquake commented at 1:31 pm on May 9, 2023: member

    Guix Build:

     04c75c6675a758f8bfddaf3ca395eec58f82078486273bd13c7f03fa949f05f91  guix-build-3f19875d6675/output/aarch64-linux-gnu/SHA256SUMS.part
     19736762959e2d9d06c33093ff08db157548fd3f82529cfbace0ceddce0151996  guix-build-3f19875d6675/output/aarch64-linux-gnu/bitcoin-3f19875d6675-aarch64-linux-gnu-debug.tar.gz
     2a82ceeae1e2b98e65bc363f61648a28e7a0985a2d2e1acc7142c3540ec71e5c4  guix-build-3f19875d6675/output/aarch64-linux-gnu/bitcoin-3f19875d6675-aarch64-linux-gnu.tar.gz
     316b8bf25ad364757690cdad86746718e27102895484cecb3e8b7d1c755f5afc9  guix-build-3f19875d6675/output/arm-linux-gnueabihf/SHA256SUMS.part
     47453fdbbc1618069db59a0d09c2606e0912ceacc525b53da24f6ea69aa3302f3  guix-build-3f19875d6675/output/arm-linux-gnueabihf/bitcoin-3f19875d6675-arm-linux-gnueabihf-debug.tar.gz
     549adcd44a089326474188d83e7dba12c9e4c0cd5dbb14b3c329ddf4580546822  guix-build-3f19875d6675/output/arm-linux-gnueabihf/bitcoin-3f19875d6675-arm-linux-gnueabihf.tar.gz
     6763a0ae579e28afcfdb388762651668e62811eceed8990771d8069c7d580c51d  guix-build-3f19875d6675/output/arm64-apple-darwin/SHA256SUMS.part
     7c06e23bc828e660cdcddd0ae610700c7d0cbdda1b7603c2dc32a2414bc27e66d  guix-build-3f19875d6675/output/arm64-apple-darwin/bitcoin-3f19875d6675-arm64-apple-darwin-unsigned.dmg
     8da740b2fa3d9bfc372882509ae8ba93edc2bd08d28e1b2559174b764444e2124  guix-build-3f19875d6675/output/arm64-apple-darwin/bitcoin-3f19875d6675-arm64-apple-darwin-unsigned.tar.gz
     987a28abfa9b4bf37b374b3a86cb016761e9eceaaaf97d405e43cd1745cbfb03f  guix-build-3f19875d6675/output/arm64-apple-darwin/bitcoin-3f19875d6675-arm64-apple-darwin.tar.gz
    10303683b5c76e7b99ecbcbdea6c6ab80df57b585b5aadf7c19561314ddcc87612  guix-build-3f19875d6675/output/dist-archive/bitcoin-3f19875d6675.tar.gz
    1186462a494ca5a26afb3d03376e7ccb47a2b347c607d05f517d3de81819256563  guix-build-3f19875d6675/output/powerpc64-linux-gnu/SHA256SUMS.part
    1243dd3b070b94e63ef570ec5f63e782fe62aaff62795798d3bd9fe3ce95ec3011  guix-build-3f19875d6675/output/powerpc64-linux-gnu/bitcoin-3f19875d6675-powerpc64-linux-gnu-debug.tar.gz
    13a85a56378b5806945202334afaf0b9f74664cf53ad4cd56159fd6de79c709df8  guix-build-3f19875d6675/output/powerpc64-linux-gnu/bitcoin-3f19875d6675-powerpc64-linux-gnu.tar.gz
    149b7b422b55f28bcda4fe9df3cb46a2d2e18295421258a418e2e83b1bb74ad77b  guix-build-3f19875d6675/output/powerpc64le-linux-gnu/SHA256SUMS.part
    155bb6fd27c3a6880de51928f9149a62e30e5f9e180ba0615628d2a6a2ec931307  guix-build-3f19875d6675/output/powerpc64le-linux-gnu/bitcoin-3f19875d6675-powerpc64le-linux-gnu-debug.tar.gz
    168586dfe73c3c8dcc27494c27c2bf122f22f04efeff0d793cf02efd70d2e1f518  guix-build-3f19875d6675/output/powerpc64le-linux-gnu/bitcoin-3f19875d6675-powerpc64le-linux-gnu.tar.gz
    171840ba4c99f1e11f19f3587b98cda655b679210420f2a7dd839b89c893fa61f2  guix-build-3f19875d6675/output/riscv64-linux-gnu/SHA256SUMS.part
    180239b5a11cd0b04336a49beed03e60cb62117e4eb7c7a288acd649e2facf7a20  guix-build-3f19875d6675/output/riscv64-linux-gnu/bitcoin-3f19875d6675-riscv64-linux-gnu-debug.tar.gz
    1909bf89ef4675d4fb41b896d1745fe603e8faf2cb047797e399c32a0922e0ddca  guix-build-3f19875d6675/output/riscv64-linux-gnu/bitcoin-3f19875d6675-riscv64-linux-gnu.tar.gz
    20ec9bbabe136249028395992055cc579ffad61f699012d970863131f040273abe  guix-build-3f19875d6675/output/x86_64-apple-darwin/SHA256SUMS.part
    21ef62895c9aad19ebd926a0b7cfa361d7d0d27c43611ae6339c21fa6a8a9b7caa  guix-build-3f19875d6675/output/x86_64-apple-darwin/bitcoin-3f19875d6675-x86_64-apple-darwin-unsigned.dmg
    22a5d2c4f25c02a86a8000d1b45721720d57ff4e5ce8a446a63ac3aea5c6a30329  guix-build-3f19875d6675/output/x86_64-apple-darwin/bitcoin-3f19875d6675-x86_64-apple-darwin-unsigned.tar.gz
    23f17f94993412e1d9330edca93f00b1b81daddad78ca6a945e3dd3be6356b50a4  guix-build-3f19875d6675/output/x86_64-apple-darwin/bitcoin-3f19875d6675-x86_64-apple-darwin.tar.gz
    2426eab9761ec719c19ee1eb070d8c7bd43a481e834d6b820c1af7e9223418324f  guix-build-3f19875d6675/output/x86_64-linux-gnu/SHA256SUMS.part
    25a7a73e55336f99f4258494e4635918acf66e533eaf3133b80d7d6dfdc57002c4  guix-build-3f19875d6675/output/x86_64-linux-gnu/bitcoin-3f19875d6675-x86_64-linux-gnu-debug.tar.gz
    264d0df4c4277bebac6576b7e47f68d8cf7785195aeef21cae5348fcfcce5a6810  guix-build-3f19875d6675/output/x86_64-linux-gnu/bitcoin-3f19875d6675-x86_64-linux-gnu.tar.gz
    2781fe0fd97c1d5fb7991ba07a0555d1f7cf25f671b0b376b8586dbecd09a841d2  guix-build-3f19875d6675/output/x86_64-w64-mingw32/SHA256SUMS.part
    28e656cfb9854930d8f9a84c7ed3751121259c0fbef1c4ac8421e44a1a900d0438  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64-debug.zip
    29469255c111b52977954fe9db2a555447eb19963c64bcb2ceb02feb79509e4a7c  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64-setup-unsigned.exe
    3041783b4f94917e184c05696e1bff6c896797c38d0d492f96bf55071dd7d06ae3  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64-unsigned.tar.gz
    3145adf6a0d032b3a207652393888e731f3ca899bb2980688f330a637ded92d11c  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64.zip
    
  19. fanquake approved
  20. fanquake commented at 1:45 pm on May 9, 2023: member
    ACK 3f19875d667522412408d06873e87ff8150e49c4
  21. fanquake merged this on May 9, 2023
  22. fanquake closed this on May 9, 2023

  23. hebasto deleted the branch on May 9, 2023
  24. sidhujag referenced this in commit 100a623a4a on May 9, 2023
  25. bitcoin locked this on May 8, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-03 13:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me