From f39bb15bc415fb2b895ba9f6caa82527a350557d Mon Sep 17 00:00:00 2001 From: Coldwings Date: Mon, 11 Aug 2025 17:07:44 +0800 Subject: [PATCH 1/3] Prettify thread stack bottom fp for perf unwind with fp --- thread/thread.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/thread/thread.cpp b/thread/thread.cpp index 9a75fa44..73f5da90 100644 --- a/thread/thread.cpp +++ b/thread/thread.cpp @@ -753,12 +753,14 @@ R"( DEF_ASM_FUNC(_photon_thread_stub) R"( + mov %rbp, %rbx + mov $0, %rbp call _asan_start - mov 0x40(%rbp), %rdi - movq $0, 0x40(%rbp) - call *0x48(%rbp) - mov %rax, 0x48(%rbp) - mov %rbp, %rdi + mov 0x40(%rbx), %rdi + movq $0, 0x40(%rbx) + call *0x48(%rbx) + mov %rax, 0x48(%rbx) + mov %rbx, %rdi call _photon_thread_die )" ); @@ -1284,7 +1286,8 @@ R"( return rq.current->error_number; } - inline void thread_yield_fast() { + __attribute__((noinline)) + void thread_yield_fast() { auto sw = AtomicRunQ().goto_next(); switch_context(sw.from, sw.to); } From 0a8eec6b07867da37af1d164cda3e149e5619c0c Mon Sep 17 00:00:00 2001 From: Coldwings Date: Tue, 12 Aug 2025 10:37:37 +0800 Subject: [PATCH 2/3] aarch64 stack bottom --- thread/thread.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/thread/thread.cpp b/thread/thread.cpp index 73f5da90..19012261 100644 --- a/thread/thread.cpp +++ b/thread/thread.cpp @@ -754,10 +754,16 @@ R"( DEF_ASM_FUNC(_photon_thread_stub) R"( mov %rbp, %rbx - mov $0, %rbp - call _asan_start + xor %rbp, %rbp +)" +#ifdef __SANITIZE_ADDRESS__ +R"( + call _asan_start +)" +#endif +R"( mov 0x40(%rbx), %rdi - movq $0, 0x40(%rbx) + movq %rbp, 0x40(%rbx) call *0x48(%rbx) mov %rax, 0x48(%rbx) mov %rbx, %rdi @@ -820,7 +826,6 @@ R"( DEF_ASM_FUNC(_photon_thread_stub) R"( - call _asan_start mov 0x40(%rbp), %rcx movq $0, 0x40(%rbp) call *0x48(%rbp) @@ -895,13 +900,21 @@ R"( )" DEF_ASM_FUNC(_photon_thread_stub) +R"( + mov x28, x29 + mov x29, xzr +)" +#ifdef __ADDRESS_SANITIZER__ R"( bl _asan_start //; asan_start() - ldp x0, x1, [x29, #0x40] //; load arg, start into x0, x1 - str xzr, [x29, #0x40] //; set arg as 0 +)" +#endif +R"( + ldp x0, x1, [x28, #0x40] //; load arg, start into x0, x1 + str xzr, [x28, #0x40] //; set arg as 0 blr x1 //; start(x0) - str x0, [x29, #0x48] //; retval = result - mov x0, x29 //; move th to x0 + str x0, [x28, #0x48] //; retval = result + mov x0, x28 //; move th to x0 b _photon_thread_die //; _photon_thread_die(th) )" ); From b3cb00141cb6f3c3ae39161edecd8711287ae9fd Mon Sep 17 00:00:00 2001 From: Coldwings Date: Tue, 12 Aug 2025 15:28:04 +0800 Subject: [PATCH 3/3] Fix autopr title (#47) (#48) --- .github/workflows/auto-pr-precise.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-pr-precise.yml b/.github/workflows/auto-pr-precise.yml index 659933af..b06e5a41 100644 --- a/.github/workflows/auto-pr-precise.yml +++ b/.github/workflows/auto-pr-precise.yml @@ -59,6 +59,7 @@ jobs: git checkout -b ${{steps.create_branch.outputs.PRBRANCH}} echo "TITLE<<__AUTOPR_EOF" >> $GITHUB_OUTPUT git log --format="| %s" ${{ github.event.commits[0].id }}~..${{ github.event.after }} | tr '\n' ' ' >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT echo "__AUTOPR_EOF" >> $GITHUB_OUTPUT echo "MESSAGE<<__AUTOPR_EOF" >> $GITHUB_OUTPUT git log --format="> %B" ${{ github.event.commits[0].id }}~..${{ github.event.after }} >> $GITHUB_OUTPUT