n class Manager extends Employee ManagerString n int
- Slides: 25
エイリアス n (引数の参照渡し・参照変数・ポインタを介した間接 参照などで生じる,)同じメモリ領域を指す可能性の ある式間の同値関係 参照変数 class Manager extends Employee { Manager(String n, int s) { super(n, s); } void manage(Employee e) { e. set_boss(this); e. add_salary(50); } } 2000/03/09 インスタンス生成式 class Office { public static void main(String args[]) { Employee A = new Employee("Mr. A", 700); Manager B = new Manager("Mr. B", 850); B. manage(A); 「エイリアス指定 A. print(); B. print(); 」 } } 第 126回 ソフトウェア 学研究会 3
エイリアス計算手順 n 到達エイリアス集合(Reaching Alias, RA)を利用 n n RA(s) ⇔ 文sに到達可能なエイリアス組の集合 プログラム実行経路をたどりながら,順次計算 文 到達エイリアス集合 RA(s) 1 Φ 2 {a, (1, new Integer)} 3 {a, (1, new Integer)}, {b, (2, new Integer)} Integer a, b, c; 4 {a, (1, new Integer)}, 1: a = new Integer(1); 2: b = new Integer(2); {c, b, (2, new Integer)} 3: c = b; 5 {a, (1, new Integer)}, 4: System. out. println(c); {c, b, (2, new Integer)} 5: c = a; 6 {c, a, (1, new 6: System. out. println(c); Integer)}, {b, (2, new Integer)} 2000/03/09 第 126回 ソフトウェア 学研究会 5
Phase 1: n AFG構築(続き) AFG ⇔ AFG節点/AFG辺により構築 n n メソッド → メソッドAFG クラス → クラスAFG public class Calc { Integer i; }public Calc() {i = new Integer(0); public void inc() { i = new Integer(i. int. Value() + 1); } public void add(int c) { i = new Integer(i. int. Value() + c); } }public Integer result() {return(i); } 2000/03/09 第 126回 ソフトウェア 学研究会 11
Phase 3: n 単純式x … 例: a, b, c, new Calc() Step 1: n AFGによるエイリアス計算 グラフ到達問題(AFG + MFG) 限定式x. y … 例: b. result() Step 1: Step 2: Step 3: (インスタンス)xに関するエイリアス計算 X に関する情報の抽出 (エイリアス集合をX) yに関するエイリアス計算 class Test { Calc a = new Calc(); Calc b = new Calc(); Integer c; Test() { a. inc(); b. add(1); c = b. result(); } } public class Calc { Integer i; }public Calc() {i = new Integer(0); public void inc() { i = new Integer(i. int. Value() + 1); } public void add(int c) { i = new Integer(i. int. Value() + c); } }public Integer result() {return(i);
Phase 3: AFGによるエイリア…(続き) 例: 限定式b. result() bに関するエイリアス計算(エイリアス集合をB) Step 2: B に関する情報の抽出 型: Calcクラス メソッド: Calc: : Calc(), Calc: : add(), Calc: : result() …Object-Context(B) Step 3: result()に関するエイリアス計算 Step 1: class Test { Calc a = new Calc(); Calc b = new Calc(); Integer c; Test() { a. inc(); b. add(1); c = b. result(); } } public class Calc { Integer i; }public Calc() {i = new Integer(0); public void inc() { i = new Integer(i. int. Value() + 1); } public void add(int c) { i = new Integer(i. int. Value() + c); } }public Integer result() {return(i);
オブジェクトコンテキスト n Object-Context(A) ⇔ エイリアス集合A に属するオ ブジェクトの,呼び出されうるメソッド n Flow-Insensitive …メソッド呼び出し順を考慮しない 例: {Calc: : Calc(), Calc: : add(), Calc: : result()} n Flow-Sensitive …メソッド呼び出し順を考慮する 例: Calc: : Calc()→Calc: : add()→Calc: : result() public class Calc { Integer i; }public Calc() {i = new Integer(0); public void inc() { i = new Integer(i. int. Value() + 1); } public void add(int c) { i = new Integer(i. int. Value() + c); } }public Integer result() {return(i); Flow-Insensitive } public class Calc { Integer i; }public Calc() {i = new Integer(0); public void inc() { i = new Integer(i. int. Value() + 1); } public void add(int c) { i = new Integer(i. int. Value() + c); } }public Integer result() {return(i); Flow-Sensitive }
評価(4/4) n 同一クラスのインスタンス間でのエイリアス情報共有に よる正確性低下 n n エイリアスをインスタンス独立に解析(非共有) エイリアスを非独立に解析(共有) エイリアス プログラム 計算対象クラス 非共有 共有 Text. Editor test. My. Text. Area 平均 最小 最大 4. 42 1 24 Weird. X com. jcraft. weirdx. Client 15. 37 1 46 24. 54 1 47 ANTLR antlr. Make. Grammer 5. 94 1 18 18. 77 1 76 9. 16 1 37 17. 19 1 105 Dynamic. Java koala. dynamicjava. inter preter. Type. Checker 2000/03/09 平均 最小 8. 31 1 最大 30 Debian/GNU Linux on Pentium. III-667 MHz 512 MB 第 126回 ソフトウェア 学研究会 24
- Sum0
- Class manager extends employee
- Interface calculator public int add(int a int b) class test
- Int max(int x int y)
- Public void drawsquare(int x, int y, int len)
- Divideint
- Extends testcase
- Jframe image
- Class nthread extends thread
- Interface myinterface int foo(int x)
- Int main(int argc, char** argv)
- Nnxn com
- 7팩토리얼
- Const int arduino
- Int main int num 4
- Void swap(int a int b)
- Void f(int i) int j=0
- Int.max
- Mainint
- Employee attitudes and employee performance
- Senior manager vs general manager
- Portfolio manager synergy manager parental developer
- Private int
- Public class person private string name
- Public class welcome public static int test
- Type of inheritance