Title: Region Inference for an Object-Oriented Language
1Region Inference for an Object-Oriented Language
- Wei Ngan Chin1,2
- Joint work with
- Florin Craciun1, Shengchao Qin1,2, Martin Rinard3
- 1 National University of Singapore
- 2 Singapore-MIT Alliance 3 MIT
2Background
- Basic problem
- how to recover memory of dead objects?
- Two Approaches
- garbage collection
- explicit memory management
- Our Focus
- Explicit memory regions with different lifetimes
3Current Status
- Region Inference for a functional language
- ?-Calculus Tofte-Talpin POPL94
- Previous Works on Region Type Checkers
- Java DIKU98,
- Real-Time Java MIT-PLDI03,
- Cyclone Cornell-PLDI02.
Our Goal automatic region inference for
object-oriented programs
4Two Major Assumptions
top (younger)
- Lexically-Scoped Regions
- Stack-like lifetimes
- construct for local region
- letreg r in e
r4
r3
- No Dangling References
- Regions of components should have longer
lifetimes than its object.
r2
r1
bottom (older)
5Main Contributions
- Region Inference for Core-Java
- Constraint-Based Type System.
- Region Polymorphism Region Subtyping
- Handles Inheritance, Overriding, Downcast
- Implementation
6Region-Annotated Core-Java
7Inferring for Class
Step 4 Inherit constraint of superclass.
8Inferring for Class
Step 1 Reserve first region for the receiver
object (this).
Step 2 Keep regions of fields distinct for
precision.
Step 3 No dangling requirement as class
invariant.
9Inferring for Methods
10Outline
- Background
- Key Techniques
- Inferring Class
- Inferring Methods
- Region Subtyping
- Region Inference
- Method Overriding Downcast
- Experimental Results
11(Object) Region Subtyping
concept pioneered in Cyclone PLDI02 an object
w of type cltr,..gt can be passed to a location v
of type clts,..gt provided r