Skip to content

Commit 3d782a6

Browse files
committed
AOSCOS: LOONGARCH: Fix current_stack_pointer
idk why it worked in GCC, but in my Clang setup it is broken. printf the sp worked but casting it to address produced a bad value. Signed-off-by: Bingwu Zhang <[email protected]>
1 parent 507b5d7 commit 3d782a6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/hotspot/os_cpu/linux_loongarch/os_linux_loongarch.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,9 @@
7878
#define REG_FP 22
7979

8080
NOINLINE address os::current_stack_pointer() {
81-
#ifdef __clang__
82-
#pragma clang diagnostic push
83-
#pragma clang diagnostic ignored "-Wuninitialized"
84-
#endif
85-
register void *sp __asm__("$r3");
81+
void *sp;
82+
asm("add.d %0, $r3, $r0" : "=r"(sp) : :"r3");
8683
return (address)sp;
87-
#ifdef __clang__
88-
#pragma clang diagnostic pop
89-
#endif
9084
}
9185

9286
char* os::non_memory_address_word() {

0 commit comments

Comments
 (0)