web: tracer drawer — opt-level selector, tailcall render, right-column panels#222
Merged
Conversation
Contributor
|
The trace panels live in a flex:1 grid whose implicit row was auto- sized to content, so dragging the drawer taller left dead space below the panels instead of growing them. Give the grid an explicit 1fr row and min-height:0 (on the grid and its items) so both panels absorb the added vertical space and scroll internally.
The drawer hardcoded optimizer level 0. Add an O0/O2 toggle in the drawer header that recompiles + retraces at the chosen level, so readers can flip to level 2 and watch optimizer transforms (e.g. the tailcall annotation on TCO back-edges) appear. compileAndTrace now takes the level explicitly; a ref mirrors the state so the example- load effect reads the current level without re-running on toggle.
bugc #217 emits the TCO back-edge as a single flat context object (return + invoke + transform keys together), but the existing tests only exercised the gather shape. Add flat-shape variants for transform extraction, the isTailCall flag, and frame replacement, plus a guard that stripping the marker (the #10 failure mode) drops tail-call handling.
- Reuse the shared, tailcall-aware buildCallStack / extractCallInfo / extractTransform from @ethdebug/programs-react via a thin adapter (bugc .debug.context -> ethdebug format shape); drop the drawer's inline call-stack builder and local extractCallInfo. - Render the tail-call chip on the reused call-stack frame and a tail-call variant on the call-info banner. - Right column (gnidan's picks 1/2/4): resolved variable values (name: value via pointer resolution), gas remaining + per-step delta, and a transform annotations panel with per-tag glosses. Sections are now collapsible.
gnidan's call: expose all four bugc optimizer levels (each distinct — L1 fold/prop/DCE, L2 +CSE/TCO/jump-opt, L3 +merging) rather than a two-state O0/O2 toggle, future-proofing for other transforms. The recompile+retrace already took the level; just widen the control from two buttons to four (mapped over OPT_LEVELS, per-level tooltips). The tailcall demo still lands on O2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Package-level (docs
TraceDrawerwidget + programs-react test coverage). No spec/schema changes. Coordinated pass onTraceDrawer.tsxcovering tasks #3/#6/#9/#11.Changes
flex:1grid whose row was content-sized, so drag-expanding the drawer left dead space. Explicit1frrow +min-height:0so both panels absorb the added height and scroll internally.compileAndTracenow takes the level and recompiles+retraces on toggle. Lets readers flip to O2 and watch optimizer transforms (the tailcall annotation) appear.extractCallInfowith the shared, tailcall-awarebuildCallStack/extractCallInfoFromInstruction/extractTransformFromInstructionfrom@ethdebug/programs-react(programs-react: render tailcall transform + fix TCO call stack #218), via a thin adapter (bugc.debug.context→ ethdebug format shape). Gives the docs widget the TCO frame-replacement fix. Renders the tail-call chip on the reused call-stack frame and a tail-call banner variant.name: valuevia pointer resolution), gas remaining + per-step delta, and a transform annotations panel with per-tag glosses. Sections are now collapsible. (Held: full storage, call detail, memory.){return, invoke, transform}on one object; tests previously only used the gather shape), plus a guard for the marker-stripped (Discussion at DevCon VI (2022-10-14) needs review #10) failure mode.Verify
yarn buildclean;build-web(docusaurus) compiles successfully; programs-react suite 35 passing; eslint clean.Selector labels are "O0"/"O2" (writer #219 mirroring); open to "Level 0/2" if preferred.