Skip to content

Commit 923c35a

Browse files
committed
fix(timings): compute codegen start time to draw dep lines
This was an overlook in 1891593 that forgot to replace other `rmeta_x`.
1 parent 0b3a76f commit 923c35a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/cargo/core/compiler/timings.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Y_TICK_DIST = BOX_HEIGHT + 2;
1717
let HIT_BOXES = [];
1818
// Index into UNIT_DATA of the last unit hovered over by mouse.
1919
let LAST_HOVER = null;
20-
// Key is unit index, value is {x, y, width, rmeta_x} of the box.
20+
// Key is unit index, value is {x, y, width, sections} of the box.
2121
let UNIT_COORDS = {};
2222
// Map of unit index to the index it was unlocked by.
2323
let REVERSE_UNIT_DEPS = {};
@@ -306,16 +306,30 @@ function get_section_color(name) {
306306
}
307307
}
308308

309+
// Gets the x-coordinate of the codegen section of a unit.
310+
//
311+
// This is for drawing rmeta dependency lines.
312+
function get_codegen_section_x(sections) {
313+
const codegen_section = sections.find(s => s.name === "codegen")
314+
if (!codegen_section) {
315+
// We expect to have at least a codegen section,
316+
// so this should be unreachable in normal cases.
317+
return null;
318+
}
319+
return codegen_section.start;
320+
}
321+
309322
// Draws lines from the given unit to the units it unlocks.
310323
function draw_dep_lines(ctx, unit_idx, highlighted) {
311324
const unit = UNIT_DATA[unit_idx];
312-
const {x, y, rmeta_x} = UNIT_COORDS[unit_idx];
325+
const {x, y, sections} = UNIT_COORDS[unit_idx];
313326
ctx.save();
314327
for (const unlocked of unit.unlocked_units) {
315328
draw_one_dep_line(ctx, x, y, unlocked, highlighted);
316329
}
317330
for (const unlocked of unit.unlocked_rmeta_units) {
318-
draw_one_dep_line(ctx, rmeta_x, y, unlocked, highlighted);
331+
const codegen_x = get_codegen_section_x(sections);
332+
draw_one_dep_line(ctx, codegen_x, y, unlocked, highlighted);
319333
}
320334
ctx.restore();
321335
}
@@ -589,15 +603,16 @@ function pipeline_mousemove(event) {
589603
if (box.i in REVERSE_UNIT_DEPS) {
590604
const dep_unit = REVERSE_UNIT_DEPS[box.i];
591605
if (dep_unit in UNIT_COORDS) {
592-
const {x, y, rmeta_x} = UNIT_COORDS[dep_unit];
606+
const {x, y} = UNIT_COORDS[dep_unit];
593607
draw_one_dep_line(ctx, x, y, box.i, true);
594608
}
595609
}
596610
if (box.i in REVERSE_UNIT_RMETA_DEPS) {
597611
const dep_unit = REVERSE_UNIT_RMETA_DEPS[box.i];
598612
if (dep_unit in UNIT_COORDS) {
599-
const {x, y, rmeta_x} = UNIT_COORDS[dep_unit];
600-
draw_one_dep_line(ctx, rmeta_x, y, box.i, true);
613+
const {y, sections} = UNIT_COORDS[dep_unit];
614+
const codegen_x = get_codegen_section_x(sections);
615+
draw_one_dep_line(ctx, codegen_x, y, box.i, true);
601616
}
602617
}
603618
ctx.restore();

0 commit comments

Comments
 (0)