From bfc94df37434f66df13725e348e4191ae056cfaf Mon Sep 17 00:00:00 2001 From: Gundepalli Sravani Date: Tue, 25 Aug 2026 11:53:47 +0530 Subject: [PATCH] deps: V8: cherry-pick f4221e09e812 Original commit message: AIX: implement Stack::ObtainCurrentThreadStackReservedLimit Port 5a54f45b671bdf47e083ffbad547713d8bacb28f AIX lacks `pthread_getattr_np()` so we implement the function using pthread_getthrds_np() with PTHRDSINFO_QUERY_ALL, consistent with ObtainCurrentThreadStackStart(). The `__pi_stackaddr` field maps to the lowest stack address, equivalent to the base returned by pthread_attr_getstack() on other POSIX platforms. IT: 145 Change-Id: Ia1a34912630e3128f61fa0fca502429b837d611f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8236132 Reviewed-by: Milad Farazmand Reviewed-by: Michael Lippautz Commit-Queue: Milad Farazmand Cr-Commit-Position: refs/heads/main@{#109640} Refs: https://github.com/v8/v8/commit/f4221e09e812c33900520c445267b8979fcf8fe8 Signed-off-by: Joyee Cheung PR-URL: https://github.com/nodejs/node/pull/65161 Reviewed-By: Antoine du Hamel Reviewed-By: Richard Lau --- common.gypi | 2 +- deps/v8/src/base/platform/platform-aix.cc | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/common.gypi b/common.gypi index d0380616db6..eb7b70b59d4 100644 --- a/common.gypi +++ b/common.gypi @@ -44,7 +44,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.12', + 'v8_embedder_string': '-node.13', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/base/platform/platform-aix.cc b/deps/v8/src/base/platform/platform-aix.cc index 70b43d11c9e..3593f36239a 100644 --- a/deps/v8/src/base/platform/platform-aix.cc +++ b/deps/v8/src/base/platform/platform-aix.cc @@ -147,7 +147,7 @@ Stack::StackSlot Stack::ObtainCurrentThreadStackStart() { // | // V // - // lower address ----- __pi_stackaddr, current sp + // lower address ----- __pi_stackaddr, reserved stack limit pthread_t tid = pthread_self(); struct __pthrdsinfo buf; @@ -164,6 +164,26 @@ Stack::StackSlot Stack::ObtainCurrentThreadStackStart() { return reinterpret_cast(buf.__pi_stackend); } +// static +Stack::StackSlot Stack::ObtainCurrentThreadStackReservedLimit() { + pthread_t tid = pthread_self(); + struct __pthrdsinfo buf; + memset(&buf, 0, sizeof(buf)); + char regbuf[1]; + int regbufsize = sizeof(regbuf); + + const int rc = pthread_getthrds_np(&tid, PTHRDSINFO_QUERY_ALL, &buf, + sizeof(buf), regbuf, ®bufsize); + if (rc != 0) { + return nullptr; + } + + if (buf.__pi_stackaddr == NULL) { + return nullptr; + } + return reinterpret_cast(buf.__pi_stackaddr); +} + // static bool OS::DecommitPages(void* address, size_t size) { // The difference between this implementation and the alternative under