Skip to content

Commit 89483b0

Browse files
committed
rt: Remove check_stack_alignment
This function does not do what it tries to do and it is expensive
1 parent d8c16df commit 89483b0

File tree

3 files changed

+0
-34
lines changed

3 files changed

+0
-34
lines changed

src/rt/arch/i386/record_sp.S

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44
#define RECORD_SP_LIMIT _record_sp_limit
55
#define GET_SP_LIMIT _get_sp_limit
66
#define GET_SP _get_sp
7-
#define CHECK_STACK _check_stack_alignment
87
#else
98
#define RECORD_SP_LIMIT record_sp_limit
109
#define GET_SP_LIMIT get_sp_limit
1110
#define GET_SP get_sp
12-
#define CHECK_STACK check_stack_alignment
1311
#endif
1412

1513
.globl RECORD_SP_LIMIT
1614
.globl GET_SP_LIMIT
1715
.globl GET_SP
18-
.globl CHECK_STACK
1916

2017
#if defined(__linux__) || defined(__FreeBSD__)
2118
RECORD_SP_LIMIT:
@@ -61,10 +58,3 @@ GET_SP_LIMIT:
6158
GET_SP:
6259
movl %esp, %eax
6360
ret
64-
65-
// This will segfault if not called on a 16-byte boundary
66-
CHECK_STACK:
67-
subl $28, %esp
68-
movaps %xmm0, (%esp)
69-
addl $28, %esp
70-
ret

src/rt/arch/x86_64/record_sp.S

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44
#define RECORD_SP_LIMIT _record_sp_limit
55
#define GET_SP_LIMIT _get_sp_limit
66
#define GET_SP _get_sp
7-
#define CHECK_STACK _check_stack_alignment
87
#else
98
#define RECORD_SP_LIMIT record_sp_limit
109
#define GET_SP_LIMIT get_sp_limit
1110
#define GET_SP get_sp
12-
#define CHECK_STACK check_stack_alignment
1311
#endif
1412

1513
.globl RECORD_SP_LIMIT
1614
.globl GET_SP_LIMIT
1715
.globl GET_SP
18-
.globl CHECK_STACK
1916

2017
#if defined(__linux__)
2118
RECORD_SP_LIMIT:
@@ -53,10 +50,3 @@ GET_SP_LIMIT:
5350
GET_SP:
5451
movq %rsp, %rax
5552
ret
56-
57-
// This will segfault if not called on a 16-byte boundary
58-
CHECK_STACK:
59-
subq $24, %rsp
60-
movaps %xmm0, (%rsp)
61-
addq $24, %rsp
62-
ret

src/rt/rust_upcall.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,10 @@
2828
(task)->name, (task));
2929
#endif
3030

31-
// This is called to ensure we've set up our rust stacks
32-
// correctly. Strategically placed at entry to upcalls because they begin on
33-
// the rust stack and happen frequently enough to catch most stack changes,
34-
// including at the beginning of all landing pads.
35-
// FIXME: Enable this for windows
36-
#if (defined __linux__ || defined __APPLE__ || defined __FreeBSD__) \
37-
&& (defined(GCC_VERSION) && GCC_VERSION > 40300)
38-
extern "C" void
39-
check_stack_alignment() __attribute__ ((aligned (16)));
40-
#else
41-
static void check_stack_alignment() { }
42-
#endif
43-
4431
#define UPCALL_SWITCH_STACK(A, F) call_upcall_on_c_stack((void*)A, (void*)F)
4532

4633
inline void
4734
call_upcall_on_c_stack(void *args, void *fn_ptr) {
48-
check_stack_alignment();
4935
rust_task *task = rust_get_current_task();
5036
task->call_on_c_stack(args, fn_ptr);
5137
}

0 commit comments

Comments
 (0)