FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-40280: Optimize ints and and startup on wasm (GH-29887) by tiran · Pull Request #29887 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .h  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 8 additions & 4 deletions Include/pyport.h
This file contains hidden or 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
Expand Up @@ -87,13 +87,17 @@ Used in: Py_SAFE_DOWNCAST

/* 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
(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
#if SIZEOF_VOID_P >= 8
#define PYLONG_BITS_IN_DIGIT 30
#if SIZEOF_VOID_P >= 8 || defined(__wasm__)
# define PYLONG_BITS_IN_DIGIT 30
#else
#define PYLONG_BITS_IN_DIGIT 15
# define PYLONG_BITS_IN_DIGIT 15
#endif
#endif

Expand Down
6 changes: 5 additions & 1 deletion Python/pylifecycle.c
This file contains hidden or 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
Expand Up @@ -2145,7 +2145,11 @@ is_valid_fd(int fd)
if (fd < 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;
_Py_BEGIN_SUPPRESS_IPH
res = fcntl(fd, F_GETFD);
Expand Down

Back | FazBrowse Home | New Git URL