about summary refs log tree commit diff
path: root/tvix/eval/src/disassembler.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-09-09 r/4780 chore(tvix/eval): clean up remains of previous disassembler implVincent Ambo1-41/+0
Change-Id: Ib402ea23a58dc52ed0c5a97178cb5d0e53d69300 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6454 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-09 r/4777 refactor(tvix/eval): move `disassemble_op` to the Chunk structureVincent Ambo1-27/+1
Change-Id: Ic6710c609ed647bfa47d673aaf22c4da96c0f319 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6451 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-09 r/4775 feat(tvix/eval): implement DisassemblingObserver for compilerVincent Ambo1-28/+16
This type implements an observer that is called whenever the compiler emits a chunk (after the toplevel, thunks, or lambdas) and prints the output of the disassembler to its internal writer. This replaces half of the uses of the `disassembler` feature, which has been removed from the Cargo configuration. Note that at this commit runtime tracing is not yet implemented as an observer. Change-Id: I7894ca1ba445761aba4ad51d98e4a7b6445f1aea Reviewed-on: https://cl.tvl.fyi/c/depot/+/6449 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-08 r/4768 feat(tvix/eval): print lambda memory adresses in disassemblerVincent Ambo1-10/+11
This makes it easier to track exactly which lambda is which when inspecting e.g. the concrete representation of a thunk. At runtime all lambdas live in an Rc. To make this print the right address, the construction of these Rcs had to be moved up right to the point where the lambda is first emitted (and disassembled). Change-Id: I6070e6c8ac55f0bd697966c4e7c5565c20d19106 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6435 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-08 r/4767 fix(tvix/eval): ensure disassembler prints continous lines correctlyVincent Ambo1-4/+3
There can be different spans on the same line, so the previous implementation would duplicate line numbers unnecessarily. Change-Id: I8d8db77177aee0d834a6ec3584641e1bd5f31c3e Reviewed-on: https://cl.tvl.fyi/c/depot/+/6434 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-08 r/4763 fix(tvix/eval): address current clippy & grfn lintsVincent Ambo1-17/+17
Change-Id: I65c6feb9f817b5b367d37204a1f57acfe4100d97 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6430 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-08 r/4752 refactor(tvix/eval): implement much clearer disassembler outputVincent Ambo1-3/+5
With this change the runtime trace contains much more exact information about the context of the computation (entering/exiting calls etc.) This is in large part due to moving the tracer to be a field on the VM itself, which enables consistent ordering of traces across the execution, and tracing an execution with its *input* instead of *output* stack. Change-Id: Ibe525e6e7d869756501e52bef1a441619ce7332c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6419 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-08 r/4747 feat(tvix/eval): thread codemap through to disassemblerVincent Ambo1-2/+11
If the disassembler feature is enabled, make sure that an Rc of the codemap is available through the chunk. Change-Id: I700f27ab665a704f73457b19bd2d7efc93828a16 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6414 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-09-07 r/4697 fix(tvix/eval): avoid recomputing width in disassemble_op constantlyVincent Ambo1-4/+4
As noticed by sterni in cl/6195 Change-Id: Ie9c1e80e2e709284fa8412334af9188d999f64dc Reviewed-on: https://cl.tvl.fyi/c/depot/+/6361 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-30 r/4534 feat(tvix/eval): implement chunk disassembler outputVincent Ambo1-0/+31
This makes for a much nicer view of an execution if `--feature disassembler` is set, for example: tvix-repl> let value = [ 1 2 { a = 1; } ]; in value ++ [ 1 ] === compiled bytecode (11 operations) === 02 OpConstant(1) 02 OpConstant(2) 02 OpConstant("a") 02 OpConstant(1) 02 OpAttrs(1) 02 OpList(3) 02 OpGetLocal(0) 02 OpConstant(1) 02 OpList(1) 02 OpConcat 02 OpCloseScope(1) === runtime trace === 0001 OpConstant(ConstantIdx(0)) [ 1 ] 0002 OpConstant(ConstantIdx(1)) [ 1 2 ] 0003 OpConstant(ConstantIdx(2)) [ 1 2 "a" ] 0004 OpConstant(ConstantIdx(3)) [ 1 2 "a" 1 ] 0005 OpAttrs(1) [ 1 2 { a = 1; } ] 0006 OpList(3) [ [ 1 2 { a = 1; } ] ] 0007 OpGetLocal(0) [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } ] ] 0008 OpConstant(ConstantIdx(4)) [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } ] 1 ] 0009 OpList(1) [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } ] [ 1 ] ] 0010 OpConcat [ [ 1 2 { a = 1; } ] [ 1 2 { a = 1; } 1 ] ] 0011 OpCloseScope(1) [ [ 1 2 { a = 1; } 1 ] ] => [ 1 2 { a = 1; } 1 ] :: list Change-Id: If79c7fd1f0f18255ddb3763c1ba585fda8041b1b Reviewed-on: https://cl.tvl.fyi/c/depot/+/6195 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-08-30 r/4533 feat(tvix/eval): implement optional runtime tracingVincent Ambo1-0/+37
This adds a `disassembler` feature to the crate configuration that traces the operations executed and the state of the stack at runtime. This can be enabled by compiling with `--feature disassembler`. This will also gain a more sensible layout of code slices eventually. Change-Id: I34c15e1cd346ecc4362b5afba6bf82dd49359d20 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6193 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>