GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-87092: move assembler related code from compile.c to assemble.c by iritkatriel · Pull Request #103277 · python/cpython

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Apr 5, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Split compiler into code-gen, optimizer and assembler. #87092

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iritkatriel added 4 commits April 1, 2023 23:51
@iritkatriel
resolve_line_numbers as part of cfg-opt
d01b033
@iritkatriel
remove unnecessary comment
1abb2c4
@iritkatriel
split _PyCompile_CodeUnitMetadata out of compiler_unit
5d8b1c0
@iritkatriel
add assemble.c
3e0e84f
@iritkatriel
iritkatriel requested review from a team and markshannon as code owners April 5, 2023 14:05
@bedevere-bot bedevere-bot added the awaiting core review label Apr 5, 2023
@bedevere-bot bedevere-bot mentioned this pull request Apr 5, 2023
Split compiler into code-gen, optimizer and assembler. #87092
Closed
@iritkatriel
Merge branch 'main' into cfg
cb6afda
@iritkatriel iritkatriel added the skip news label Apr 5, 2023
iritkatriel
iritkatriel commented Apr 5, 2023
View reviewed changes
Comment thread Include/internal/pycore_flowgraph.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@iritkatriel
typo
cff3d58
markshannon
markshannon reviewed Apr 5, 2023
View reviewed changes

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Seems reasonable from a fairly quick scan.

There is no change in capability or optimizations, this is just a refactor. Correct?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/compile.c Outdated
static int cfg_to_instr_sequence(cfg_builder *g, instr_sequence *seq);

static PyCodeObject *
assemble_code_unit(struct compiler_unit *u, PyObject *const_cache,

@markshannon markshannon Apr 5, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Is this name still correct? Was it ever?

It seems to do optimization and assembly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@iritkatriel iritkatriel Apr 5, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

There used to be just assemble(C) which takes the compiler and and does all the optimization and assembly. I split out assemble_code_unit (which takes just the c->u and not the whole c) and does most of what used to be in assemble(). So the name was always incorrect (assemble() called the optimizer). I think the reason it was done like this is that assemble() gets called from a number of places in the compiler (lambda, class, module, etc). So it was convenient to have one function that does opt+assemble and returns a code object.

We can rename assemble() and assemble_code_unit(). Any suggestions what to call it? something like instr_sequence_to_code_object()?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
iritkatriel and others added 4 commits April 10, 2023 21:10
@iritkatriel
Merge branch 'main' into cfg
4c128fe
@iritkatriel
assemble --> assemble_and_optimize. Update comment at top of file
d0b8bc2
@iritkatriel
update comment
1aa506b
@iritkatriel
Merge branch 'main' into cfg
c931648
@markshannon
markshannon self-requested a review April 11, 2023 10:13
markshannon
markshannon approved these changes Apr 11, 2023
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Apr 11, 2023
@iritkatriel
iritkatriel merged commit 33822d0 into python:main Apr 11, 2023
@bedevere-bot bedevere-bot removed the awaiting merge label Apr 11, 2023
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
@iritkatriel @warsaw
pythongh-87092: move assembler related code from compile.c to assembl…
4e7b78e
…e.c (python#103277)
aisk pushed a commit to aisk/cpython that referenced this pull request Apr 18, 2023
@iritkatriel @aisk
pythongh-87092: move assembler related code from compile.c to assembl…
318581e
…e.c (python#103277)
@arhadthedev arhadthedev mentioned this pull request Apr 25, 2023
GH-93964: Harden overflow checks before _PyBytes_Resize in compile.c #94044
Closed
iritkatriel added a commit to iritkatriel/cpython that referenced this pull request Jun 2, 2023
@iritkatriel
pythongh-103277: remove unused macros
e1099ae
iritkatriel added a commit that referenced this pull request Jun 3, 2023
@iritkatriel
gh-103277: remove unused macros (#105247)
94a1eea
@iritkatriel
iritkatriel deleted the cfg branch July 25, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon markshannon approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@iritkatriel @markshannon @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.