|
15 | 15 | #endif
|
16 | 16 |
|
17 | 17 | .globaltype __stack_pointer, PTR
|
| 18 | +.globl __stack_pointer |
18 | 19 |
|
19 | 20 | .section .globals,"",@
|
20 | 21 |
|
21 | 22 | # TODO(sbc): It would be nice if these we initialized directly
|
22 | 23 | # using PTR.const rather than using the `emscripten_stack_init`
|
23 | 24 | .globaltype __stack_end, PTR
|
24 | 25 | __stack_end:
|
| 26 | +.globl __stack_end |
25 | 27 | .globaltype __stack_base, PTR
|
| 28 | +.globl __stack_base |
26 | 29 | __stack_base:
|
27 | 30 |
|
28 | 31 | .section .text,"",@
|
@@ -82,57 +85,6 @@ emscripten_stack_get_free:
|
82 | 85 | PTR.sub
|
83 | 86 | end_function
|
84 | 87 |
|
85 |
| -#ifdef __EMSCRIPTEN_WASM_WORKERS__ |
86 |
| -# TODO: Relocate the following to its own file wasm_worker.S, but need to figure out how to reference |
87 |
| -# __stack_base and __stack_end globals from a separate file as externs in order for that to work. |
88 |
| -.globl _emscripten_wasm_worker_initialize |
89 |
| -_emscripten_wasm_worker_initialize: |
90 |
| - .functype _emscripten_wasm_worker_initialize (PTR /*stackLowestAddress*/, i32 /*stackSize*/) -> () |
91 |
| - |
92 |
| - // __stack_end = stackLowestAddress + (__builtin_wasm_tls_size() + 15) & -16; |
93 |
| - local.get 0 |
94 |
| - .globaltype __tls_size, PTR, immutable |
95 |
| - global.get __tls_size |
96 |
| - PTR.add |
97 |
| - PTR.const 0xf |
98 |
| - PTR.add |
99 |
| - PTR.const -0x10 |
100 |
| - PTR.and |
101 |
| - global.set __stack_end |
102 |
| - |
103 |
| - // __stack_base = stackLowestAddress + stackSize; |
104 |
| - local.get 0 |
105 |
| - local.get 1 |
106 |
| -#ifdef __wasm64__ |
107 |
| - i64.extend_i32_u |
108 |
| -#endif |
109 |
| - PTR.add |
110 |
| - global.set __stack_base |
111 |
| - |
112 |
| -// TODO: We'd like to do this here to avoid JS side calls to __set_stack_limits. |
113 |
| -// (or even better, we'd like to avoid duplicate versions of the stack variables) |
114 |
| -// See https://github.com/emscripten-core/emscripten/issues/16496 |
115 |
| -// global.get __stack_base |
116 |
| -// global.get __stack_end |
117 |
| -// .functype __set_stack_limits (PTR, PTR) -> () |
118 |
| -// call __set_stack_limits |
119 |
| - |
120 |
| - // __wasm_init_tls(stackLowestAddress); |
121 |
| - local.get 0 |
122 |
| - .functype __wasm_init_tls (PTR) -> () |
123 |
| - call __wasm_init_tls |
124 |
| - |
125 |
| - // N.b. The function __wasm_init_tls above does not need |
126 |
| - // __stack_pointer initialized, and it destroys the value it was set to. |
127 |
| - // So we must initialize __stack_pointer only *after* completing __wasm_init_tls: |
128 |
| - |
129 |
| - // __stack_pointer = __stack_base; |
130 |
| - global.get __stack_base |
131 |
| - global.set __stack_pointer |
132 |
| - |
133 |
| - end_function |
134 |
| -#endif |
135 |
| - |
136 | 88 | # Add emscripten_stack_init to static ctors
|
137 | 89 | .section .init_array.1,"",@
|
138 | 90 | .p2align ALIGN
|
|
0 commit comments