Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-117680: make _PyInstructionSequence a PyObject and use it in tests#117629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@iritkatriel
Copy link
Member

@iritkatrieliritkatriel commentedApr 8, 2024
edited by bedevere-appbot
Loading

@markshannonmarkshannon changed the titleMake InsturctionSequence a PyObject. Simplify testsMake InstructionSequence a PyObject. Simplify testsApr 8, 2024
@iritkatrieliritkatriel changed the titleMake InstructionSequence a PyObject. Simplify testsgh-117680: make InstructionSequence a PyObject and use it in testsApr 9, 2024
@iritkatrieliritkatriel changed the titlegh-117680: make InstructionSequence a PyObject and use it in testsgh-117680: make _PyInstructionSequence a PyObject and use it in testsApr 9, 2024
@iritkatrieliritkatriel marked this pull request as ready for reviewApril 9, 2024 16:17
iritkatrieland others added3 commitsApril 10, 2024 13:06
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Copy link
Member

@markshannonmarkshannon left a comment

Choose a reason for hiding this comment

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

Overall, this looks like a nice improvement, both in terms of separation of compiler passes and in debugability and introspection.

What is the purpose of the nested instruction sequences?
AFAICT they are only used in the tests.

Co-authored-by: Mark Shannon <mark@hotpy.org>
@iritkatriel
Copy link
MemberAuthor

What is the purpose of the nested instruction sequences?

For tests, and also if you want to display (dis-like) the codegen output, then you need the nested instructions. Otherwise for a function you only get the top level function definition, not its body. And then again for nested functions.

@iritkatriel
Copy link
MemberAuthor

iritkatriel commentedApr 17, 2024
edited
Loading

What is the purpose of the nested instruction sequences?

For tests, and also if you want to display (dis-like) the codegen output, then you need the nested instructions. Otherwise for a function you only get the top level function definition, not its body. And then again for nested functions.

I have another PR coming where codegen populates the nested instruction sequences (optional - not happening in regular compilation).

@markshannon
Copy link
Member

For tests, and also if you want to display (dis-like) the codegen output, then you need the nested instructions.

I have another PR coming where codegen populates the nested instruction sequences (optional - not happening in regular compilation).

I'm a bit wary of tests that diverge from the things they are testing.

Would it make sense to create the nested sequences in the normal compiler and generated nested code objected directly from nested sequences in the assembler?

@iritkatriel
Copy link
MemberAuthor

I'm a bit wary of tests that diverge from the things they are testing.

That's not what happens. The test is testing codegen output, and the test mode simply saves the nested sequences, whereas in normal compilation those sequences are discarded as soon as the codeobject is created. Nothing else is changing in test mode. The code objects are created in the same way.

Anyway, it's not in the PR so we can look at it in the next PR.

Would it make sense to create the nested sequences in the normal compiler and generated nested code objected directly from nested sequences in the assembler?

There are two issues with this. First, I am concerned it could consume more memory during normal compilation (for no benefit).

Second, the code object creation currently happens with a certain "compiler unit state". If we delay it to the end, the compiler unit is in a different state (or gone altogether). So we need to make sure we capture enough of this state for later. It's not a trivial change (and again, there doesn't seem to be any concrete benefit).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mdboommdboommdboom left review comments

@erlend-aaslanderlend-aaslanderlend-aasland left review comments

@markshannonmarkshannonmarkshannon approved these changes

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@iritkatriel@markshannon@mdboom@erlend-aasland

[8]ページ先頭

©2009-2025 Movatter.jp