Skip to content

Commit 7cafdf3

Browse files
committed
---
yaml --- r: 53913 b: refs/heads/dist-snap c: 087a015 h: refs/heads/master i: 53911: d76681a v: v3
1 parent b0ab086 commit 7cafdf3

File tree

10 files changed

+326
-324
lines changed

10 files changed

+326
-324
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: a692777224150e2dadb5ec02c6ecd5c10ce0dd98
10+
refs/heads/dist-snap: 087a015a727b11d46ff5a309ff37c7967e8636d1
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/rt/arch/arm/sp.h

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.text
2+
3+
#if defined(__APPLE__) || defined(_WIN32)
4+
#define RECORD_SP_LIMIT _record_sp_limit
5+
#define GET_SP_LIMIT _get_sp_limit
6+
#define GET_SP _get_sp
7+
#else
8+
#define RECORD_SP_LIMIT record_sp_limit
9+
#define GET_SP_LIMIT get_sp_limit
10+
#define GET_SP get_sp
11+
#endif
12+
13+
.globl RECORD_SP_LIMIT
14+
.globl GET_SP_LIMIT
15+
.globl GET_SP
16+
17+
#if defined(__linux__) || defined(__FreeBSD__)
18+
RECORD_SP_LIMIT:
19+
movl 4(%esp), %eax
20+
movl %eax, %gs:48
21+
ret
22+
#endif
23+
24+
#if defined(__APPLE__)
25+
RECORD_SP_LIMIT:
26+
movl $0x48+90*4, %eax
27+
movl 4(%esp), %ecx
28+
movl %ecx, %gs:(%eax)
29+
ret
30+
#endif
31+
32+
#if defined(_WIN32)
33+
RECORD_SP_LIMIT:
34+
movl 4(%esp), %eax
35+
movl %eax, %fs:0x14
36+
ret
37+
#endif
38+
39+
#if defined(__linux__) || defined(__FreeBSD__)
40+
GET_SP_LIMIT:
41+
movl %gs:48, %eax
42+
ret
43+
#endif
44+
45+
#if defined(__APPLE__)
46+
GET_SP_LIMIT:
47+
movl $0x48+90*4, %ecx
48+
movl %gs:(%ecx), %eax
49+
ret
50+
#endif
51+
52+
#if defined(_WIN32)
53+
GET_SP_LIMIT:
54+
movl %fs:0x14, %eax
55+
ret
56+
#endif
57+
58+
GET_SP:
59+
movl %esp, %eax
60+
ret

branches/dist-snap/src/rt/arch/i386/sp.h

Lines changed: 0 additions & 71 deletions
This file was deleted.

branches/dist-snap/src/rt/arch/mips/sp.h

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.text
2+
3+
#if defined(__APPLE__) || defined(_WIN32)
4+
#define RECORD_SP_LIMIT _record_sp_limit
5+
#define GET_SP_LIMIT _get_sp_limit
6+
#define GET_SP _get_sp
7+
#else
8+
#define RECORD_SP_LIMIT record_sp_limit
9+
#define GET_SP_LIMIT get_sp_limit
10+
#define GET_SP get_sp
11+
#endif
12+
13+
.globl RECORD_SP_LIMIT
14+
.globl GET_SP_LIMIT
15+
.globl GET_SP
16+
17+
#if defined(__linux__)
18+
RECORD_SP_LIMIT:
19+
movq %rdi, %fs:112
20+
ret
21+
#elif defined(__APPLE__)
22+
RECORD_SP_LIMIT:
23+
movq $0x60+90*8, %rsi
24+
movq %rdi, %gs:(%rsi)
25+
ret
26+
#elif defined(__FreeBSD__)
27+
RECORD_SP_LIMIT:
28+
movq %rdi, %fs:24
29+
ret
30+
#else
31+
RECORD_SP_LIMIT:
32+
ret
33+
#endif
34+
35+
#if defined(__linux__)
36+
GET_SP_LIMIT:
37+
movq %fs:112, %rax
38+
ret
39+
#elif defined(__APPLE__)
40+
GET_SP_LIMIT:
41+
movq $0x60+90*8, %rsi
42+
movq %gs:(%rsi), %rax
43+
ret
44+
#elif defined(__FreeBSD__)
45+
GET_SP_LIMIT:
46+
movq %fs:24, %rax
47+
ret
48+
#endif
49+
50+
GET_SP:
51+
movq %rsp, %rax
52+
ret

branches/dist-snap/src/rt/arch/x86_64/sp.h

Lines changed: 0 additions & 71 deletions
This file was deleted.

branches/dist-snap/src/rt/rust_globals.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@
1111
#ifndef RUST_GLOBALS_H
1212
#define RUST_GLOBALS_H
1313

14-
#if defined(__cplusplus)
15-
#define INLINE inline
16-
#elif defined(_MSC_VER) || defined(__GNUC__)
17-
#define INLINE __inline__
18-
#else
19-
#define INLINE inline
20-
#endif
21-
22-
#if defined(__GNUC__)
23-
#define ALWAYS_INLINE __attribute((always_inline)) INLINE
24-
#elif defined(_MSC_VER)
25-
#define ALWAYS_INLINE __forceinline
26-
#else
27-
#define ALWAYS_INLINE INLINE
28-
#endif
29-
3014
#ifndef __STDC_LIMIT_MACROS
3115
#define __STDC_LIMIT_MACROS 1
3216
#endif

branches/dist-snap/src/rt/rust_task.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@
118118
#include "rust_stack.h"
119119
#include "rust_type.h"
120120
#include "rust_sched_loop.h"
121-
#include "sp.h"
122121

123122
// The amount of extra space at the end of each stack segment, available
124123
// to the rt, compiler and dynamic linker for running small functions
@@ -420,6 +419,15 @@ template <typename T> struct task_owned {
420419
}
421420
};
422421

422+
// This stuff is on the stack-switching fast path
423+
424+
// Records the pointer to the end of the Rust stack in a platform-
425+
// specific location in the thread control block
426+
extern "C" CDECL void record_sp_limit(void *limit);
427+
extern "C" CDECL uintptr_t get_sp_limit();
428+
// Gets a pointer to the vicinity of the current stack pointer
429+
extern "C" uintptr_t get_sp();
430+
423431
// This is the function that switches between the C and the Rust stack by
424432
// calling another function with a single void* argument while changing the
425433
// stack pointer. It has a funny name because gdb doesn't normally like to
@@ -592,6 +600,9 @@ rust_task::prev_stack() {
592600
record_stack_limit();
593601
}
594602

603+
extern "C" CDECL void
604+
record_sp_limit(void *limit);
605+
595606
// The LLVM-generated segmented-stack function prolog compares the amount of
596607
// stack needed for each frame to the end-of-stack pointer stored in the
597608
// TCB. As an optimization, when the frame size is less than 256 bytes, it

0 commit comments

Comments
 (0)