diff options
Diffstat (limited to 'anim/scenes/gallery.zig')
| -rw-r--r-- | anim/scenes/gallery.zig | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/anim/scenes/gallery.zig b/anim/scenes/gallery.zig index fce9d43..7c480ec 100644 --- a/anim/scenes/gallery.zig +++ b/anim/scenes/gallery.zig @@ -9,6 +9,7 @@ //! 2 s the frame at rest, `beside`: every panel, the thread (mock 9) //! 3.6 s a step, mid-way: struck, read, projection, echo (mock 10) //! 6 s `subject` (mock 11); 8 s `none`, with the backtrace +//! 10.8 s two loupes in depth, from rax and its node's `next` (mock 21) const std = @import("std"); const sk = @import("sketch"); const anim = @import("anim"); @@ -60,15 +61,15 @@ fn atoms(u: ui.Ui, p: *const Pages) void { x += 120; x = u.address(x, rows.baseline(y), regs.rip, .{ .ink = ui.rgb(region.code_), .name = p.rec.strings.get(regs.rip) orelse "" }) + 40; x = u.address(x, rows.baseline(y), 0x7ffff7ff0000, .{ .ink = ui.rgb(region.data), .rwx = true }) + 40; - const struck: ui.Heat = .{ .level = 1, .solid = 1 }; + const struck: ui.Heat = .struck; const cell: canim.Rect = .{ .x = x, .y = y, .w = 6 * 12, .h = row }; - _ = u.written(cell, struck, 9); - _ = u.address(x, rows.baseline(y), 0x407050, .{ .ink = ui.rgb(t.ink), .face = .mono_bold }); + _ = u.written(cell, struck); + _ = u.address(x, rows.baseline(y), 0x407050, .{ .ink = ui.rgb(t.bright), .face = .mono_bold }); x += 112; u.read(.{ .x = x, .y = y, .w = 72, .h = row }, 1); _ = u.address(x, rows.baseline(y), 0x407058, .{ .ink = ui.rgb(region.heap) }); x += 112; - _ = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, .ember, 9); + _ = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, .ember); _ = u.address(x, rows.baseline(y), 0x407030, .{ .ink = ui.rgb(region.heap) }); // value @@ -121,7 +122,7 @@ fn atoms(u: ui.Ui, p: *const Pages) void { u.text(.mono_bold, theme.size.mono.context, 64 + 46 - 24, rows.baseline(y), "21", t.ink); x = 300; for ([_]ui.Heat{ .{ .arm = 1 }, struck, .ember }) |h| { - const ink = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, h, 9); + const ink = u.written(.{ .x = x, .y = y, .w = 72, .h = row }, h); _ = u.address(x, rows.baseline(y), 0x407070, .{ .ink = if (ink) |i| i.ink else ui.rgb(region.heap), .face = if (ink) |i| i.face else .mono }); x += 120; } @@ -226,19 +227,19 @@ fn rowsPage(u: ui.Ui, p: *const Pages) void { y += 12; var panel = u.moved(64, y); _ = rows.reg(panel, 0, 880, "rsi", m, regs.rsi, .{}); - _ = rows.reg(panel, row, 880, "rdi", m, regs.rdi, .{ .first = .{ .level = 1, .solid = 1 } }); + _ = rows.reg(panel, row, 880, "rdi", m, regs.rdi, .{ .first = .struck }); _ = rows.reg(panel, 2 * row, 880, "rax", m, regs.rax, .{ .first = .ember }); _ = rows.reg(panel, 3 * row, 880, "rbp", m, regs.rbp, .{ .read = 1, .read_shows = 1 }); rows.rip(panel, 4 * row, 880, m, regs.rip, regs.eflags, 1 << 6, 1, 0); y = 380; title(u, 64, y, "slot"); - note(u, 140, y, "its pins in the lane; the chain from 122; `call` spans at the right"); + note(u, 140, y, "its pins in the lane; the offset from rsp; the address from 184 and its chain; a role; `call` spans at the right"); y += 12; panel = u.moved(64, y); for (0..4) |i| { const addr = regs.rsp + 8 * i; - _ = rows.slot(panel, @as(f32, @floatFromInt(i)) * row, 880, m, addr, if (i == 0) &.{ "rsp", "rbp" } else &.{}, 1, .{ .lead = ui.shared(&.{ regs.rsp, regs.rsp + 24 }), .first = if (i == 2) .ember else .none }); + _ = rows.slot(panel, @as(f32, @floatFromInt(i)) * row, 880, m, addr, @intCast(8 * i), if (i == 0) &.{ "rsp", "rbp" } else &.{}, 1, .{ .lead = ui.shared(&.{ regs.rsp, regs.rsp + 24 }), .first = if (i == 2) .ember else .none }, if (i == 0) "saved rbp" else if (i == 1) "cur" else "", i == 1); } rows.span(panel, 880, 0, 2 * row, "reverse", true, false); rows.span(panel, 880, 2 * row, 4 * row, "main", false, true); @@ -271,7 +272,7 @@ fn rowsPage(u: ui.Ui, p: *const Pages) void { panel = u.moved(976, y); var values: [16]u8 = .{ 12, 0, 0, 0, 0, 0, 0, 0, 0x10, 0x70, 0x40, 0, 0, 0, 0, 0 }; var known: [16]bool = @splat(true); - rows.bytes(panel, 0, 0x407030, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number, .read = 1 }, .{ .first = 8, .len = 8, .kind = .pointer, .heat = .{ .level = 1, .solid = 1 } } }, region.heap, 4, true, m); + rows.bytes(panel, 0, 0x407030, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number, .read = 1 }, .{ .first = 8, .len = 8, .kind = .pointer, .heat = .struck } }, region.heap, 4, true, m); values[8] = 0x50; rows.bytes(panel, row, 0x407050, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number }, .{ .first = 8, .len = 8, .kind = .pointer, .heat = .ember } }, region.heap, 4, true, m); known = @splat(false); @@ -298,6 +299,12 @@ fn frame(s: *anim.Frame) void { const at = canim.cursor(s, rec, rest); const ctx = canim.context(s, at, .{ .split = canim.layout.split.beside, .quiet = true }); const list = canim.nodes(s, .{ .cursor = at, .stage = ctx.stage, .root = "head", .track = &.{ "prev", "cur", "next" }, .quiet = true }); + ctx.map.add(s, canim.Nodes{ .cursor = at, .stage = ctx.map.stage, .root = "head", .track = &.{ "prev", "cur", "next" }, .quiet = true }); + // A loupe from rax (the last node, whose `next` is NULL by then), and + // one from the `next` of the node before it in the first's rows: two in depth. + const rax = rec.register(rec.next(.line, rest), "rax"); + const near = canim.loupe(s, .{ .cursor = at, .stage = ctx.stage, .from = .{ .register = "rax" } }); + const deeper = canim.loupe(s, .{ .cursor = at, .stage = ctx.stage, .from = .{ .field = .{ .loupe = near, .at = rax - 0x20 + 8 } } }); const joins = ctx.ties(s); const says = canim.caption(s, "The gallery: the frame, at rest. Every panel, the thread,\nthe lens beside it: the list and the bytes it is drawn from."); const panels = .{ ctx.clock, ctx.registers, ctx.stack, ctx.backtrace, ctx.source, ctx.disasm, list, joins, says }; @@ -313,4 +320,8 @@ fn frame(s: *anim.Frame) void { s.wait(7 - s.cursor); ctx.stage.relayout(s, canim.layout.split.none); s.wait(9 - s.cursor); + near.open(s); + s.wait(9.8 - s.cursor); + deeper.open(s); + s.wait(11 - s.cursor); } |
