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

Appearance settings

BINARY_OP_SUBSCR_GETITEM constituent uops are invalid #140277

Copy link
Copy link
@Fidget-Spinner

Description

@Fidget-Spinner
Issue body actions

Bug report

Bug description:

The current JIT doesn't expose this bug as it doesn't project calls through BINARY_OP_SUBSCR_GETITEM. However, the problem is that the uop puts 3 things on the stack:

op(_BINARY_OP_SUBSCR_CHECK_FUNC, (container, unused -- container, unused, getitem)) {

However, BINARY_OP is only expected to have at most 2 items on the stack.

On my branch with recording the BINARY_OP_CHECK_FUNC, this causes a segfault due to stack overflow.

We should really re-add the code that calculates the maximum stack size from constituent uops. This is also blocking work on decref elimination in the JIT.

Example repro on my branch with trace recording:

class Get:
    def __getitem__(self, i):
        return i


g = Get()
def foo():
    for _ in range(4099):
        g[1]

foo()

@mpage (as author of the original PR to sum up uop stack effect) @markshannon

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-JITtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.