GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cpython/Python/emscripten_trampoline_inner.c at 3.14 · python/cpython

Expand file tree

/

emscripten_trampoline_inner.c

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
38 lines (34 loc) · 1.41 KB
/

emscripten_trampoline_inner.c

Copy path

File metadata and controls

38 lines (34 loc) · 1.41 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// This file must be compiled with -mgc to enable the extra wasm-gc
// instructions. It has to be compiled separately because not enough JS runtimes
// support wasm-gc yet. If the JS runtime does not support wasm-gc (or has buggy
// support like iOS), we will use the JS trampoline fallback.
// We can't import Python.h here because it is compiled/linked with -nostdlib.
// We don't need to know what's inside PyObject* anyways. We could just call it
// void* everywhere. There are two reasons to do this:
// 1. to improve readability
// 2. eventually when we are comfortable requiring wasm-gc, we can merge this
// into emscripten_trampoline.c without worrying about it.
typedef void PyObject;
typedef PyObject* (*three_arg)(PyObject*, PyObject*, PyObject*);
typedef PyObject* (*two_arg)(PyObject*, PyObject*);
typedef PyObject* (*one_arg)(PyObject*);
typedef PyObject* (*zero_arg)(void);
#define TRY_RETURN_CALL(ty, args...) \
if (__builtin_wasm_test_function_pointer_signature((ty)func)) { \
return ((ty)func)(args); \
}
__attribute__((export_name("trampoline_call"))) PyObject*
trampoline_call(int* success,
void* func,
PyObject* self,
PyObject* args,
PyObject* kw)
{
*success = 1;
TRY_RETURN_CALL(three_arg, self, args, kw);
TRY_RETURN_CALL(two_arg, self, args);
TRY_RETURN_CALL(one_arg, self);
TRY_RETURN_CALL(zero_arg);
*success = 0;
return 0;
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.