Java Software Engineering Laboratory Department of Computer Science
エイリアス関係を利用した Javaスライシングツールの実現 山中祐介*,横森励士*,井上克郎** *大阪大学 大学院基礎 学研究科 **大阪大学 大学院情報科学研究科 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
背景 ソフトウェアの大規模化・複雑化 プログラム言語の高級化 プログラムの理解や保守が困難なものになっている プログラム解析 プログラムスライス エイリアス解析 ‥ Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1
オブジェクト指向プログラムの動作例 クラスA 1: class A { 2: int n; 3: } a 1: 2: 3: 4: 5: b a = new A(); b = a; a. n += 1; System. out. println(b. n); n: 1 0 クラスA n: 0 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 6
エイリアスを考慮しない解析例 変数の定義情報を保持した変数表を用いて、依存関係解 析を行う クラスA a 1: class A { 2: int n; 3: } a 1: 2: 3: 4: 5: b a = new A(); a b = new A(); b = a; b a. n += 1; System. out. println(b. n); n: 1 0 クラスA n: 0 変数表 変数 a 定義行 4 1 b 2 3 5行目の出力は 4行目の演算に依存しているが データ依存関係の抽出ができていない Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 9
適用例(1行目) クラスA 1: class A { 2: int n; 3: } 1: 2: 3: 4: 5: n: 0 a a = new A(); b = a; a. n += 1; System. out. println(b. n); エイリアス表 ID 式 01 (1, a)(1, new)(3, b)(3, a)(4, a)(5, b) 02 (2, b)(2, new) 変数表 メンバ変数表 変数 定義行 ID ID 変数 定義行 a 1 01 01 n 1 b Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 14
適用例(2行目) クラスA 1: class A { 2: int n; 3: } a 1: 2: 3: 4: 5: b n: 0 クラスA a = new A(); b = a; a. n += 1; System. out. println(b. n); n: 0 エイリアス表 ID 式 01 (1, a)(1, new)(3, b)(3, a)(4, a)(5, b) 02 (2, b)(2, new) 変数表 メンバ変数表 変数 定義行 ID ID 変数 定義行 a 1 01 01 n 1 b 2 02 02 n 2 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 15
適用例(3行目) クラスA 1: class A { 2: int n; 3: } a 1: 2: 3: 4: 5: n: 0 a クラスA a = new A(); b = a; a. n += 1; System. out. println(b. n); n: 0 b エイリアス表 ID 式 01 (1, a)(1, new)(3, b)(3, a)(4, a)(5, b) 02 (2, b)(2, new) 変数表 メンバ変数表 変数 定義行 ID ID 変数 定義行 a 1 01 01 n 1 b 2 3 02 01 02 n 2 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 16
適用例(4行目) クラスA 1: class A { 2: int n; 3: } a 1: 2: 3: a, n 4: 5: n: 1 0 a クラスA a = new A(); b = a; a. n += 1; System. out. println(b. n); n: 0 b エイリアス表 ID 式 01 (1, a)(1, new)(3, b)(3, a)(4, a)(5, b) 02 (2, b)(2, new) 変数表 メンバ変数表 変数 定義行 ID ID 変数 定義行 a 1 01 01 n 1 4 b 3 01 02 n 2 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 17
適用例(5行目) クラスA 1: class A { 2: int n; 3: } a 1: 2: 3: a, n 4: 5: n: 1 0 a クラスA a = new A(); b b = a; n a. n += 1; System. out. println(b. n); n: 0 b エイリアス表 ID 式 01 (1, a)(1, new)(3, b)(3, a)(4, a)(5, b) 02 (2, b)(2, new) 変数表 メンバ変数表 変数 定義行 ID ID 変数 定義行 a 1 01 01 n 4 b 3 01 02 n 2 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 18
評価実験 解析対象プログラム P 1:サンプルプログラム(2クラス、24行) P 2:簡易ドローツール(3クラス、323行) 実験環境 CPU:Pentium 4 1. 5 Ghz メモリ: 512 MB OS:Free. BSD 5. 0 -CURRENT Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 22
- Slides: 26