Skip to content

GH-99554: Pack location tables more effectively #99556

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 7 commits into from
Dec 22, 2022
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.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Catch up with main
  • Loading branch information
brandtbucher committed Dec 15, 2022
commit be7eb0af8c34b9c6da666f52bd6e1d6315a41716
16 changes: 8 additions & 8 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7783,7 +7783,7 @@ write_location_info_entry(struct assembler* a, location loc, int isize)
if (loc.end_lineno == loc.lineno || loc.end_lineno == -1) {
write_location_info_no_column(a, isize, line_delta);
a->a_lineno = loc.lineno;
return 1;
return 0;
}
}
else if (loc.end_lineno == loc.lineno) {
Expand All @@ -7794,23 +7794,23 @@ write_location_info_entry(struct assembler* a, location loc, int isize)
if (line_delta >= 0 && line_delta < 3 && column < 128 && end_column < 128) {
write_location_info_oneline_form(a, isize, line_delta, column, end_column);
a->a_lineno = loc.lineno;
return 1;
return 0;
}
}
write_location_info_long_form(a, loc, isize);
a->a_lineno = loc.lineno;
return 1;
return 0;
}

static int
assemble_emit_location(struct assembler* a, location loc, int isize)
{
if (isize == 0) {
return 1;
return 0;
}
while (isize > 8) {
if (!write_location_info_entry(a, loc, 8)) {
return 0;
if (write_location_info_entry(a, loc, 8)) {
return -1;
}
isize -= 8;
}
Expand Down Expand Up @@ -8879,7 +8879,7 @@ assemble(struct compiler *c, int addNone)
for (basicblock *b = g->g_entryblock; b != NULL; b = b->b_next) {
for (int j = 0; j < b->b_iused; j++) {
if (!same_location(loc, b->b_instr[j].i_loc)) {
if (!assemble_emit_location(&a, loc, size)) {
if (assemble_emit_location(&a, loc, size)) {
goto error;
}
loc = b->b_instr[j].i_loc;
Expand All @@ -8888,7 +8888,7 @@ assemble(struct compiler *c, int addNone)
size += instr_size(&b->b_instr[j]);
}
}
if (!assemble_emit_location(&a, loc, size)) {
if (assemble_emit_location(&a, loc, size)) {
goto error;
}

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.