mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-40280: Optimize ints and and startup on wasm (GH-29887)
This commit is contained in:
parent
a6c3b0faa1
commit
cb8f491f46
2 changed files with 13 additions and 5 deletions
|
@ -87,10 +87,14 @@ Used in: Py_SAFE_DOWNCAST
|
||||||
|
|
||||||
/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
|
/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
|
||||||
the necessary integer types are available, and we're on a 64-bit platform
|
the necessary integer types are available, and we're on a 64-bit platform
|
||||||
(as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */
|
(as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits.
|
||||||
|
|
||||||
|
From pyodide: WASM has 32 bit pointers but has native 64 bit arithmetic
|
||||||
|
so it is more efficient to use 30 bit digits.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef PYLONG_BITS_IN_DIGIT
|
#ifndef PYLONG_BITS_IN_DIGIT
|
||||||
#if SIZEOF_VOID_P >= 8
|
#if SIZEOF_VOID_P >= 8 || defined(__wasm__)
|
||||||
# define PYLONG_BITS_IN_DIGIT 30
|
# define PYLONG_BITS_IN_DIGIT 30
|
||||||
#else
|
#else
|
||||||
# define PYLONG_BITS_IN_DIGIT 15
|
# define PYLONG_BITS_IN_DIGIT 15
|
||||||
|
|
|
@ -2145,7 +2145,11 @@ is_valid_fd(int fd)
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#if defined(F_GETFD) && (defined(__linux__) || defined(__APPLE__) || defined(MS_WINDOWS))
|
#if defined(F_GETFD) && ( \
|
||||||
|
defined(__linux__) || \
|
||||||
|
defined(__APPLE__) || \
|
||||||
|
defined(MS_WINDOWS) || \
|
||||||
|
defined(__wasm__))
|
||||||
int res;
|
int res;
|
||||||
_Py_BEGIN_SUPPRESS_IPH
|
_Py_BEGIN_SUPPRESS_IPH
|
||||||
res = fcntl(fd, F_GETFD);
|
res = fcntl(fd, F_GETFD);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue