├── Pyjion ├── jitinit.cpp ├── jitinit.h ├── util.h ├── taggedptr.h ├── pyjit.h ├── cowvector.h ├── codemodel.h ├── Pyjion.vcxproj ├── intrins.h ├── absvalue.h ├── cee.h └── ilgen.h ├── Tests ├── testing_util.h ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── Tests.cpp ├── Tests.vcxproj.filters ├── ReadMe.txt ├── testing_util.cpp ├── test_emission.cpp ├── Tests.vcxproj └── python_tests.txt ├── DebugBuild.bat ├── .gitignore ├── Docs ├── source │ ├── using.rst │ ├── gettingstarted.rst │ ├── index.rst │ ├── building.rst │ └── conf.py ├── make.bat └── Makefile ├── .gitmodules ├── BuildDebugPython.bat ├── Patches └── CoreCLR │ ├── src │ ├── utilcode │ │ ├── CMakeLists.txt │ │ ├── util.cpp │ │ └── longfilepathwrappers.cpp │ ├── inc │ │ └── utilcode.h │ └── CMakeLists.txt │ ├── build.cmd │ ├── clr.desktop.props │ ├── CMakeLists.txt │ ├── clr.defines.targets │ ├── DiffCoreCLR.bat │ └── clr.coreclr.props ├── Perf ├── 2016-03-31_4580f9497fc4cbb8e76e37c604914a1e1c0f898c.csv ├── 2016-02-24__e5e656e055d3c57477b1fc20c4d7ac257705fa92.csv ├── 2016-05-13_0360898ed9bb2eccc9c055d2584afe677caa5646.csv ├── 2016-04-06_e5dcea10ca535db3d91176ec35567d97852bf247.csv └── 2016-04-05_958da51c68cdaaaefa71c7b4eb319d30f3ddcadd.csv ├── .gitattributes ├── PatchDeps.sh ├── CopyFiles.bat ├── PatchDeps.bat ├── LICENSE.md ├── Test ├── stdafx.cpp ├── targetver.h ├── ReadMe.txt ├── stdafx.h └── Test.vcxproj ├── BuildDeps.cmd ├── CONTRIBUTING.md ├── .github └── workflows │ └── master.yml ├── CODE_OF_CONDUCT.md ├── Pyjion.sln ├── README.md └── Tools └── absvalue.py /Pyjion/jitinit.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tests/testing_util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef TESTING_UTIL_H 4 | #define TESTING_UTIL_H 1 5 | 6 | #include 7 | 8 | PyCodeObject* CompileCode(const char*); 9 | 10 | #endif // !TESTING_UTIL_H 11 | -------------------------------------------------------------------------------- /DebugBuild.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Building Pyjion ... 3 | MSBuild.exe .\Pyjion.sln /p:Configuration=Debug;Platform=x64 /m 4 | 5 | echo Copying x64\Debug\pyjit.dll to add the JIT to Python ... 6 | copy x64\Debug\pyjit.dll Python\PCbuild\amd64 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Docs/build/ 2 | /Libs/ 3 | /Pyjion/Pyjion.vcxproj.user 4 | /Pyjion/x64/ 5 | /Test/x64/ 6 | /Tests/x64/ 7 | /Tools/*.h 8 | /Tools/*.cpp 9 | /ipch/ 10 | /x64/ 11 | /.vs/ 12 | *.opensdf 13 | *.sdf 14 | *.opendb 15 | *.VC.db 16 | -------------------------------------------------------------------------------- /Docs/source/using.rst: -------------------------------------------------------------------------------- 1 | Using Pyjion 2 | ============ 3 | 4 | The Pyjion build process creates a build of the Python 3.5.1 distribution with the JIT module of CoreCLR loaded. 5 | 6 | You can enter the Python CLI or run Python directly once the build has been completed by calling ``Python\python.bat`` 7 | 8 | -------------------------------------------------------------------------------- /Tests/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // Tests.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Python"] 2 | path = Python 3 | url = https://github.com/python/cpython.git 4 | [submodule "CoreCLR"] 5 | path = CoreCLR 6 | url = https://github.com/dotnet/coreclr.git 7 | branch = release/1.0.0-rc2 8 | [submodule "Tests/Catch"] 9 | path = Tests/Catch 10 | url = https://github.com/philsquared/Catch.git 11 | -------------------------------------------------------------------------------- /Tests/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /BuildDebugPython.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo Building CPython in debug mode for x64 ... 4 | pushd Python\PCBuild 5 | 6 | call get_externals.bat 7 | call .\build.bat -c Debug -p x64 8 | 9 | echo Copying .lib and .dll files to appropriate places ... 10 | copy amd64\python35_d.lib ..\..\Libs\Debug\x64\ 11 | copy amd64\python35_d.dll ..\..\x64\Debug 12 | 13 | popd -------------------------------------------------------------------------------- /Tests/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | 14 | 15 | // TODO: reference additional headers your program requires here 16 | -------------------------------------------------------------------------------- /Patches/CoreCLR/src/utilcode/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | diff --git a/src/utilcode/CMakeLists.txt b/src/utilcode/CMakeLists.txt 2 | index 9d35a7e..02d878a 100644 3 | --- a/src/utilcode/CMakeLists.txt 4 | +++ b/src/utilcode/CMakeLists.txt 5 | @@ -134,4 +134,4 @@ endif(CLR_CMAKE_PLATFORM_UNIX) 6 | add_subdirectory(dac) 7 | add_subdirectory(dyncrt) 8 | add_subdirectory(staticnohost) 9 | -add_subdirectory(crossgen) 10 | + 11 | -------------------------------------------------------------------------------- /Patches/CoreCLR/src/inc/utilcode.h: -------------------------------------------------------------------------------- 1 | diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h 2 | index b9985a8..cade9e5 100644 3 | --- a/src/inc/utilcode.h 4 | +++ b/src/inc/utilcode.h 5 | @@ -8,6 +8,8 @@ 6 | // 7 | //***************************************************************************** 8 | 9 | +#define SetErrorInfo __DoNotUseSetErrorInfo 10 | + 11 | #ifndef __UtilCode_h__ 12 | #define __UtilCode_h__ 13 | 14 | -------------------------------------------------------------------------------- /Perf/2016-03-31_4580f9497fc4cbb8e76e37c604914a1e1c0f898c.csv: -------------------------------------------------------------------------------- 1 | Benchmark,Base,Changed 2 | 2to3,5.560410,5.580026 3 | chameleon_v2,3.911691,4.076780 4 | django_v3,0.385458,0.383078 5 | fastpickle,0.372616,0.369181 6 | fastunpickle,0.498875,0.487035 7 | json_dump_v2,2.158455,2.176631 8 | json_load,0.349240,0.357310 9 | nbody,0.233559,0.242705 10 | regex_v8,0.039063,0.039166 11 | tornado_http,0.418463,0.418276 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | *.diff text eol=lf 4 | /Patches/** eol=lf 5 | 6 | # Custom for Visual Studio 7 | *.cs diff=csharp 8 | 9 | # Standard to msysgit 10 | *.doc diff=astextplain 11 | *.DOC diff=astextplain 12 | *.docx diff=astextplain 13 | *.DOCX diff=astextplain 14 | *.dot diff=astextplain 15 | *.DOT diff=astextplain 16 | *.pdf diff=astextplain 17 | *.PDF diff=astextplain 18 | *.rtf diff=astextplain 19 | *.RTF diff=astextplain 20 | -------------------------------------------------------------------------------- /PatchDeps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo Patching CoreCLR.... 3 | pushd CoreCLR 4 | git apply ../Patches/CoreCLR/src/inc/utilcode.h 5 | git apply ../Patches/CoreCLR/src/utilcode/CMakeLists.txt 6 | git apply ../Patches/CoreCLR/src/utilcode/util.cpp 7 | git apply ../Patches/CoreCLR/src/CMakeLists.txt 8 | git apply ../Patches/CoreCLR/build.cmd 9 | git apply ../Patches/CoreCLR/clr.coreclr.props 10 | git apply ../Patches/CoreCLR/clr.defines.targets 11 | git apply ../Patches/CoreCLR/clr.desktop.props 12 | git apply ../Patches/CoreCLR/CMakeLists.txt 13 | popd 14 | -------------------------------------------------------------------------------- /Patches/CoreCLR/build.cmd: -------------------------------------------------------------------------------- 1 | diff --git a/build.cmd b/build.cmd 2 | index 82fa0a5..2f4f0d8 100644 3 | --- a/build.cmd 4 | +++ b/build.cmd 5 | @@ -338,7 +338,7 @@ set __msbuildLogArgs=^ 6 | /consoleloggerparameters:Summary ^ 7 | /verbosity:minimal 8 | 9 | -set __msbuildArgs="%__IntermediatesDir%\install.vcxproj" %__msbuildCommonArgs% %__msbuildLogArgs% /p:Configuration=%__BuildType% 10 | +set __msbuildArgs="%__IntermediatesDir%\install.vcxproj" %__msbuildCommonArgs% %__msbuildLogArgs% /p:Configuration=%__BuildType% /p:FeatureCominterop=false 11 | 12 | if /i "%__BuildArch%" == "arm64" ( 13 | REM TODO, remove once we have msbuild support for this platform. 14 | -------------------------------------------------------------------------------- /CopyFiles.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo Copying Python/Lib for testing purposes ... 4 | mkdir x64\Debug\Lib 5 | xcopy .\Python\Lib .\x64\Debug\Lib /E 6 | 7 | echo Copying Python\PCbuild\amd64\python35_d.dll for testing purposes ... 8 | if EXIST Python\PCbuild\amd64\python36_d.dll copy Python\PCbuild\amd64\python36_d.dll x64\Debug 9 | if EXIST Python\PCbuild\amd64\python36.dll copy Python\PCbuild\amd64\python36.dll x64\Release 10 | 11 | echo Copying Pyjion to add the JIT to Python ... 12 | if EXIST x64\Release\pyjion.pyd copy x64\Release\pyjion.pyd Python\PCbuild\amd64\pyjion.pyd 13 | if EXIST x64\Debug\pyjion_d.pyd copy x64\Debug\pyjion_d.pyd Python\PCbuild\amd64\pyjion_d.pyd 14 | -------------------------------------------------------------------------------- /Pyjion/jitinit.h: -------------------------------------------------------------------------------- 1 | #ifndef JITINIT_H 2 | #define JITINIT_H 3 | 4 | 5 | #define FEATURE_NO_HOST 6 | #define USE_STL 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | CorJitInfo g_corJitInfo; 28 | ICorJitCompiler* g_jit; 29 | 30 | extern "C" __declspec(dllexport) void JitInit() 31 | 32 | #endif -------------------------------------------------------------------------------- /Patches/CoreCLR/clr.desktop.props: -------------------------------------------------------------------------------- 1 | diff --git a/clr.desktop.props b/clr.desktop.props 2 | index 88a4d9f..8c23f32 100644 3 | --- a/clr.desktop.props 4 | +++ b/clr.desktop.props 5 | @@ -19,7 +19,7 @@ 6 | true 7 | true 8 | true 9 | - true 10 | + false 11 | true 12 | true 13 | true 14 | -------------------------------------------------------------------------------- /PatchDeps.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM ######################################################## 3 | REM # Apply changes to disable COM interop support 4 | 5 | echo Disabling COM interop support in CoreCLR... 6 | pushd CoreCLR 7 | git apply ..\Patches\CoreCLR\src\inc\utilcode.h 8 | git apply ..\Patches\CoreCLR\src\utilcode\CMakeLists.txt 9 | git apply ..\Patches\CoreCLR\src\utilcode\longfilepathwrappers.cpp 10 | git apply ..\Patches\CoreCLR\src\utilcode\util.cpp 11 | git apply ..\Patches\CoreCLR\src\CMakeLists.txt 12 | git apply ..\Patches\CoreCLR\build.cmd 13 | git apply ..\Patches\CoreCLR\clr.coreclr.props 14 | git apply ..\Patches\CoreCLR\clr.defines.targets 15 | git apply ..\Patches\CoreCLR\clr.desktop.props 16 | git apply ..\Patches\CoreCLR\CMakeLists.txt 17 | popd 18 | -------------------------------------------------------------------------------- /Patches/CoreCLR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index ba328f4..2837e0a 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -762,13 +762,13 @@ add_definitions(-DFEATURE_ASYNC_IO) 6 | add_definitions(-DFEATURE_BCL_FORMATTING) 7 | add_definitions(-DFEATURE_COLLECTIBLE_TYPES) 8 | 9 | -if(WIN32) 10 | +if(FALSE) 11 | add_definitions(-DFEATURE_CLASSIC_COMINTEROP) 12 | add_definitions(-DFEATURE_COMINTEROP) 13 | add_definitions(-DFEATURE_COMINTEROP_APARTMENT_SUPPORT) 14 | add_definitions(-DFEATURE_COMINTEROP_UNMANAGED_ACTIVATION) 15 | add_definitions(-DFEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION) 16 | -endif(WIN32) 17 | +endif(FALSE) 18 | 19 | add_definitions(-DFEATURE_CORECLR) 20 | if (CLR_CMAKE_PLATFORM_UNIX) 21 | -------------------------------------------------------------------------------- /Patches/CoreCLR/src/utilcode/util.cpp: -------------------------------------------------------------------------------- 1 | diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp 2 | index f801f94..98e5e5d 100644 3 | --- a/src/utilcode/util.cpp 4 | +++ b/src/utilcode/util.cpp 5 | @@ -212,6 +212,7 @@ typedef HRESULT __stdcall DLLGETCLASSOBJECT(REFCLSID rclsid, 6 | EXTERN_C const IID _IID_IClassFactory = 7 | {0x00000001, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}}; 8 | 9 | +#if FEATURE_COMINTEROP 10 | // ---------------------------------------------------------------------------- 11 | // FakeCoCreateInstanceEx 12 | // 13 | @@ -374,6 +375,7 @@ HRESULT FakeCoCallDllGetClassObject(REFCLSID rclsid, 14 | 15 | return hr; 16 | } 17 | +#endif 18 | 19 | #if USE_UPPER_ADDRESS 20 | static BYTE * s_CodeMinAddr; // Preferred region to allocate the code in. 21 | -------------------------------------------------------------------------------- /Patches/CoreCLR/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt 2 | index 4ae4a7c..b76de27 100644 3 | --- a/src/CMakeLists.txt 4 | +++ b/src/CMakeLists.txt 5 | @@ -125,25 +125,12 @@ endif(CLR_CMAKE_PLATFORM_UNIX) 6 | 7 | add_subdirectory(utilcode) 8 | add_subdirectory(gcinfo) 9 | -add_subdirectory(coreclr) 10 | add_subdirectory(jit) 11 | -add_subdirectory(vm) 12 | -add_subdirectory(md) 13 | -add_subdirectory(debug) 14 | add_subdirectory(inc) 15 | -add_subdirectory(strongname) 16 | -add_subdirectory(binder) 17 | -add_subdirectory(classlibnative) 18 | -add_subdirectory(dlls) 19 | -add_subdirectory(ToolBox) 20 | -add_subdirectory(tools) 21 | -add_subdirectory(unwinder) 22 | -add_subdirectory(ildasm) 23 | -add_subdirectory(ilasm) 24 | 25 | -if(WIN32) 26 | +if(FALSE) 27 | add_subdirectory(ipcman) 28 | -endif(WIN32) 29 | +endif(FALSE) 30 | 31 | if(CLR_CMAKE_PLATFORM_UNIX) 32 | add_subdirectory(palrt) 33 | -------------------------------------------------------------------------------- /Patches/CoreCLR/src/utilcode/longfilepathwrappers.cpp: -------------------------------------------------------------------------------- 1 | diff --git a/src/utilcode/longfilepathwrappers.cpp b/src/utilcode/longfilepathwrappers.cpp 2 | index 2b5a8b4..54c8e09 100644 3 | --- a/src/utilcode/longfilepathwrappers.cpp 4 | +++ b/src/utilcode/longfilepathwrappers.cpp 5 | @@ -1190,10 +1190,6 @@ FindFirstFileExWrapper( 6 | 7 | #ifndef FEATURE_PAL 8 | 9 | -#if ! defined(DACCESS_COMPILE) && !defined(SELF_NO_HOST) 10 | -extern HINSTANCE g_pMSCorEE; 11 | -#endif// ! defined(DACCESS_COMPILE) && !defined(SELF_NO_HOST) 12 | - 13 | BOOL PAL_GetPALDirectoryWrapper(SString& pbuffer) 14 | { 15 | 16 | @@ -1203,10 +1199,6 @@ BOOL PAL_GetPALDirectoryWrapper(SString& pbuffer) 17 | DWORD dwPath; 18 | HINSTANCE hinst = NULL; 19 | 20 | -#if ! defined(DACCESS_COMPILE) && !defined(SELF_NO_HOST) 21 | - hinst = g_pMSCorEE; 22 | -#endif// ! defined(DACCESS_COMPILE) && !defined(SELF_NO_HOST) 23 | - 24 | #ifndef CROSSGEN_COMPILE 25 | _ASSERTE(hinst != NULL); 26 | #endif 27 | -------------------------------------------------------------------------------- /Pyjion/util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef UTIL_H 3 | #define UTIL_H 1 4 | 5 | #include 6 | 7 | /** 8 | Use RAII to Py_XDECREF a pointer. 9 | 10 | Inspired by std::unique_ptr. 11 | */ 12 | template class py_ptr { 13 | private: 14 | T* m_ptr; 15 | 16 | public: 17 | py_ptr() : m_ptr(nullptr) {} 18 | py_ptr(T* ptr) : m_ptr(ptr) {} 19 | py_ptr(const py_ptr& copy) { 20 | m_ptr = copy.get(); 21 | Py_INCREF(m_ptr); 22 | } 23 | 24 | ~py_ptr() { 25 | Py_XDECREF(m_ptr); 26 | } 27 | 28 | void reset(T* ptr) { 29 | Py_XDECREF(m_ptr); 30 | m_ptr = ptr; 31 | } 32 | 33 | T* get() { 34 | return m_ptr; 35 | } 36 | 37 | T* operator->() { 38 | return m_ptr; 39 | } 40 | 41 | T* operator*() { 42 | return m_ptr; 43 | } 44 | }; 45 | 46 | /** 47 | A concrete PyObject instance of py_ptr. 48 | */ 49 | class PyObject_ptr : public py_ptr { 50 | public: 51 | PyObject_ptr(PyObject *ptr) : py_ptr(ptr) {} 52 | }; 53 | 54 | #endif // !UTIL_H 55 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Patches/CoreCLR/clr.defines.targets: -------------------------------------------------------------------------------- 1 | diff --git a/clr.defines.targets b/clr.defines.targets 2 | index 078f572..6e04c7c 100644 3 | --- a/clr.defines.targets 4 | +++ b/clr.defines.targets 5 | @@ -18,7 +18,7 @@ 6 | $(CDefines);FEATURE_TRACELOGGING 7 | $(CDefines);FEATURE_CODEPAGES_FILE 8 | $(CDefines);FEATURE_COLLECTIBLE_TYPES 9 | - $(CDefines);FEATURE_COMINTEROP 10 | + 11 | $(CDefines);FEATURE_ICASTABLE 12 | $(CDefines);FEATURE_COMINTEROP_APARTMENT_SUPPORT 13 | $(CDefines);FEATURE_COMINTEROP_MANAGED_ACTIVATION 14 | -------------------------------------------------------------------------------- /Docs/source/gettingstarted.rst: -------------------------------------------------------------------------------- 1 | Getting Started 2 | =============== 3 | 4 | This project depends on submodules for Python, the CoreCLR project and Test/Catch 5 | 6 | To recursively clone the project use 7 | 8 | .. sourcecode:: bash 9 | 10 | git clone --recursive https://github.com/microsoft/Pyjion.git 11 | 12 | If you did not clone the repository with --recursive, you can still download submodules within git. 13 | 14 | .. sourcecode:: bash 15 | 16 | git pull --recurse-submodules 17 | 18 | Installing dependencies 19 | ----------------------- 20 | 21 | Before you build the project, you need to install dependencies and have them avaialable in your PATH. 22 | 23 | - `CMake`_ - You need CMake installed before building 24 | 25 | 26 | Building 27 | -------- 28 | 29 | Follow the :doc:`building guide ` to build the binaries to be installed into your Python distribution. 30 | 31 | 32 | Trying it out 33 | ------------- 34 | 35 | Once you have build the Python distribution with the JIT module loaded using the instructions in the :doc:`building guide ` you can simply 36 | enter the Python CLI by running ``Python\python.bat`` and start using the Python 3.5.1 distribution as you would normally. 37 | 38 | .. _`CMake`: https://cmake.org/download/ 39 | -------------------------------------------------------------------------------- /Patches/CoreCLR/DiffCoreCLR.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM ######################################################## 3 | echo Gathering changes to disable COM interop support in CoreCLR... 4 | pushd ..\..\CoreCLR 5 | git diff v1.0.0-rc2 src\inc\ex.h > ..\Patches\CoreCLR\src\inc\ex.h 6 | git diff v1.0.0-rc2 src\inc\utilcode.h > ..\Patches\CoreCLR\src\inc\utilcode.h 7 | git diff v1.0.0-rc2 src\utilcode\posterror.cpp > ..\Patches\CoreCLR\src\utilcode\posterror.cpp 8 | git diff v1.0.0-rc2 src\utilcode\util.cpp > ..\Patches\CoreCLR\src\utilcode\util.cpp 9 | git diff v1.0.0-rc2 src\utilcode\CMakeLists.txt > ..\Patches\CoreCLR\src\utilcode\CMakeLists.txt 10 | git diff v1.0.0-rc2 src\vm\clrex.cpp > ..\Patches\CoreCLR\src\vm\clrex.cpp 11 | git diff v1.0.0-rc2 src\vm\comcache.cpp > ..\Patches\CoreCLR\src\vm\comcache.cpp 12 | git diff v1.0.0-rc2 src\vm\interoputil.cpp > ..\Patches\CoreCLR\src\vm\interoputil.cpp 13 | git diff v1.0.0-rc2 src\vm\threads.cpp > ..\Patches\CoreCLR\src\vm\threads.cpp 14 | git diff v1.0.0-rc2 src\CMakeLists.txt > ..\Patches\CoreCLR\src\CMakeLists.txt 15 | git diff v1.0.0-rc2 build.cmd > ..\Patches\CoreCLR\build.cmd 16 | git diff v1.0.0-rc2 clr.coreclr.props > ..\Patches\CoreCLR\clr.coreclr.props 17 | git diff v1.0.0-rc2 clr.defines.targets > ..\Patches\CoreCLR\clr.defines.targets 18 | git diff v1.0.0-rc2 clr.desktop.props > ..\Patches\CoreCLR\clr.desktop.props 19 | git diff v1.0.0-rc2 CMakeLists.txt > ..\Patches\CoreCLR\CMakeLists.txt 20 | popd 21 | -------------------------------------------------------------------------------- /Perf/2016-02-24__e5e656e055d3c57477b1fc20c4d7ac257705fa92.csv: -------------------------------------------------------------------------------- 1 | Benchmark,Base,Changed 2 | 2to3,0.447068,2.405002 3 | call_method,0.276877,0.345693 4 | call_method_slots,0.274336,0.340792 5 | call_method_unknown,0.284908,0.384645 6 | call_simple,0.211351,0.258323 7 | chaos,0.232720,0.271953 8 | django_v3,0.379254,0.468081 9 | etree_generate,0.203659,0.230860 10 | etree_iterparse,0.322837,0.345134 11 | etree_parse,0.231545,0.230210 12 | etree_process,0.164422,0.177243 13 | fannkuch,0.964744,1.028282 14 | fastpickle,0.367285,0.390253 15 | fastunpickle,0.471698,0.514821 16 | float,0.267812,0.251983 17 | formatted_logging,0.282892,0.394385 18 | go,0.440843,0.499083 19 | json_dump_v2,2.120988,2.308846 20 | json_load,0.372920,0.372437 21 | mako_v2,0.029360,0.030558 22 | meteor_contest,0.171198,0.168209 23 | nbody,0.246009,0.214377 24 | normal_startup,0.520905,9.441582 25 | nqueens,0.188810,0.191177 26 | pathlib,0.210946,0.225119 27 | pickle_dict,0.324493,0.322630 28 | pickle_list,0.218726,0.220427 29 | pidigits,0.236649,0.236227 30 | raytrace,1.046834,1.142848 31 | regex_compile,0.260204,0.322876 32 | regex_effbot,0.045243,0.045513 33 | regex_v8,0.038070,0.038902 34 | richards,0.130934,0.138996 35 | silent_logging,0.060981,0.071124 36 | simple_logging,0.246971,0.342824 37 | spectral_norm,0.288022,0.277858 38 | startup_nosite,0.337781,6.046993 39 | telco,0.007546,0.007638 40 | tornado_http,0.414877,0.478739 41 | unpack_sequence,0.000037,0.000179 42 | unpickle_list,0.370868,0.321671 43 | -------------------------------------------------------------------------------- /Perf/2016-05-13_0360898ed9bb2eccc9c055d2584afe677caa5646.csv: -------------------------------------------------------------------------------- 1 | Benchmark,Base,Changed 2 | 2to3,12.115672,53.077635 3 | call_method,0.478239,0.440329 4 | call_method_slots,0.477080,0.437468 5 | call_method_unknown,0.496415,0.447550 6 | call_simple,0.411499,0.376116 7 | chaos,0.529725,0.508128 8 | django_v3,0.962259,1.973536 9 | etree_generate,0.555797,0.878412 10 | etree_iterparse,0.744044,2.469276 11 | etree_parse,0.481645,0.486506 12 | etree_process,0.455153,0.655453 13 | fannkuch,2.086550,2.063978 14 | fastpickle,0.835481,0.834509 15 | fastunpickle,0.998298,1.003066 16 | float,0.517170,0.478662 17 | formatted_logging,0.736918,0.756467 18 | go,0.967658,0.871361 19 | json_dump_v2,4.751998,4.826383 20 | json_load,0.764063,0.785226 21 | mako_v2,0.072189,0.073789 22 | meteor_contest,0.331122,0.306164 23 | nbody,0.456943,0.461399 24 | normal_startup,0.980611,1.041429 25 | nqueens,0.456503,5.844960 26 | pathlib,0.466209,0.505793 27 | pickle_dict,0.653900,0.650485 28 | pickle_list,0.450111,0.439026 29 | pidigits,0.417503,0.433454 30 | raytrace,2.400198,2.188586 31 | regex_compile,0.610075,0.590271 32 | regex_effbot,0.088083,0.087982 33 | regex_v8,0.076496,0.076694 34 | richards,0.279421,0.223735 35 | silent_logging,0.122719,0.111339 36 | simple_logging,0.646841,0.656252 37 | spectral_norm,0.571884,0.343651 38 | startup_nosite,0.614642,0.666916 39 | telco,0.019350,0.019310 40 | tornado_http,0.746220,0.789006 41 | unpack_sequence,0.000080,0.000081 42 | unpickle_list,0.618535,0.610952 43 | -------------------------------------------------------------------------------- /Test/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) Microsoft Corporation 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | // stdafx.cpp : source file that includes just the standard includes 27 | // Test.pch will be the pre-compiled header 28 | // stdafx.obj will contain the pre-compiled type information 29 | 30 | #include "stdafx.h" 31 | 32 | // TODO: reference any additional headers you need in STDAFX.H 33 | // and not in this file 34 | -------------------------------------------------------------------------------- /Perf/2016-04-06_e5dcea10ca535db3d91176ec35567d97852bf247.csv: -------------------------------------------------------------------------------- 1 | Benchmark,Base,Changed 2 | 2to3,12.342356,334.583629 3 | call_method,0.489932,1.018983 4 | call_method_slots,0.500812,1.014403 5 | call_method_unknown,0.499555,1.686318 6 | call_simple,0.412433,0.477337 7 | chaos,0.526826,0.638008 8 | django_v3,0.958868,7.305971 9 | etree_generate,0.531633,3.110812 10 | etree_iterparse,0.725201,12.410611 11 | etree_parse,0.469335,0.509480 12 | etree_process,0.446792,2.110003 13 | fannkuch,2.225778,2.219514 14 | fastpickle,0.789316,0.812318 15 | fastunpickle,0.970981,0.981964 16 | float,0.495348,0.586380 17 | formatted_logging,0.727788,0.745749 18 | go,0.967717,1.297788 19 | json_dump_v2,4.728246,5.931067 20 | json_load,0.741040,0.772750 21 | mako_v2,0.068379,0.075004 22 | meteor_contest,0.323812,0.373890 23 | nbody,0.480030,0.480529 24 | normal_startup,0.924916,1.038923 25 | nqueens,0.456231,40.414209 26 | pathlib,0.461617,0.477238 27 | pickle_dict,0.637668,0.639221 28 | pickle_list,0.429117,0.428214 29 | pidigits,0.409860,0.445579 30 | raytrace,2.384660,3.441256 31 | regex_compile,0.605274,0.738788 32 | regex_effbot,0.086446,0.087694 33 | regex_v8,0.076342,0.076527 34 | richards,0.283325,0.371891 35 | silent_logging,0.121146,0.190932 36 | simple_logging,0.641986,0.656115 37 | spectral_norm,0.584597,0.707676 38 | startup_nosite,0.610495,0.705637 39 | telco,0.018169,0.018002 40 | tornado_http,0.740326,0.766377 41 | unpack_sequence,0.000080,0.000080 42 | unpickle_list,0.629430,0.611556 43 | -------------------------------------------------------------------------------- /Test/targetver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) Microsoft Corporation 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #pragma once 27 | 28 | // Including SDKDDKVer.h defines the highest available Windows platform. 29 | 30 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 31 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 32 | 33 | #include 34 | -------------------------------------------------------------------------------- /Perf/2016-04-05_958da51c68cdaaaefa71c7b4eb319d30f3ddcadd.csv: -------------------------------------------------------------------------------- 1 | Benchmark,Base,Changed 2 | 2to3,12.052862,12.020834 3 | call_method,0.486167,0.478596 4 | call_method_slots,0.475225,0.480236 5 | call_method_unknown,0.493363,0.500674 6 | call_simple,0.401040,0.403647 7 | chaos,0.520773,0.519195 8 | django_v3,0.942735,0.948436 9 | etree_generate,0.524349,0.526743 10 | etree_iterparse,0.724195,0.728323 11 | etree_parse,0.478225,0.482549 12 | etree_process,0.446761,0.444048 13 | fannkuch,2.171859,2.170013 14 | fastpickle,0.797467,0.809622 15 | fastunpickle,0.981146,0.979752 16 | float,0.500310,0.506445 17 | formatted_logging,0.757906,0.726722 18 | go,0.951418,0.955328 19 | hexiom2,209.414765,209.238970 20 | json_dump_v2,4.624792,4.623114 21 | json_load,0.746176,0.743669 22 | mako_v2,0.069105,0.069859 23 | meteor_contest,0.328838,0.325806 24 | nbody,0.473619,0.469961 25 | normal_startup,0.929839,1.043941 26 | nqueens,0.448814,0.447764 27 | pathlib,0.458695,0.462290 28 | pickle_dict,0.635787,0.638163 29 | pickle_list,0.428646,0.435722 30 | pidigits,0.409386,0.409892 31 | raytrace,2.384494,2.393681 32 | regex_compile,0.591691,0.592807 33 | regex_effbot,0.086083,0.085991 34 | regex_v8,0.074170,0.074189 35 | richards,0.280354,0.280463 36 | silent_logging,0.121727,0.123696 37 | simple_logging,0.663767,0.644777 38 | spectral_norm,0.599646,0.597674 39 | startup_nosite,0.615553,0.716569 40 | telco,0.018287,0.018215 41 | tornado_http,0.733467,0.730327 42 | unpack_sequence,0.000080,0.000080 43 | unpickle_list,0.598304,0.620273 44 | -------------------------------------------------------------------------------- /Tests/Tests.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) Microsoft Corporation 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #include "stdafx.h" 27 | #include 28 | #include 29 | #define CATCH_CONFIG_RUNNER 30 | #include "catch.hpp" 31 | 32 | 33 | int main(int argc, char* const argv[]) { 34 | Py_Initialize(); 35 | JitInit(); 36 | 37 | int result = Catch::Session().run(argc, argv); 38 | 39 | Py_Finalize(); 40 | 41 | return result; 42 | } -------------------------------------------------------------------------------- /Tests/Tests.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /Test/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : Test Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Test application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your Test application. 9 | 10 | 11 | Test.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | Test.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | Test.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named Test.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /Tests/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : Tests Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Tests application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your Tests application. 9 | 10 | 11 | Tests.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | Tests.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | Tests.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named Tests.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /BuildDeps.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: 32-bit builds not supported as they have not been tested. 4 | set __BuildArch=x64 5 | set __BuildType=Debug 6 | 7 | 8 | :Arg_Loop 9 | if "%1" == "" goto ArgsDone 10 | if /i "%1" == "/?" goto Usage 11 | 12 | if /i "%1" == "Debug" (set __BuildType=Debug&shift&goto Arg_Loop) 13 | if /i "%1" == "Release" (set __BuildType=Release&shift&goto Arg_Loop) 14 | 15 | echo Invalid commandline argument: %1 16 | goto Usage 17 | 18 | :ArgsDone 19 | 20 | :BuildCoreCLR 21 | pushd coreclr 22 | call build.cmd %__BuildArch% %__BuildType% skipmscorlib skiptests 23 | IF ERRORLEVEL 1 goto Error 24 | 25 | mkdir ..\Libs\%__BuildType%\%__BuildArch%\ 26 | copy bin\obj\Windows_NT.%__BuildArch%.%__BuildType%\src\jit\dll\%__BuildType%\clrjit.lib ..\Libs\%__BuildType%\%__BuildArch%\ 27 | copy bin\obj\Windows_NT.%__BuildArch%.%__BuildType%\src\utilcode\dyncrt\%__BuildType%\utilcode.lib ..\Libs\%__BuildType%\%__BuildArch%\ 28 | copy bin\obj\Windows_NT.%__BuildArch%.%__BuildType%\src\gcinfo\lib\%__BuildType%\gcinfo.lib ..\Libs\%__BuildType%\%__BuildArch%\ 29 | popd 30 | 31 | :BuildPython 32 | :: Keep BuildDebugPython.bat in sync w/ any relevant changes made here. 33 | pushd Python\PCBuild 34 | 35 | call get_externals.bat 36 | IF ERRORLEVEL 1 goto Error 37 | call .\build.bat -c %__BuildType% -p %__BuildArch% 38 | IF ERRORLEVEL 1 goto Error 39 | 40 | if /i "%__BuildArch%" == "x64" set arch=amd64 41 | set SUFFIX= 42 | if /i "%__BuildType%" == "Debug" set SUFFIX=_d 43 | 44 | copy %arch%\python35%SUFFIX%.lib ..\..\Libs\%__BuildType%\%__BuildArch%\ 45 | popd 46 | 47 | :Done 48 | echo All built... 49 | exit /b 0 50 | 51 | :Error 52 | echo something failed to build... 53 | exit /b 1 54 | 55 | :Usage 56 | echo. 57 | echo Usage: 58 | echo %0 [BuildType] where: 59 | echo. 60 | echo BuildType can be: Debug, Release 61 | exit /b 1 62 | -------------------------------------------------------------------------------- /Docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. Pyjion documentation master file, created by 2 | sphinx-quickstart on Thu May 19 09:26:14 2016. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Pyjion 7 | ====== 8 | 9 | Pyjion is an implementation and technical proof of concept for a JIT API for CPython. 10 | 11 | Project Goals 12 | ------------- 13 | 14 | There are three goals for this project. 15 | 16 | 1. **Add a C API to CPython for plugging in a JIT** - make it so that CPython can have a JIT plugged in as desired (CPython is the Python implementation you download from https://www.python.org/). That would allow for an ecosystem of JIT implementations for Python where users can choose the JIT that works best for their use-case. And by using CPython we hope to have compatibility with all code that it can run (both Python code as well as C extension modules). 17 | 2. **Develop a JIT module using CoreCLR utilizing the C API mentioned in goal #1** - develop a JIT for CPython using the JIT provided by the CoreCLR. It's cross-platform, liberally licensed, and the original creator of Pyjion has a lot of experience with it. 18 | 3. **Develop a C++ framework that any JIT targeting the API in goal #1 can use to make development easier** - abstract out all of the common bits required to write a JIT implementation for CPython. The idea is to create a framework where JIT implementations only have to worry about JIT-specific stuff like how to do addition and not when to do addition. 19 | 20 | Follow the :doc:`Getting Started ` guide for a walkthrough of how to use this project. 21 | 22 | Documentation 23 | ============= 24 | 25 | Main 26 | ---- 27 | 28 | .. toctree:: 29 | :glob: 30 | :maxdepth: 3 31 | 32 | gettingstarted 33 | building 34 | using 35 | -------------------------------------------------------------------------------- /Test/stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) Microsoft Corporation 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | // stdafx.h : include file for standard system include files, 27 | // or project specific include files that are used frequently, but 28 | // are changed infrequently 29 | // 30 | 31 | #pragma once 32 | 33 | #include "targetver.h" 34 | 35 | #include 36 | #include 37 | 38 | #define FEATURE_NO_HOST 39 | #define USE_STL 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #include 54 | #include 55 | 56 | #include 57 | 58 | #include "pyjit.h" 59 | #include "absint.h" -------------------------------------------------------------------------------- /Tests/testing_util.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) Microsoft Corporation 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included 14 | * in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | * OTHER DEALINGS IN THE SOFTWARE. 23 | * 24 | */ 25 | 26 | /** 27 | Testing utility code. 28 | */ 29 | 30 | #include "stdafx.h" 31 | #include "catch.hpp" 32 | #include "testing_util.h" 33 | #include 34 | #include 35 | 36 | PyCodeObject* CompileCode(const char* code) { 37 | auto globals = PyObject_ptr(PyDict_New()); 38 | auto builtins = PyThreadState_GET()->interp->builtins; 39 | PyDict_SetItemString(globals.get(), "__builtins__", builtins); 40 | 41 | auto locals = PyObject_ptr(PyDict_New()); 42 | PyRun_String(code, Py_file_input, globals.get(), locals.get()); 43 | if (PyErr_Occurred()) { 44 | PyErr_Print(); 45 | FAIL("error occurred during Python compilation"); 46 | return nullptr; 47 | } 48 | auto func = PyObject_ptr(PyObject_GetItem(locals.get(), PyUnicode_FromString("f"))); 49 | auto codeObj = (PyCodeObject*)PyObject_GetAttrString(func.get(), "__code__"); 50 | 51 | return codeObj; 52 | } 53 | -------------------------------------------------------------------------------- /Patches/CoreCLR/clr.coreclr.props: -------------------------------------------------------------------------------- 1 | diff --git a/clr.coreclr.props b/clr.coreclr.props 2 | index a335486..510a296 100644 3 | --- a/clr.coreclr.props 4 | +++ b/clr.coreclr.props 5 | @@ -10,7 +10,7 @@ 6 | true 7 | true 8 | true 9 | - true 10 | + false 11 | true 12 | true 13 | true 14 | @@ -53,11 +53,11 @@ 15 | true 16 | 17 | true 18 | - true 19 | - true 20 | + false 21 | + false 22 | true 23 | - true 24 | - true 25 | + false 26 | + false 27 | true 28 | true 29 | true 30 | @@ -76,7 +76,7 @@ 31 | true 32 | true 33 | true 34 | - true 35 | + false 36 | true 37 |