pytron-kit 0.3.12__py3-none-macosx_11_0_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytron/__init__.py +112 -0
- pytron/application.py +562 -0
- pytron/apputils/__init__.py +0 -0
- pytron/apputils/chrome_ipc.py +203 -0
- pytron/apputils/codegen.py +261 -0
- pytron/apputils/config.py +303 -0
- pytron/apputils/deadmansswitch.py +47 -0
- pytron/apputils/extras.py +76 -0
- pytron/apputils/native.py +148 -0
- pytron/apputils/shell.py +73 -0
- pytron/apputils/windows.py +286 -0
- pytron/cli.py +384 -0
- pytron/commands/__init__.py +0 -0
- pytron/commands/android.py +28 -0
- pytron/commands/build.py +26 -0
- pytron/commands/doctor.py +221 -0
- pytron/commands/engine.py +23 -0
- pytron/commands/frontend.py +60 -0
- pytron/commands/harvest.py +112 -0
- pytron/commands/helpers.py +239 -0
- pytron/commands/info.py +50 -0
- pytron/commands/init.py +521 -0
- pytron/commands/install.py +294 -0
- pytron/commands/login.py +130 -0
- pytron/commands/package.py +228 -0
- pytron/commands/plugin.py +442 -0
- pytron/commands/run.py +312 -0
- pytron/commands/scan.py +210 -0
- pytron/commands/show.py +23 -0
- pytron/commands/uninstall.py +150 -0
- pytron/commands/utils.py +42 -0
- pytron/commands/workflow.py +95 -0
- pytron/console.py +133 -0
- pytron/core.py +18 -0
- pytron/dependencies/WebView2Loader.dll +0 -0
- pytron/dependencies/__init__.py +1 -0
- pytron/dependencies/pytron_native.so +0 -0
- pytron/engines/chrome/adapter.py +445 -0
- pytron/engines/chrome/engine.py +576 -0
- pytron/engines/chrome/forge.py +147 -0
- pytron/engines/chrome/shell/package.json +8 -0
- pytron/engines/chrome/shell/preload.js +12 -0
- pytron/engines/chrome/shell/shell.js +534 -0
- pytron/exceptions.py +36 -0
- pytron/inspector.py +201 -0
- pytron/inspector_ui.py +512 -0
- pytron/installer/Installation.nsi +236 -0
- pytron/installer/header.bmp +0 -0
- pytron/installer/pytron.ico +0 -0
- pytron/installer/sidebar.bmp +0 -0
- pytron/llms.md +98 -0
- pytron/manifests/README.md +29 -0
- pytron/manifests/windows-utf8.manifest +44 -0
- pytron/menu.py +128 -0
- pytron/nsis-setup.exe +0 -0
- pytron/pack/__init__.py +0 -0
- pytron/pack/assets.py +131 -0
- pytron/pack/compilers.py +289 -0
- pytron/pack/crystal.py +297 -0
- pytron/pack/graph.py +377 -0
- pytron/pack/inference.py +157 -0
- pytron/pack/installers.py +402 -0
- pytron/pack/introspect.py +357 -0
- pytron/pack/metadata.py +213 -0
- pytron/pack/modules.py +618 -0
- pytron/pack/nuitka.py +108 -0
- pytron/pack/pipeline.py +107 -0
- pytron/pack/pyinstaller.py +176 -0
- pytron/pack/rust_engine.py +273 -0
- pytron/pack/secure.py +309 -0
- pytron/pack/secure_loader/bin/pytron_rust_bootloader +0 -0
- pytron/pack/secure_loader/icon.ico +0 -0
- pytron/pack/utils.py +110 -0
- pytron/pack/virtual_root.py +124 -0
- pytron/platforms/__init__.py +0 -0
- pytron/platforms/android/__init__.py +3 -0
- pytron/platforms/android/android.py +103 -0
- pytron/platforms/android/builder.py +736 -0
- pytron/platforms/android/ops/build.py +79 -0
- pytron/platforms/android/ops/init.py +63 -0
- pytron/platforms/android/ops/run.py +79 -0
- pytron/platforms/android/ops/sync.py +770 -0
- pytron/platforms/android/ops/utils.py +8 -0
- pytron/platforms/android/shell/README.md +30 -0
- pytron/platforms/android/shell/app/build.gradle +64 -0
- pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
- pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
- pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
- pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
- pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- pytron/platforms/android/shell/build.gradle +11 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
- pytron/platforms/android/shell/gradle.properties +2 -0
- pytron/platforms/android/shell/gradlew.bat +85 -0
- pytron/platforms/android/shell/settings.gradle +16 -0
- pytron/platforms/darwin.py +82 -0
- pytron/platforms/darwin_ops/libs.py +31 -0
- pytron/platforms/darwin_ops/system.py +182 -0
- pytron/platforms/darwin_ops/utils.py +85 -0
- pytron/platforms/darwin_ops/webview.py +5 -0
- pytron/platforms/darwin_ops/window.py +102 -0
- pytron/platforms/interface.py +152 -0
- pytron/platforms/linux.py +82 -0
- pytron/platforms/linux_ops/libs.py +49 -0
- pytron/platforms/linux_ops/system.py +316 -0
- pytron/platforms/linux_ops/utils.py +19 -0
- pytron/platforms/linux_ops/webview.py +5 -0
- pytron/platforms/linux_ops/window.py +115 -0
- pytron/platforms/windows.py +136 -0
- pytron/platforms/windows_ops/__init__.py +0 -0
- pytron/platforms/windows_ops/constants.py +126 -0
- pytron/platforms/windows_ops/system.py +518 -0
- pytron/platforms/windows_ops/utils.py +3 -0
- pytron/platforms/windows_ops/webview.py +5 -0
- pytron/platforms/windows_ops/window.py +361 -0
- pytron/plugin.py +467 -0
- pytron/rcedit-x64.exe +0 -0
- pytron/router.py +146 -0
- pytron/serializer.py +240 -0
- pytron/shortcuts.py +279 -0
- pytron/state.py +76 -0
- pytron/tray.py +399 -0
- pytron/updater.py +181 -0
- pytron/utf8_hook.py +112 -0
- pytron/utils.py +44 -0
- pytron/webview.py +722 -0
- pytron_kit-0.3.12.dist-info/METADATA +131 -0
- pytron_kit-0.3.12.dist-info/RECORD +419 -0
- pytron_kit-0.3.12.dist-info/WHEEL +5 -0
- pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
- pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
- pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* File object interface (what's left of it -- see io.py) */
|
|
2
|
+
|
|
3
|
+
#ifndef Py_FILEOBJECT_H
|
|
4
|
+
#define Py_FILEOBJECT_H
|
|
5
|
+
#ifdef __cplusplus
|
|
6
|
+
extern "C" {
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#define PY_STDIOTEXTMODE "b"
|
|
10
|
+
|
|
11
|
+
PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int,
|
|
12
|
+
const char *, const char *,
|
|
13
|
+
const char *, int);
|
|
14
|
+
PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);
|
|
15
|
+
PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);
|
|
16
|
+
PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);
|
|
17
|
+
PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);
|
|
18
|
+
|
|
19
|
+
/* The default encoding used by the platform file system APIs
|
|
20
|
+
If non-NULL, this is different than the default encoding for strings
|
|
21
|
+
*/
|
|
22
|
+
Py_DEPRECATED(3.12) PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;
|
|
23
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000
|
|
24
|
+
Py_DEPRECATED(3.12) PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors;
|
|
25
|
+
#endif
|
|
26
|
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding;
|
|
27
|
+
|
|
28
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
|
|
29
|
+
Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_UTF8Mode;
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#ifndef Py_LIMITED_API
|
|
33
|
+
# define Py_CPYTHON_FILEOBJECT_H
|
|
34
|
+
# include "cpython/fileobject.h"
|
|
35
|
+
# undef Py_CPYTHON_FILEOBJECT_H
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#ifdef __cplusplus
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
#endif /* !Py_FILEOBJECT_H */
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#ifndef Py_FILEUTILS_H
|
|
2
|
+
#define Py_FILEUTILS_H
|
|
3
|
+
|
|
4
|
+
/*******************************
|
|
5
|
+
* stat() and fstat() fiddling *
|
|
6
|
+
*******************************/
|
|
7
|
+
|
|
8
|
+
#ifdef HAVE_SYS_STAT_H
|
|
9
|
+
# include <sys/stat.h> // S_ISREG()
|
|
10
|
+
#elif defined(HAVE_STAT_H)
|
|
11
|
+
# include <stat.h> // S_ISREG()
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#ifndef S_IFMT
|
|
15
|
+
// VisualAge C/C++ Failed to Define MountType Field in sys/stat.h.
|
|
16
|
+
# define S_IFMT 0170000
|
|
17
|
+
#endif
|
|
18
|
+
#ifndef S_IFLNK
|
|
19
|
+
// Windows doesn't define S_IFLNK, but posixmodule.c maps
|
|
20
|
+
// IO_REPARSE_TAG_SYMLINK to S_IFLNK.
|
|
21
|
+
# define S_IFLNK 0120000
|
|
22
|
+
#endif
|
|
23
|
+
#ifndef S_ISREG
|
|
24
|
+
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
|
|
25
|
+
#endif
|
|
26
|
+
#ifndef S_ISDIR
|
|
27
|
+
# define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
|
|
28
|
+
#endif
|
|
29
|
+
#ifndef S_ISCHR
|
|
30
|
+
# define S_ISCHR(x) (((x) & S_IFMT) == S_IFCHR)
|
|
31
|
+
#endif
|
|
32
|
+
#ifndef S_ISLNK
|
|
33
|
+
# define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// Move this down here since some C++ #include's don't like to be included
|
|
38
|
+
// inside an extern "C".
|
|
39
|
+
#ifdef __cplusplus
|
|
40
|
+
extern "C" {
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
|
44
|
+
PyAPI_FUNC(wchar_t *) Py_DecodeLocale(
|
|
45
|
+
const char *arg,
|
|
46
|
+
size_t *size);
|
|
47
|
+
|
|
48
|
+
PyAPI_FUNC(char*) Py_EncodeLocale(
|
|
49
|
+
const wchar_t *text,
|
|
50
|
+
size_t *error_pos);
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
#ifndef Py_LIMITED_API
|
|
54
|
+
# define Py_CPYTHON_FILEUTILS_H
|
|
55
|
+
# include "cpython/fileutils.h"
|
|
56
|
+
# undef Py_CPYTHON_FILEUTILS_H
|
|
57
|
+
#endif
|
|
58
|
+
|
|
59
|
+
#ifdef __cplusplus
|
|
60
|
+
}
|
|
61
|
+
#endif
|
|
62
|
+
#endif /* !Py_FILEUTILS_H */
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
/* Float object interface */
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
PyFloatObject represents a (double precision) floating-point number.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef Py_FLOATOBJECT_H
|
|
9
|
+
#define Py_FLOATOBJECT_H
|
|
10
|
+
#ifdef __cplusplus
|
|
11
|
+
extern "C" {
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
|
15
|
+
|
|
16
|
+
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
|
|
17
|
+
#define PyFloat_CheckExact(op) Py_IS_TYPE((op), &PyFloat_Type)
|
|
18
|
+
|
|
19
|
+
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
|
|
20
|
+
|
|
21
|
+
#define Py_RETURN_INF(sign) \
|
|
22
|
+
do { \
|
|
23
|
+
if (copysign(1., sign) == 1.) { \
|
|
24
|
+
return PyFloat_FromDouble(Py_INFINITY); \
|
|
25
|
+
} \
|
|
26
|
+
else { \
|
|
27
|
+
return PyFloat_FromDouble(-Py_INFINITY); \
|
|
28
|
+
} \
|
|
29
|
+
} while(0)
|
|
30
|
+
|
|
31
|
+
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
|
32
|
+
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
|
33
|
+
PyAPI_FUNC(PyObject*) PyFloat_GetInfo(void);
|
|
34
|
+
|
|
35
|
+
/* Return Python float from string PyObject. */
|
|
36
|
+
PyAPI_FUNC(PyObject*) PyFloat_FromString(PyObject*);
|
|
37
|
+
|
|
38
|
+
/* Return Python float from C double. */
|
|
39
|
+
PyAPI_FUNC(PyObject*) PyFloat_FromDouble(double);
|
|
40
|
+
|
|
41
|
+
/* Extract C double from Python float. The macro version trades safety for
|
|
42
|
+
speed. */
|
|
43
|
+
PyAPI_FUNC(double) PyFloat_AsDouble(PyObject*);
|
|
44
|
+
|
|
45
|
+
#ifndef Py_LIMITED_API
|
|
46
|
+
# define Py_CPYTHON_FLOATOBJECT_H
|
|
47
|
+
# include "cpython/floatobject.h"
|
|
48
|
+
# undef Py_CPYTHON_FLOATOBJECT_H
|
|
49
|
+
#endif
|
|
50
|
+
|
|
51
|
+
#ifdef __cplusplus
|
|
52
|
+
}
|
|
53
|
+
#endif
|
|
54
|
+
#endif /* !Py_FLOATOBJECT_H */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* Frame object interface */
|
|
2
|
+
|
|
3
|
+
#ifndef Py_FRAMEOBJECT_H
|
|
4
|
+
#define Py_FRAMEOBJECT_H
|
|
5
|
+
#ifdef __cplusplus
|
|
6
|
+
extern "C" {
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#include "pyframe.h"
|
|
10
|
+
|
|
11
|
+
#ifndef Py_LIMITED_API
|
|
12
|
+
# define Py_CPYTHON_FRAMEOBJECT_H
|
|
13
|
+
# include "cpython/frameobject.h"
|
|
14
|
+
# undef Py_CPYTHON_FRAMEOBJECT_H
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#ifdef __cplusplus
|
|
18
|
+
}
|
|
19
|
+
#endif
|
|
20
|
+
#endif /* !Py_FRAMEOBJECT_H */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Implementation of PEP 585: support list[int] etc.
|
|
2
|
+
#ifndef Py_GENERICALIASOBJECT_H
|
|
3
|
+
#define Py_GENERICALIASOBJECT_H
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
PyAPI_FUNC(PyObject *) Py_GenericAlias(PyObject *, PyObject *);
|
|
9
|
+
PyAPI_DATA(PyTypeObject) Py_GenericAliasType;
|
|
10
|
+
|
|
11
|
+
#ifdef __cplusplus
|
|
12
|
+
}
|
|
13
|
+
#endif
|
|
14
|
+
#endif /* !Py_GENERICALIASOBJECT_H */
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* Module definition and import interface */
|
|
2
|
+
|
|
3
|
+
#ifndef Py_IMPORT_H
|
|
4
|
+
#define Py_IMPORT_H
|
|
5
|
+
#ifdef __cplusplus
|
|
6
|
+
extern "C" {
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
PyAPI_FUNC(long) PyImport_GetMagicNumber(void);
|
|
10
|
+
PyAPI_FUNC(const char *) PyImport_GetMagicTag(void);
|
|
11
|
+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(
|
|
12
|
+
const char *name, /* UTF-8 encoded string */
|
|
13
|
+
PyObject *co
|
|
14
|
+
);
|
|
15
|
+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx(
|
|
16
|
+
const char *name, /* UTF-8 encoded string */
|
|
17
|
+
PyObject *co,
|
|
18
|
+
const char *pathname /* decoded from the filesystem encoding */
|
|
19
|
+
);
|
|
20
|
+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleWithPathnames(
|
|
21
|
+
const char *name, /* UTF-8 encoded string */
|
|
22
|
+
PyObject *co,
|
|
23
|
+
const char *pathname, /* decoded from the filesystem encoding */
|
|
24
|
+
const char *cpathname /* decoded from the filesystem encoding */
|
|
25
|
+
);
|
|
26
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
|
27
|
+
PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject(
|
|
28
|
+
PyObject *name,
|
|
29
|
+
PyObject *co,
|
|
30
|
+
PyObject *pathname,
|
|
31
|
+
PyObject *cpathname
|
|
32
|
+
);
|
|
33
|
+
#endif
|
|
34
|
+
PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void);
|
|
35
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000
|
|
36
|
+
PyAPI_FUNC(PyObject *) PyImport_GetModule(PyObject *name);
|
|
37
|
+
#endif
|
|
38
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
|
39
|
+
PyAPI_FUNC(PyObject *) PyImport_AddModuleObject(
|
|
40
|
+
PyObject *name
|
|
41
|
+
);
|
|
42
|
+
#endif
|
|
43
|
+
PyAPI_FUNC(PyObject *) PyImport_AddModule(
|
|
44
|
+
const char *name /* UTF-8 encoded string */
|
|
45
|
+
);
|
|
46
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030d0000
|
|
47
|
+
PyAPI_FUNC(PyObject *) PyImport_AddModuleRef(
|
|
48
|
+
const char *name /* UTF-8 encoded string */
|
|
49
|
+
);
|
|
50
|
+
#endif
|
|
51
|
+
PyAPI_FUNC(PyObject *) PyImport_ImportModule(
|
|
52
|
+
const char *name /* UTF-8 encoded string */
|
|
53
|
+
);
|
|
54
|
+
Py_DEPRECATED(3.13) PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(
|
|
55
|
+
const char *name /* UTF-8 encoded string */
|
|
56
|
+
);
|
|
57
|
+
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(
|
|
58
|
+
const char *name, /* UTF-8 encoded string */
|
|
59
|
+
PyObject *globals,
|
|
60
|
+
PyObject *locals,
|
|
61
|
+
PyObject *fromlist,
|
|
62
|
+
int level
|
|
63
|
+
);
|
|
64
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
|
|
65
|
+
PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject(
|
|
66
|
+
PyObject *name,
|
|
67
|
+
PyObject *globals,
|
|
68
|
+
PyObject *locals,
|
|
69
|
+
PyObject *fromlist,
|
|
70
|
+
int level
|
|
71
|
+
);
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
#define PyImport_ImportModuleEx(n, g, l, f) \
|
|
75
|
+
PyImport_ImportModuleLevel((n), (g), (l), (f), 0)
|
|
76
|
+
|
|
77
|
+
PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path);
|
|
78
|
+
PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name);
|
|
79
|
+
PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m);
|
|
80
|
+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
|
|
81
|
+
PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject(
|
|
82
|
+
PyObject *name
|
|
83
|
+
);
|
|
84
|
+
#endif
|
|
85
|
+
PyAPI_FUNC(int) PyImport_ImportFrozenModule(
|
|
86
|
+
const char *name /* UTF-8 encoded string */
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
PyAPI_FUNC(int) PyImport_AppendInittab(
|
|
90
|
+
const char *name, /* ASCII encoded string */
|
|
91
|
+
PyObject* (*initfunc)(void)
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
#ifndef Py_LIMITED_API
|
|
95
|
+
# define Py_CPYTHON_IMPORT_H
|
|
96
|
+
# include "cpython/import.h"
|
|
97
|
+
# undef Py_CPYTHON_IMPORT_H
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
#ifdef __cplusplus
|
|
101
|
+
}
|
|
102
|
+
#endif
|
|
103
|
+
#endif /* !Py_IMPORT_H */
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/* ----------------------------------------------------------------------------
|
|
2
|
+
Copyright (c) 2018-2023 Microsoft Research, Daan Leijen
|
|
3
|
+
This is free software; you can redistribute it and/or modify it under the
|
|
4
|
+
terms of the MIT license. A copy of the license can be found in the file
|
|
5
|
+
"LICENSE" at the root of this distribution.
|
|
6
|
+
-----------------------------------------------------------------------------*/
|
|
7
|
+
#pragma once
|
|
8
|
+
#ifndef MIMALLOC_ATOMIC_H
|
|
9
|
+
#define MIMALLOC_ATOMIC_H
|
|
10
|
+
|
|
11
|
+
// --------------------------------------------------------------------------------------------
|
|
12
|
+
// Atomics
|
|
13
|
+
// We need to be portable between C, C++, and MSVC.
|
|
14
|
+
// We base the primitives on the C/C++ atomics and create a minimal wrapper for MSVC in C compilation mode.
|
|
15
|
+
// This is why we try to use only `uintptr_t` and `<type>*` as atomic types.
|
|
16
|
+
// To gain better insight in the range of used atomics, we use explicitly named memory order operations
|
|
17
|
+
// instead of passing the memory order as a parameter.
|
|
18
|
+
// -----------------------------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
#if defined(__cplusplus)
|
|
21
|
+
// Use C++ atomics
|
|
22
|
+
#include <atomic>
|
|
23
|
+
#define _Atomic(tp) std::atomic<tp>
|
|
24
|
+
#define mi_atomic(name) std::atomic_##name
|
|
25
|
+
#define mi_memory_order(name) std::memory_order_##name
|
|
26
|
+
#if (__cplusplus >= 202002L) // c++20, see issue #571
|
|
27
|
+
#define MI_ATOMIC_VAR_INIT(x) x
|
|
28
|
+
#elif !defined(ATOMIC_VAR_INIT)
|
|
29
|
+
#define MI_ATOMIC_VAR_INIT(x) x
|
|
30
|
+
#else
|
|
31
|
+
#define MI_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x)
|
|
32
|
+
#endif
|
|
33
|
+
#elif defined(_MSC_VER)
|
|
34
|
+
// Use MSVC C wrapper for C11 atomics
|
|
35
|
+
#define _Atomic(tp) tp
|
|
36
|
+
#define MI_ATOMIC_VAR_INIT(x) x
|
|
37
|
+
#define mi_atomic(name) mi_atomic_##name
|
|
38
|
+
#define mi_memory_order(name) mi_memory_order_##name
|
|
39
|
+
#else
|
|
40
|
+
// Use C11 atomics
|
|
41
|
+
#include <stdatomic.h>
|
|
42
|
+
#define mi_atomic(name) atomic_##name
|
|
43
|
+
#define mi_memory_order(name) memory_order_##name
|
|
44
|
+
#if (__STDC_VERSION__ >= 201710L) // c17, see issue #735
|
|
45
|
+
#define MI_ATOMIC_VAR_INIT(x) x
|
|
46
|
+
#elif !defined(ATOMIC_VAR_INIT)
|
|
47
|
+
#define MI_ATOMIC_VAR_INIT(x) x
|
|
48
|
+
#else
|
|
49
|
+
#define MI_ATOMIC_VAR_INIT(x) ATOMIC_VAR_INIT(x)
|
|
50
|
+
#endif
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
// Various defines for all used memory orders in mimalloc
|
|
54
|
+
#define mi_atomic_cas_weak(p,expected,desired,mem_success,mem_fail) \
|
|
55
|
+
mi_atomic(compare_exchange_weak_explicit)(p,expected,desired,mem_success,mem_fail)
|
|
56
|
+
|
|
57
|
+
#define mi_atomic_cas_strong(p,expected,desired,mem_success,mem_fail) \
|
|
58
|
+
mi_atomic(compare_exchange_strong_explicit)(p,expected,desired,mem_success,mem_fail)
|
|
59
|
+
|
|
60
|
+
#define mi_atomic_load_acquire(p) mi_atomic(load_explicit)(p,mi_memory_order(acquire))
|
|
61
|
+
#define mi_atomic_load_relaxed(p) mi_atomic(load_explicit)(p,mi_memory_order(relaxed))
|
|
62
|
+
#define mi_atomic_store_release(p,x) mi_atomic(store_explicit)(p,x,mi_memory_order(release))
|
|
63
|
+
#define mi_atomic_store_relaxed(p,x) mi_atomic(store_explicit)(p,x,mi_memory_order(relaxed))
|
|
64
|
+
#define mi_atomic_exchange_release(p,x) mi_atomic(exchange_explicit)(p,x,mi_memory_order(release))
|
|
65
|
+
#define mi_atomic_exchange_acq_rel(p,x) mi_atomic(exchange_explicit)(p,x,mi_memory_order(acq_rel))
|
|
66
|
+
#define mi_atomic_cas_weak_release(p,exp,des) mi_atomic_cas_weak(p,exp,des,mi_memory_order(release),mi_memory_order(relaxed))
|
|
67
|
+
#define mi_atomic_cas_weak_acq_rel(p,exp,des) mi_atomic_cas_weak(p,exp,des,mi_memory_order(acq_rel),mi_memory_order(acquire))
|
|
68
|
+
#define mi_atomic_cas_strong_release(p,exp,des) mi_atomic_cas_strong(p,exp,des,mi_memory_order(release),mi_memory_order(relaxed))
|
|
69
|
+
#define mi_atomic_cas_strong_acq_rel(p,exp,des) mi_atomic_cas_strong(p,exp,des,mi_memory_order(acq_rel),mi_memory_order(acquire))
|
|
70
|
+
|
|
71
|
+
#define mi_atomic_add_relaxed(p,x) mi_atomic(fetch_add_explicit)(p,x,mi_memory_order(relaxed))
|
|
72
|
+
#define mi_atomic_sub_relaxed(p,x) mi_atomic(fetch_sub_explicit)(p,x,mi_memory_order(relaxed))
|
|
73
|
+
#define mi_atomic_add_acq_rel(p,x) mi_atomic(fetch_add_explicit)(p,x,mi_memory_order(acq_rel))
|
|
74
|
+
#define mi_atomic_sub_acq_rel(p,x) mi_atomic(fetch_sub_explicit)(p,x,mi_memory_order(acq_rel))
|
|
75
|
+
#define mi_atomic_and_acq_rel(p,x) mi_atomic(fetch_and_explicit)(p,x,mi_memory_order(acq_rel))
|
|
76
|
+
#define mi_atomic_or_acq_rel(p,x) mi_atomic(fetch_or_explicit)(p,x,mi_memory_order(acq_rel))
|
|
77
|
+
|
|
78
|
+
#define mi_atomic_increment_relaxed(p) mi_atomic_add_relaxed(p,(uintptr_t)1)
|
|
79
|
+
#define mi_atomic_decrement_relaxed(p) mi_atomic_sub_relaxed(p,(uintptr_t)1)
|
|
80
|
+
#define mi_atomic_increment_acq_rel(p) mi_atomic_add_acq_rel(p,(uintptr_t)1)
|
|
81
|
+
#define mi_atomic_decrement_acq_rel(p) mi_atomic_sub_acq_rel(p,(uintptr_t)1)
|
|
82
|
+
|
|
83
|
+
static inline void mi_atomic_yield(void);
|
|
84
|
+
static inline intptr_t mi_atomic_addi(_Atomic(intptr_t)*p, intptr_t add);
|
|
85
|
+
static inline intptr_t mi_atomic_subi(_Atomic(intptr_t)*p, intptr_t sub);
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
#if defined(__cplusplus) || !defined(_MSC_VER)
|
|
89
|
+
|
|
90
|
+
// In C++/C11 atomics we have polymorphic atomics so can use the typed `ptr` variants (where `tp` is the type of atomic value)
|
|
91
|
+
// We use these macros so we can provide a typed wrapper in MSVC in C compilation mode as well
|
|
92
|
+
#define mi_atomic_load_ptr_acquire(tp,p) mi_atomic_load_acquire(p)
|
|
93
|
+
#define mi_atomic_load_ptr_relaxed(tp,p) mi_atomic_load_relaxed(p)
|
|
94
|
+
|
|
95
|
+
// In C++ we need to add casts to help resolve templates if NULL is passed
|
|
96
|
+
#if defined(__cplusplus)
|
|
97
|
+
#define mi_atomic_store_ptr_release(tp,p,x) mi_atomic_store_release(p,(tp*)x)
|
|
98
|
+
#define mi_atomic_store_ptr_relaxed(tp,p,x) mi_atomic_store_relaxed(p,(tp*)x)
|
|
99
|
+
#define mi_atomic_cas_ptr_weak_release(tp,p,exp,des) mi_atomic_cas_weak_release(p,exp,(tp*)des)
|
|
100
|
+
#define mi_atomic_cas_ptr_weak_acq_rel(tp,p,exp,des) mi_atomic_cas_weak_acq_rel(p,exp,(tp*)des)
|
|
101
|
+
#define mi_atomic_cas_ptr_strong_release(tp,p,exp,des) mi_atomic_cas_strong_release(p,exp,(tp*)des)
|
|
102
|
+
#define mi_atomic_exchange_ptr_release(tp,p,x) mi_atomic_exchange_release(p,(tp*)x)
|
|
103
|
+
#define mi_atomic_exchange_ptr_acq_rel(tp,p,x) mi_atomic_exchange_acq_rel(p,(tp*)x)
|
|
104
|
+
#else
|
|
105
|
+
#define mi_atomic_store_ptr_release(tp,p,x) mi_atomic_store_release(p,x)
|
|
106
|
+
#define mi_atomic_store_ptr_relaxed(tp,p,x) mi_atomic_store_relaxed(p,x)
|
|
107
|
+
#define mi_atomic_cas_ptr_weak_release(tp,p,exp,des) mi_atomic_cas_weak_release(p,exp,des)
|
|
108
|
+
#define mi_atomic_cas_ptr_weak_acq_rel(tp,p,exp,des) mi_atomic_cas_weak_acq_rel(p,exp,des)
|
|
109
|
+
#define mi_atomic_cas_ptr_strong_release(tp,p,exp,des) mi_atomic_cas_strong_release(p,exp,des)
|
|
110
|
+
#define mi_atomic_exchange_ptr_release(tp,p,x) mi_atomic_exchange_release(p,x)
|
|
111
|
+
#define mi_atomic_exchange_ptr_acq_rel(tp,p,x) mi_atomic_exchange_acq_rel(p,x)
|
|
112
|
+
#endif
|
|
113
|
+
|
|
114
|
+
// These are used by the statistics
|
|
115
|
+
static inline int64_t mi_atomic_addi64_relaxed(volatile int64_t* p, int64_t add) {
|
|
116
|
+
return mi_atomic(fetch_add_explicit)((_Atomic(int64_t)*)p, add, mi_memory_order(relaxed));
|
|
117
|
+
}
|
|
118
|
+
static inline void mi_atomic_maxi64_relaxed(volatile int64_t* p, int64_t x) {
|
|
119
|
+
int64_t current = mi_atomic_load_relaxed((_Atomic(int64_t)*)p);
|
|
120
|
+
while (current < x && !mi_atomic_cas_weak_release((_Atomic(int64_t)*)p, ¤t, x)) { /* nothing */ };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Used by timers
|
|
124
|
+
#define mi_atomic_loadi64_acquire(p) mi_atomic(load_explicit)(p,mi_memory_order(acquire))
|
|
125
|
+
#define mi_atomic_loadi64_relaxed(p) mi_atomic(load_explicit)(p,mi_memory_order(relaxed))
|
|
126
|
+
#define mi_atomic_storei64_release(p,x) mi_atomic(store_explicit)(p,x,mi_memory_order(release))
|
|
127
|
+
#define mi_atomic_storei64_relaxed(p,x) mi_atomic(store_explicit)(p,x,mi_memory_order(relaxed))
|
|
128
|
+
|
|
129
|
+
#define mi_atomic_casi64_strong_acq_rel(p,e,d) mi_atomic_cas_strong_acq_rel(p,e,d)
|
|
130
|
+
#define mi_atomic_addi64_acq_rel(p,i) mi_atomic_add_acq_rel(p,i)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
#elif defined(_MSC_VER)
|
|
134
|
+
|
|
135
|
+
// MSVC C compilation wrapper that uses Interlocked operations to model C11 atomics.
|
|
136
|
+
#define WIN32_LEAN_AND_MEAN
|
|
137
|
+
#include <windows.h>
|
|
138
|
+
#include <intrin.h>
|
|
139
|
+
#ifdef _WIN64
|
|
140
|
+
typedef LONG64 msc_intptr_t;
|
|
141
|
+
#define MI_64(f) f##64
|
|
142
|
+
#else
|
|
143
|
+
typedef LONG msc_intptr_t;
|
|
144
|
+
#define MI_64(f) f
|
|
145
|
+
#endif
|
|
146
|
+
|
|
147
|
+
typedef enum mi_memory_order_e {
|
|
148
|
+
mi_memory_order_relaxed,
|
|
149
|
+
mi_memory_order_consume,
|
|
150
|
+
mi_memory_order_acquire,
|
|
151
|
+
mi_memory_order_release,
|
|
152
|
+
mi_memory_order_acq_rel,
|
|
153
|
+
mi_memory_order_seq_cst
|
|
154
|
+
} mi_memory_order;
|
|
155
|
+
|
|
156
|
+
static inline uintptr_t mi_atomic_fetch_add_explicit(_Atomic(uintptr_t)*p, uintptr_t add, mi_memory_order mo) {
|
|
157
|
+
(void)(mo);
|
|
158
|
+
return (uintptr_t)MI_64(_InterlockedExchangeAdd)((volatile msc_intptr_t*)p, (msc_intptr_t)add);
|
|
159
|
+
}
|
|
160
|
+
static inline uintptr_t mi_atomic_fetch_sub_explicit(_Atomic(uintptr_t)*p, uintptr_t sub, mi_memory_order mo) {
|
|
161
|
+
(void)(mo);
|
|
162
|
+
return (uintptr_t)MI_64(_InterlockedExchangeAdd)((volatile msc_intptr_t*)p, -((msc_intptr_t)sub));
|
|
163
|
+
}
|
|
164
|
+
static inline uintptr_t mi_atomic_fetch_and_explicit(_Atomic(uintptr_t)*p, uintptr_t x, mi_memory_order mo) {
|
|
165
|
+
(void)(mo);
|
|
166
|
+
return (uintptr_t)MI_64(_InterlockedAnd)((volatile msc_intptr_t*)p, (msc_intptr_t)x);
|
|
167
|
+
}
|
|
168
|
+
static inline uintptr_t mi_atomic_fetch_or_explicit(_Atomic(uintptr_t)*p, uintptr_t x, mi_memory_order mo) {
|
|
169
|
+
(void)(mo);
|
|
170
|
+
return (uintptr_t)MI_64(_InterlockedOr)((volatile msc_intptr_t*)p, (msc_intptr_t)x);
|
|
171
|
+
}
|
|
172
|
+
static inline bool mi_atomic_compare_exchange_strong_explicit(_Atomic(uintptr_t)*p, uintptr_t* expected, uintptr_t desired, mi_memory_order mo1, mi_memory_order mo2) {
|
|
173
|
+
(void)(mo1); (void)(mo2);
|
|
174
|
+
uintptr_t read = (uintptr_t)MI_64(_InterlockedCompareExchange)((volatile msc_intptr_t*)p, (msc_intptr_t)desired, (msc_intptr_t)(*expected));
|
|
175
|
+
if (read == *expected) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
*expected = read;
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
static inline bool mi_atomic_compare_exchange_weak_explicit(_Atomic(uintptr_t)*p, uintptr_t* expected, uintptr_t desired, mi_memory_order mo1, mi_memory_order mo2) {
|
|
184
|
+
return mi_atomic_compare_exchange_strong_explicit(p, expected, desired, mo1, mo2);
|
|
185
|
+
}
|
|
186
|
+
static inline uintptr_t mi_atomic_exchange_explicit(_Atomic(uintptr_t)*p, uintptr_t exchange, mi_memory_order mo) {
|
|
187
|
+
(void)(mo);
|
|
188
|
+
return (uintptr_t)MI_64(_InterlockedExchange)((volatile msc_intptr_t*)p, (msc_intptr_t)exchange);
|
|
189
|
+
}
|
|
190
|
+
static inline void mi_atomic_thread_fence(mi_memory_order mo) {
|
|
191
|
+
(void)(mo);
|
|
192
|
+
_Atomic(uintptr_t) x = 0;
|
|
193
|
+
mi_atomic_exchange_explicit(&x, 1, mo);
|
|
194
|
+
}
|
|
195
|
+
static inline uintptr_t mi_atomic_load_explicit(_Atomic(uintptr_t) const* p, mi_memory_order mo) {
|
|
196
|
+
(void)(mo);
|
|
197
|
+
#if defined(_M_IX86) || defined(_M_X64)
|
|
198
|
+
return *p;
|
|
199
|
+
#else
|
|
200
|
+
uintptr_t x = *p;
|
|
201
|
+
if (mo > mi_memory_order_relaxed) {
|
|
202
|
+
while (!mi_atomic_compare_exchange_weak_explicit((_Atomic(uintptr_t)*)p, &x, x, mo, mi_memory_order_relaxed)) { /* nothing */ };
|
|
203
|
+
}
|
|
204
|
+
return x;
|
|
205
|
+
#endif
|
|
206
|
+
}
|
|
207
|
+
static inline void mi_atomic_store_explicit(_Atomic(uintptr_t)*p, uintptr_t x, mi_memory_order mo) {
|
|
208
|
+
(void)(mo);
|
|
209
|
+
#if defined(_M_IX86) || defined(_M_X64)
|
|
210
|
+
*p = x;
|
|
211
|
+
#else
|
|
212
|
+
mi_atomic_exchange_explicit(p, x, mo);
|
|
213
|
+
#endif
|
|
214
|
+
}
|
|
215
|
+
static inline int64_t mi_atomic_loadi64_explicit(_Atomic(int64_t)*p, mi_memory_order mo) {
|
|
216
|
+
(void)(mo);
|
|
217
|
+
#if defined(_M_X64)
|
|
218
|
+
return *p;
|
|
219
|
+
#else
|
|
220
|
+
int64_t old = *p;
|
|
221
|
+
int64_t x = old;
|
|
222
|
+
while ((old = InterlockedCompareExchange64(p, x, old)) != x) {
|
|
223
|
+
x = old;
|
|
224
|
+
}
|
|
225
|
+
return x;
|
|
226
|
+
#endif
|
|
227
|
+
}
|
|
228
|
+
static inline void mi_atomic_storei64_explicit(_Atomic(int64_t)*p, int64_t x, mi_memory_order mo) {
|
|
229
|
+
(void)(mo);
|
|
230
|
+
#if defined(x_M_IX86) || defined(_M_X64)
|
|
231
|
+
*p = x;
|
|
232
|
+
#else
|
|
233
|
+
InterlockedExchange64(p, x);
|
|
234
|
+
#endif
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// These are used by the statistics
|
|
238
|
+
static inline int64_t mi_atomic_addi64_relaxed(volatile _Atomic(int64_t)*p, int64_t add) {
|
|
239
|
+
#ifdef _WIN64
|
|
240
|
+
return (int64_t)mi_atomic_addi((int64_t*)p, add);
|
|
241
|
+
#else
|
|
242
|
+
int64_t current;
|
|
243
|
+
int64_t sum;
|
|
244
|
+
do {
|
|
245
|
+
current = *p;
|
|
246
|
+
sum = current + add;
|
|
247
|
+
} while (_InterlockedCompareExchange64(p, sum, current) != current);
|
|
248
|
+
return current;
|
|
249
|
+
#endif
|
|
250
|
+
}
|
|
251
|
+
static inline void mi_atomic_maxi64_relaxed(volatile _Atomic(int64_t)*p, int64_t x) {
|
|
252
|
+
int64_t current;
|
|
253
|
+
do {
|
|
254
|
+
current = *p;
|
|
255
|
+
} while (current < x && _InterlockedCompareExchange64(p, x, current) != current);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static inline void mi_atomic_addi64_acq_rel(volatile _Atomic(int64_t*)p, int64_t i) {
|
|
259
|
+
mi_atomic_addi64_relaxed(p, i);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
static inline bool mi_atomic_casi64_strong_acq_rel(volatile _Atomic(int64_t*)p, int64_t* exp, int64_t des) {
|
|
263
|
+
int64_t read = _InterlockedCompareExchange64(p, des, *exp);
|
|
264
|
+
if (read == *exp) {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
*exp = read;
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// The pointer macros cast to `uintptr_t`.
|
|
274
|
+
#define mi_atomic_load_ptr_acquire(tp,p) (tp*)mi_atomic_load_acquire((_Atomic(uintptr_t)*)(p))
|
|
275
|
+
#define mi_atomic_load_ptr_relaxed(tp,p) (tp*)mi_atomic_load_relaxed((_Atomic(uintptr_t)*)(p))
|
|
276
|
+
#define mi_atomic_store_ptr_release(tp,p,x) mi_atomic_store_release((_Atomic(uintptr_t)*)(p),(uintptr_t)(x))
|
|
277
|
+
#define mi_atomic_store_ptr_relaxed(tp,p,x) mi_atomic_store_relaxed((_Atomic(uintptr_t)*)(p),(uintptr_t)(x))
|
|
278
|
+
#define mi_atomic_cas_ptr_weak_release(tp,p,exp,des) mi_atomic_cas_weak_release((_Atomic(uintptr_t)*)(p),(uintptr_t*)exp,(uintptr_t)des)
|
|
279
|
+
#define mi_atomic_cas_ptr_weak_acq_rel(tp,p,exp,des) mi_atomic_cas_weak_acq_rel((_Atomic(uintptr_t)*)(p),(uintptr_t*)exp,(uintptr_t)des)
|
|
280
|
+
#define mi_atomic_cas_ptr_strong_release(tp,p,exp,des) mi_atomic_cas_strong_release((_Atomic(uintptr_t)*)(p),(uintptr_t*)exp,(uintptr_t)des)
|
|
281
|
+
#define mi_atomic_exchange_ptr_release(tp,p,x) (tp*)mi_atomic_exchange_release((_Atomic(uintptr_t)*)(p),(uintptr_t)x)
|
|
282
|
+
#define mi_atomic_exchange_ptr_acq_rel(tp,p,x) (tp*)mi_atomic_exchange_acq_rel((_Atomic(uintptr_t)*)(p),(uintptr_t)x)
|
|
283
|
+
|
|
284
|
+
#define mi_atomic_loadi64_acquire(p) mi_atomic(loadi64_explicit)(p,mi_memory_order(acquire))
|
|
285
|
+
#define mi_atomic_loadi64_relaxed(p) mi_atomic(loadi64_explicit)(p,mi_memory_order(relaxed))
|
|
286
|
+
#define mi_atomic_storei64_release(p,x) mi_atomic(storei64_explicit)(p,x,mi_memory_order(release))
|
|
287
|
+
#define mi_atomic_storei64_relaxed(p,x) mi_atomic(storei64_explicit)(p,x,mi_memory_order(relaxed))
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
#endif
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
// Atomically add a signed value; returns the previous value.
|
|
294
|
+
static inline intptr_t mi_atomic_addi(_Atomic(intptr_t)*p, intptr_t add) {
|
|
295
|
+
return (intptr_t)mi_atomic_add_acq_rel((_Atomic(uintptr_t)*)p, (uintptr_t)add);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Atomically subtract a signed value; returns the previous value.
|
|
299
|
+
static inline intptr_t mi_atomic_subi(_Atomic(intptr_t)*p, intptr_t sub) {
|
|
300
|
+
return (intptr_t)mi_atomic_addi(p, -sub);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
typedef _Atomic(uintptr_t) mi_atomic_once_t;
|
|
304
|
+
|
|
305
|
+
// Returns true only on the first invocation
|
|
306
|
+
static inline bool mi_atomic_once( mi_atomic_once_t* once ) {
|
|
307
|
+
if (mi_atomic_load_relaxed(once) != 0) return false; // quick test
|
|
308
|
+
uintptr_t expected = 0;
|
|
309
|
+
return mi_atomic_cas_strong_acq_rel(once, &expected, (uintptr_t)1); // try to set to 1
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
typedef _Atomic(uintptr_t) mi_atomic_guard_t;
|
|
313
|
+
|
|
314
|
+
// Allows only one thread to execute at a time
|
|
315
|
+
#define mi_atomic_guard(guard) \
|
|
316
|
+
uintptr_t _mi_guard_expected = 0; \
|
|
317
|
+
for(bool _mi_guard_once = true; \
|
|
318
|
+
_mi_guard_once && mi_atomic_cas_strong_acq_rel(guard,&_mi_guard_expected,(uintptr_t)1); \
|
|
319
|
+
(mi_atomic_store_release(guard,(uintptr_t)0), _mi_guard_once = false) )
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
// Yield
|
|
324
|
+
#if defined(__cplusplus)
|
|
325
|
+
#include <thread>
|
|
326
|
+
static inline void mi_atomic_yield(void) {
|
|
327
|
+
std::this_thread::yield();
|
|
328
|
+
}
|
|
329
|
+
#elif defined(_WIN32)
|
|
330
|
+
#define WIN32_LEAN_AND_MEAN
|
|
331
|
+
#include <windows.h>
|
|
332
|
+
static inline void mi_atomic_yield(void) {
|
|
333
|
+
YieldProcessor();
|
|
334
|
+
}
|
|
335
|
+
#elif defined(__SSE2__)
|
|
336
|
+
#include <emmintrin.h>
|
|
337
|
+
static inline void mi_atomic_yield(void) {
|
|
338
|
+
_mm_pause();
|
|
339
|
+
}
|
|
340
|
+
#elif (defined(__GNUC__) || defined(__clang__)) && \
|
|
341
|
+
(defined(__x86_64__) || defined(__i386__) || \
|
|
342
|
+
defined(__aarch64__) || defined(__arm__) || \
|
|
343
|
+
defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(__POWERPC__))
|
|
344
|
+
#if defined(__x86_64__) || defined(__i386__)
|
|
345
|
+
static inline void mi_atomic_yield(void) {
|
|
346
|
+
__asm__ volatile ("pause" ::: "memory");
|
|
347
|
+
}
|
|
348
|
+
#elif defined(__aarch64__)
|
|
349
|
+
static inline void mi_atomic_yield(void) {
|
|
350
|
+
__asm__ volatile("wfe");
|
|
351
|
+
}
|
|
352
|
+
#elif defined(__arm__)
|
|
353
|
+
#if __ARM_ARCH >= 7
|
|
354
|
+
static inline void mi_atomic_yield(void) {
|
|
355
|
+
__asm__ volatile("yield" ::: "memory");
|
|
356
|
+
}
|
|
357
|
+
#else
|
|
358
|
+
static inline void mi_atomic_yield(void) {
|
|
359
|
+
__asm__ volatile ("nop" ::: "memory");
|
|
360
|
+
}
|
|
361
|
+
#endif
|
|
362
|
+
#elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(__POWERPC__)
|
|
363
|
+
#ifdef __APPLE__
|
|
364
|
+
static inline void mi_atomic_yield(void) {
|
|
365
|
+
__asm__ volatile ("or r27,r27,r27" ::: "memory");
|
|
366
|
+
}
|
|
367
|
+
#else
|
|
368
|
+
static inline void mi_atomic_yield(void) {
|
|
369
|
+
__asm__ __volatile__ ("or 27,27,27" ::: "memory");
|
|
370
|
+
}
|
|
371
|
+
#endif
|
|
372
|
+
#endif
|
|
373
|
+
#elif defined(__sun)
|
|
374
|
+
// Fallback for other archs
|
|
375
|
+
#include <synch.h>
|
|
376
|
+
static inline void mi_atomic_yield(void) {
|
|
377
|
+
smt_pause();
|
|
378
|
+
}
|
|
379
|
+
#elif defined(__wasi__)
|
|
380
|
+
#include <sched.h>
|
|
381
|
+
static inline void mi_atomic_yield(void) {
|
|
382
|
+
sched_yield();
|
|
383
|
+
}
|
|
384
|
+
#else
|
|
385
|
+
#include <unistd.h>
|
|
386
|
+
static inline void mi_atomic_yield(void) {
|
|
387
|
+
sleep(0);
|
|
388
|
+
}
|
|
389
|
+
#endif
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
#endif // __MIMALLOC_ATOMIC_H
|