8000 GH-106360: Support very basic superblock introspection by markshannon · Pull Request #106422 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-106360: Support very basic superblock introspection #106422

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
8000
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove str() support from uop superblocks. Leave that to the client.
  • Loading branch information
markshannon committed Jul 4, 2023
commit 4f38063fbfdd48c86744953cc7ed243c12aec66f
36 changes: 0 additions & 36 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,41 +317,6 @@ uop_name(int index) {
return _PyOpcode_uop_name[index];
}

static PyObject *
uop_str(_PyUOpExecutorObject *self)
{
int count = 1;
for (; count < _Py_UOP_MAX_TRACE_LENGTH; count++) {
if (self->trace[count-1].opcode == EXIT_TRACE) {
break;
}
}
_PyUnicodeWriter writer;
_PyUnicodeWriter_Init(&writer);
for (int i = 0; i < count; i++) {
const char *name = uop_name(self->trace[i].opcode);
if (_PyUnicodeWriter_WriteASCIIString(&writer,
name, strlen(name)) < 0) {
goto error;
}
if (_PyUnicodeWriter_WriteASCIIString(&writer, ", ", 2) < 0) {
goto error;
}
char operand_buffer[24];
int len = snprintf(operand_buffer, 23, "%lu", self->trace[i].operand);
if (_PyUnicodeWriter_WriteASCIIString(&writer, operand_buffer, len) < 0) {
goto error;
}
if (_PyUnicodeWriter_WriteASCIIString(&writer, "\n", 1) < 0) {
goto error;
}
}
return _PyUnicodeWriter_Finish(&writer);
error:
_PyUnicodeWriter_Dealloc(&writer);
return NULL;
}

static Py_ssize_t
uop_len(_PyUOpExecutorObject *self)
{
Expand Down Expand Up @@ -403,7 +368,6 @@ static PyTypeObject UOpExecutor_Type = {
.tp_itemsize = 0,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,
.tp_dealloc = (destructor)uop_dealloc,
.tp_str = (reprfunc)uop_str,
.tp_as_sequence = &uop_as_sequence,
};

Expand Down
0