-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'emscripten-core:main' into cw-audio-tweaks-2
- Loading branch information
Showing
41 changed files
with
328 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
#include <errno.h> | ||
#include "pthread_impl.h" | ||
|
||
#if __EMSCRIPTEN_PTHREADS__ | ||
// for pthreads, use the proper location on the thread info, so each | ||
// thread has its own errno | ||
int *__errno_location(void) | ||
{ | ||
return &__pthread_self()->errno_val; | ||
} | ||
#else | ||
// for single-threaded mode, avoid linking in pthreads support code | ||
// just for this | ||
static int __errno_storage = 0; | ||
#if __EMSCRIPTEN__ | ||
// For emscripten we use TLS here instead of `__pthread_self`, so that in single | ||
// threaded builds this gets lowered away to normal global variable. | ||
static _Thread_local int __errno_storage = 0; | ||
#endif | ||
|
||
int *__errno_location(void) | ||
{ | ||
#if __EMSCRIPTEN__ | ||
return &__errno_storage; | ||
} | ||
#else | ||
return &__pthread_self()->errno_val; | ||
#endif | ||
} | ||
|
||
weak_alias(__errno_location, ___errno_location); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.extern __stack_pointer | ||
.extern __stack_base | ||
.extern __stack_end | ||
|
||
#ifdef __wasm64__ | ||
#define PTR i64 | ||
#define ALIGN 3 | ||
#define PTRSTORE .int64 | ||
#else | ||
#define PTR i32 | ||
#define ALIGN 2 | ||
#define PTRSTORE .int32 | ||
#endif | ||
|
||
.globaltype __stack_pointer, PTR | ||
.globaltype __stack_end, PTR | ||
.globaltype __stack_base, PTR | ||
|
||
.globl _emscripten_wasm_worker_initialize | ||
_emscripten_wasm_worker_initialize: | ||
.functype _emscripten_wasm_worker_initialize (PTR /*stackLowestAddress*/, i32 /*stackSize*/) -> () | ||
|
||
// __stack_end = stackLowestAddress + (__builtin_wasm_tls_size() + 15) & -16; | ||
local.get 0 | ||
.globaltype __tls_size, PTR, immutable | ||
global.get __tls_size | ||
PTR.add | ||
PTR.const 0xf | ||
PTR.add | ||
PTR.const -0x10 | ||
PTR.and | ||
global.set __stack_end | ||
|
||
// __stack_base = stackLowestAddress + stackSize; | ||
local.get 0 | ||
local.get 1 | ||
#ifdef __wasm64__ | ||
i64.extend_i32_u | ||
#endif | ||
PTR.add | ||
global.set __stack_base | ||
|
||
// TODO: We'd like to do this here to avoid JS side calls to __set_stack_limits. | ||
// (or even better, we'd like to avoid duplicate versions of the stack variables) | ||
// See https://github.com/emscripten-core/emscripten/issues/16496 | ||
// global.get __stack_base | ||
// global.get __stack_end | ||
// .functype __set_stack_limits (PTR, PTR) -> () | ||
// call __set_stack_limits | ||
|
||
// __wasm_init_tls(stackLowestAddress); | ||
local.get 0 | ||
.functype __wasm_init_tls (PTR) -> () | ||
call __wasm_init_tls | ||
|
||
// N.b. The function __wasm_init_tls above does not need | ||
// __stack_pointer initialized, and it destroys the value it was set to. | ||
// So we must initialize __stack_pointer only *after* completing __wasm_init_tls: | ||
|
||
// __stack_pointer = __stack_base; | ||
global.get __stack_base | ||
global.set __stack_pointer | ||
|
||
end_function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
hello world… | ||
hello world… |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
first | ||
result: 1 1 | ||
second | ||
result: 2 -1 | ||
result: 2 -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.