Skip to content

Commit 408d4ec

Browse files
committed
rt: Remove upcall_alloc_c_stack/call_c_stack, et. al.
We are using upcall_call_shim_on_c_stack now
1 parent 037ca7f commit 408d4ec

File tree

4 files changed

+0
-129
lines changed

4 files changed

+0
-129
lines changed

src/rt/arch/i386/ccall.S

-46
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,5 @@
11
.text
22

3-
// upcall_call_c_stack(void (*fn)(), void *arg_struct)
4-
//
5-
// Note that we could use |enter| and |leave| but the manuals tell me they're
6-
// slower.
7-
#if defined(__APPLE__) || defined(_WIN32)
8-
.globl _upcall_call_c_stack
9-
.globl _upcall_call_c_stack_i64
10-
.globl _upcall_call_c_stack_float
11-
_upcall_call_c_stack:
12-
_upcall_call_c_stack_i64:
13-
_upcall_call_c_stack_float:
14-
#else
15-
.globl upcall_call_c_stack
16-
.globl upcall_call_c_stack_i64
17-
.globl upcall_call_c_stack_float
18-
upcall_call_c_stack:
19-
upcall_call_c_stack_i64:
20-
upcall_call_c_stack_float:
21-
#endif
22-
pushl %ebp
23-
movl %esp,%ebp // save esp
24-
movl 8(%esp),%eax // eax = callee
25-
movl 12(%esp),%esp // switch stack
26-
calll *%eax
27-
movl %ebp,%esp // would like to use "leave" but it's slower
28-
popl %ebp
29-
ret
30-
31-
#if defined(__APPLE__) || defined(_WIN32)
32-
.globl _upcall_call_c_stack_shim
33-
_upcall_call_c_stack_shim:
34-
#else
35-
.globl upcall_call_c_stack_shim
36-
upcall_call_c_stack_shim:
37-
#endif
38-
pushl %ebp
39-
movl %esp,%ebp // save esp
40-
movl 8(%ebp),%eax // eax = callee
41-
movl 12(%ebp),%esp // switch stack
42-
subl $12,%esp // maintain 16-byte alignment
43-
pushl 12(%ebp) // push ptr to argument block
44-
calll *%eax
45-
movl %ebp,%esp // would like to use "leave" but it's slower
46-
popl %ebp
47-
ret
48-
493
#if defined(__APPLE__) || defined(_WIN32)
504
.globl _asm_call_on_stack
515
_asm_call_on_stack:

src/rt/arch/x86_64/ccall.S

-68
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,6 @@
66

77
.text
88

9-
// upcall_call_c_stack(void (*fn)(), void *new_esp)
10-
//
11-
// Note that we could use |enter| and |leave| but the manuals tell me they're
12-
// slower.
13-
#if defined(__APPLE__) || defined(_WIN32)
14-
.globl _upcall_call_c_stack
15-
.globl _upcall_call_c_stack_i64
16-
.globl _upcall_call_c_stack_float
17-
_upcall_call_c_stack:
18-
_upcall_call_c_stack_i64:
19-
_upcall_call_c_stack_float:
20-
#else
21-
.globl upcall_call_c_stack
22-
.globl upcall_call_c_stack_i64
23-
.globl upcall_call_c_stack_float
24-
upcall_call_c_stack:
25-
upcall_call_c_stack_i64:
26-
upcall_call_c_stack_float:
27-
#endif
28-
push %rbp
29-
mov %rsp,%rbp // save rsp
30-
mov ARG1,%rsp // switch stack
31-
32-
// Hack: the arguments to the function are sitting
33-
// on the stack right now, as in i386 calling
34-
// convention. We need them in registers.
35-
// For now, we just load them into registers.
36-
//
37-
// This is a total hack because it does not consider
38-
// the actual arguments of the target function.
39-
// It fails if there are non-INTEGER class arguments,
40-
// which would get pushed on the stack, or if there are
41-
// additional arguments beyond those that will get
42-
// passed in registers.
43-
mov ARG0,%r11 // Remember target address
44-
mov 0(%rsp),RUSTRT_ARG0_S
45-
mov 8(%rsp),RUSTRT_ARG1_S
46-
mov 16(%rsp),RUSTRT_ARG2_S
47-
mov 24(%rsp),RUSTRT_ARG3_S
48-
# ifdef RUSTRT_ARG4_S
49-
mov 32(%rsp),RUSTRT_ARG4_S
50-
# endif
51-
# ifdef RUSTRT_ARG5_S
52-
mov 40(%rsp),RUSTRT_ARG5_S
53-
# endif
54-
55-
call *%r11
56-
mov %rbp,%rsp // would like to use "leave" but it's slower
57-
pop %rbp
58-
ret
59-
60-
#if defined(__APPLE__) || defined(_WIN32)
61-
.globl _upcall_call_c_stack_shim
62-
_upcall_call_c_stack_shim:
63-
#else
64-
.globl upcall_call_c_stack_shim
65-
upcall_call_c_stack_shim:
66-
#endif
67-
push %rbp
68-
mov %rsp,%rbp // save rsp
69-
mov ARG1,%rsp // switch stack
70-
mov ARG0,%r11 // Remember target address
71-
mov ARG1,ARG0 // setup the parameter shim expects
72-
call *%r11
73-
mov %rbp,%rsp
74-
pop %rbp
75-
ret
76-
779
#if defined(__APPLE__) || defined(_WIN32)
7810
.globl _asm_call_on_stack
7911
_asm_call_on_stack:

src/rt/rust_upcall.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,6 @@ upcall_dynastack_free(void *ptr) {
209209
return rust_scheduler::get_task()->dynastack.free(ptr);
210210
}
211211

212-
/**
213-
* Allocates |nbytes| bytes in the C stack and returns a pointer to the start
214-
* of the allocated space.
215-
*/
216-
extern "C" CDECL void *
217-
upcall_alloc_c_stack(size_t nbytes) {
218-
rust_scheduler *sched = rust_scheduler::get_task()->sched;
219-
return sched->c_context.alloc_stack(nbytes);
220-
}
221-
222212
/**
223213
* Allocates |nbytes| bytes in the C stack and returns a pointer to the start
224214
* of the allocated space.

src/rt/rustrt.def.in

-5
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ start_task
5353
vec_reserve_shared
5454
vec_from_buf_shared
5555
unsupervise
56-
upcall_alloc_c_stack
57-
upcall_call_c_stack
58-
upcall_call_c_stack_i64
59-
upcall_call_c_stack_float
60-
upcall_call_c_stack_shim
6156
upcall_cmp_type
6257
upcall_dynastack_alloc
6358
upcall_dynastack_alloc_2

0 commit comments

Comments
 (0)