about summary refs log tree commit diff
path: root/tvix/eval/src/compiler
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-26T15·38+0300
committertazjin <tazjin@tvl.su>2022-09-03T00·49+0000
commit903b57be042b9f3f0ad6f714d4dec0c1795f93c0 (patch)
tree9acdf1e37149780686b0f098ab9f7ea06bcffa8c /tvix/eval/src/compiler
parentbc9351f811a9394898d0c9ab4da193e320c27bdd (diff)
docs(tvix/eval): add doc comment on `compiler::patch_jump` r/4612
Change-Id: Ifdd7b99223d239d955ac7eeeae95db97eb742bf0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6276
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/compiler')
-rw-r--r--tvix/eval/src/compiler/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index faf67135ed62..a7e5ceb32af4 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -859,6 +859,12 @@ impl Compiler {
         self.emit_constant(Value::String(ident.ident_token().unwrap().text().into()));
     }
 
+    /// Patch the jump instruction at the given index, setting its
+    /// jump offset from the placeholder to the current code position.
+    ///
+    /// This is required because the actual target offset of jumps is
+    /// not known at the time when the jump operation itself is
+    /// emitted.
     fn patch_jump(&mut self, idx: CodeIdx) {
         let offset = self.chunk().code.len() - 1 - idx.0;