Skip to content

Commit 9e022bb

Browse files
committed
Add todos
1 parent 86e9422 commit 9e022bb

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

zjit/src/hir.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,16 +3867,39 @@ impl Function {
38673867
})
38683868
}
38693869

3870+
// TODO(Jacob): Complete this
3871+
// MVP Escape analysis demonstration (thanks Kevin!)
3872+
//
3873+
// scalar replace the following. No object allocation, it just returns 200
3874+
// p = Point.new(10, 20)
3875+
// a = p.x
3876+
// b = p.y
3877+
// area = a * b
3878+
38703879
fn escape_type_of(instruction: Insn) -> EscapeType {
38713880
match instruction {
3881+
// Object creation starts as NoEscape
3882+
Insn::ObjectAlloc { .. } => EscapeType::NoEscape,
3883+
Insn::ObjectAllocClass { .. } => EscapeType::NoEscape,
3884+
3885+
// We need some example that has MethodEscape or GlobalEscape for an initial test
3886+
3887+
38723888
// TODO(Jacob): Fill out each of the values here with our paper annotations from the burst
38733889
// TODO(Jacob): Eventually, this should not use any wildcard and should match for every single HIR instruction
38743890
_ => EscapeType::NoEscape,
38753891
}
38763892
}
38773893

3894+
// TODO(Jacob): handle the paper's x = p.f case. something like load / store or arrayload or attribute accessors can be scalar replaced (if the escape type is NoEscape)
3895+
// fn replace() {
3896+
3897+
// }
3898+
38783899
// TODO(Jacob): We probably need a function to do rewriting of escapable allocations here. TBD
38793900

3901+
// TODO(Jacob): Find a way to make different tests run just a single pass
3902+
// TODO(Jacob): Make a clear note about potentially altering tracepoint semantics
38803903
// TODO(Jacob): Make some escape analysis tests. Ask someone else to make sure the examples I'm using are correct for ruby and matter
38813904
fn scalar_replace(&mut self) {
38823905
// Design sketch

0 commit comments

Comments
 (0)