|
|
Log in / Subscribe / Register

Improved code generation in the CPython JIT

Improved code generation in the CPython JIT

Posted Jan 19, 2024 12:14 UTC (Fri) by vstinner (subscriber, #42675)
In reply to: Improved code generation in the CPython JIT by qys
Parent article: Improved code generation in the CPython JIT

> I wonder how would JIT affect debuggability.

It depends on what you mean by "debuggability". PEP 669 "Low Impact Monitoring for CPython" is a new API added to Python 3.12 to debug Python code with a low overhead. The idea is to use a different bytecode if code is being run in a debugger. The advantage is to avoid having to check if a debugger/profiler is being used before each instruction. For example, code coverage is faster with this new API.

PEP 669: https://peps.python.org/pep-0669/

By the way, the implementation of the copy-and-patch "JIT compiler" uses machine code generated by LLVM with tail call optimization :-) It just makes the implementation easier (to generate machine code ahead with LLVM.)


to post comments

Improved code generation in the CPython JIT

Posted Jan 20, 2024 17:01 UTC (Sat) by gray_-_wolf (subscriber, #131074) [Link] (1 responses)

> The idea is to use a different bytecode if code is being run in a debugger.

I wonder if this will lead to fun bugs only manifesting when not debugging.

Improved code generation in the CPython JIT

Posted Jan 21, 2024 1:02 UTC (Sun) by khim (subscriber, #9252) [Link]

100% guaranteed. But then these bugs wouldn't be bugs in your program, but bugs in JIT-compiler.

That means that Joe Average would maybe see them once in a lifetime, but there would some some people who would deal with them routinely, because it's their job.

Not any different from Java JIT, or C# JIT or any other advanced JIT.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds