Skip to content

Conversation

@cocolato
Copy link
Contributor

@cocolato cocolato commented Jan 17, 2026

Now we can get more debug info when set PYTHON_OPT_DEBUG > 4:

test_code:

def foo():
    total = 0
    for i in range(4002):
        total = total + i
    return total

foo()

Run PYTHON_OPT_DEBUG=5 ./python test.py

will get output:
debug.log

@Fidget-Spinner Fidget-Spinner changed the title gh-143946: Show _JitSymType on abstract stack when set PYTHON_OPT_DEBUG > 4 gh-143946: Show JitOptSymbol on abstract stack when set PYTHON_OPT_DEBUG > 4 Jan 17, 2026
@Fidget-Spinner
Copy link
Member

I think we also need to add an invalid tag to the JIT ref tags. Otherwise, this might crash when we push an abstract frame onto the stack. The abstract frame should be marked as invalid.

@cocolato
Copy link
Contributor Author

updated!

@Fidget-Spinner
Copy link
Member

Fidget-Spinner commented Jan 17, 2026

Sorry that's the wrong tag, it should the tag in pycore_optimizer.h. E.g. #define REF_IS_BORROWED 1 is one of them. I think the invalid tag should follow pycore_stackref.h's number

@cocolato
Copy link
Contributor Author

I think we also need to add an invalid tag to the JIT ref tags. Otherwise, this might crash when we push an abstract frame onto the stack. The abstract frame should be marked as invalid.

Sorry about that, I've just figured out the bitwise operations here.

Copy link
Member

@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@Fidget-Spinner Fidget-Spinner merged commit 61ec66a into python:main Jan 17, 2026
67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants