Skip to content

Commit 220619a

Browse files
committed
Add todos
1 parent b3e102a commit 220619a

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
@@ -3745,16 +3745,39 @@ impl Function {
37453745
})
37463746
}
37473747

3748+
// TODO(Jacob): Complete this
3749+
// MVP Escape analysis demonstration (thanks Kevin!)
3750+
//
3751+
// scalar replace the following. No object allocation, it just returns 200
3752+
// p = Point.new(10, 20)
3753+
// a = p.x
3754+
// b = p.y
3755+
// area = a * b
3756+
37483757
fn escape_type_of(instruction: Insn) -> EscapeType {
37493758
match instruction {
3759+
// Object creation starts as NoEscape
3760+
Insn::ObjectAlloc { .. } => EscapeType::NoEscape,
3761+
Insn::ObjectAllocClass { .. } => EscapeType::NoEscape,
3762+
3763+
// We need some example that has MethodEscape or GlobalEscape for an initial test
3764+
3765+
37503766
// TODO(Jacob): Fill out each of the values here with our paper annotations from the burst
37513767
// TODO(Jacob): Eventually, this should not use any wildcard and should match for every single HIR instruction
37523768
_ => EscapeType::NoEscape,
37533769
}
37543770
}
37553771

3772+
// 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)
3773+
// fn replace() {
3774+
3775+
// }
3776+
37563777
// TODO(Jacob): We probably need a function to do rewriting of escapable allocations here. TBD
37573778

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

0 commit comments

Comments
 (0)