8000 Drop test for tracing and inline coroutine creation by markshannon · Pull Request #16 · pablogsal/cpython · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@markshannon
Copy link

I've not attempted cleanup of the reference counting yet due to existing leaks.
These two commits are clean up before doing that.

The simple_cframe branch leaks references.
Do you need to merge in main to get python#28493?

My plan is:

  1. make_coro steal its argument's references.
  2. All callers to anything that can steal refs passes 1 to steal args
  3. Remove steal parameter
  4. Push error cleanup downward, so callers never have to clean up.

@pablogsal
Copy link
Owner

The simple_cframe branch leaks references.
Do you need to merge in main to get python#28493?

Hummm, I thought I already rebased to pick that. What are you running to check for refleaks? I checked and we were not leaking anything before :S

@pablogsal
Copy link
Owner

Ah, yes, we need to pick up the changes in master. I will merge master into the PR to pick up the refleak fixes.

@pablogsal
Copy link
Owner

Done in commit 832bccf

PyCodeObject *code = (PyCodeObject*)PyFunction_GET_CODE(function);
int is_coro = code->co_flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR);
inline_call = (is_coro || cframe.use_tracing) ? 0 : 1;
STACK_SHRINK(oparg + 1);
Copy link
Owner

Choose a reason for hiding this comment

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

I am fine with this but I find this a bit more difficult to read than the previous code. This has two conditionals nested and is not immediately clear what's the unoptimized path

Copy link
Author

Choose a reason for hiding this comment

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

I don't think there is an optimized or unoptimized path here. The specialized versions can worry about fast paths.

Python/ceval.c Outdated
PUSH(res);
if (res == NULL) {
goto error;
}
Copy link
Owner

Choose a reason for hiding this comment

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

The control flow here is quite confusing. This is falling over to the DISPATH() outside the conditional, which is quite far from here.

What's the advantage of doing this here? Is this because you plan to also inline coroutines?

Copy link
Author

Choose a reason for hiding this comment

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

This PR already inlines coroutine creation. I've moved the code around a bit to make it clearer.

@pablogsal
Copy link
Owner

I left two things but we can merge this, I think it makes sense but I would like more insight into what you want to do here, to not scope creep this PR a lot

@pablogsal pablogsal merged commit 919b741 into pablogsal:simple_cframe Sep 23, 2021
@pablogsal
Copy link
Owner

Thanks for the PR @markshannon !

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0