• Keine Ergebnisse gefunden

Modular Termination Analysis for

N/A
N/A
Protected

Academic year: 2021

Aktie "Modular Termination Analysis for"

Copied!
134
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Modular Termination Analysis for java bytecode

by Term Rewriting

J¨ urgen Giesl

LuFG Informatik 2, RWTH Aachen University, Germany

joint work with C. Otto and M. Brockschmidt

(2)

Automated Termination Tools for TRSs

AProVE (Aachen) CARIBOO (Nancy) CiME (Orsay)

Jambox (Amsterdam) Matchbox (Leipzig) MU-TERM (Valencia) MultumNonMulta (Kassel) TEPARLA (Eindhoven) Termptation (Barcelona) TORPA (Eindhoven) TPA (Eindhoven) TTT (Innsbruck) VMTL (Vienna)

Annual International Competition

of Termination Tools

well-developed field active research

powerful techniques & tools

But:

What about application in

practice?

(3)

Automated Termination Tools for TRSs

AProVE (Aachen) CARIBOO (Nancy) CiME (Orsay)

Jambox (Amsterdam) Matchbox (Leipzig) MU-TERM (Valencia) MultumNonMulta (Kassel) TEPARLA (Eindhoven) Termptation (Barcelona) TORPA (Eindhoven) TPA (Eindhoven) TTT (Innsbruck) VMTL (Vienna)

Annual International Competition

of Termination Tools

well-developed field active research

powerful techniques & tools

But:

What about application in

practice?

(4)

Automated Termination Tools for TRSs

AProVE (Aachen) CARIBOO (Nancy) CiME (Orsay)

Jambox (Amsterdam) Matchbox (Leipzig) MU-TERM (Valencia) MultumNonMulta (Kassel) TEPARLA (Eindhoven) Termptation (Barcelona) TORPA (Eindhoven) TPA (Eindhoven) TTT (Innsbruck) VMTL (Vienna)

Annual International Competition

of Termination Tools

well-developed field active research

powerful techniques & tools But:

What about application in

practice?

(5)

Termination of Imperative Programs

Direct Approaches

Synthesis of Linear Ranking Functions

(Colon & Sipma, 01), (Podelski & Rybalchenko, 04), . . .

Terminator: Termination Analysis by Abstraction & Model Checking (Cook, Podelski, Rybalchenko et al., since 05)

Julia & COSTA: Termination Analysis of java bytecode (Spoto, Mesnard, Payet, 10),

(Albert, Arenas, Codish, Genaim, Puebla, Zanardini, 08) . . .

used at Microsoft for verifying Windows device drivers

no use of TRS-techniques (stand-alone methods)

(6)

Termination of Imperative Programs

Direct Approaches

Synthesis of Linear Ranking Functions

(Colon & Sipma, 01), (Podelski & Rybalchenko, 04), . . .

Terminator: Termination Analysis by Abstraction & Model Checking (Cook, Podelski, Rybalchenko et al., since 05)

Julia & COSTA: Termination Analysis of java bytecode (Spoto, Mesnard, Payet, 10),

(Albert, Arenas, Codish, Genaim, Puebla, Zanardini, 08) . . .

used at Microsoft for verifying Windows device drivers

no use of TRS-techniques (stand-alone methods)

(7)

Termination of Imperative Programs

Direct Approaches

Synthesis of Linear Ranking Functions

(Colon & Sipma, 01), (Podelski & Rybalchenko, 04), . . .

Terminator: Termination Analysis by Abstraction & Model Checking (Cook, Podelski, Rybalchenko et al., since 05)

Julia & COSTA: Termination Analysis of java bytecode (Spoto, Mesnard, Payet, 10),

(Albert, Arenas, Codish, Genaim, Puebla, Zanardini, 08) . . .

used at Microsoft for verifying Windows device drivers

no use of TRS-techniques (stand-alone methods)

(8)

Termination of Imperative Programs

Direct Approaches

Synthesis of Linear Ranking Functions

(Colon & Sipma, 01), (Podelski & Rybalchenko, 04), . . .

Terminator: Termination Analysis by Abstraction & Model Checking (Cook, Podelski, Rybalchenko et al., since 05)

Julia & COSTA: Termination Analysis of java bytecode (Spoto, Mesnard, Payet, 10),

(Albert, Arenas, Codish, Genaim, Puebla, Zanardini, 08)

. . .

used at Microsoft for verifying Windows device drivers

no use of TRS-techniques (stand-alone methods)

(9)

Termination of Imperative Programs

Direct Approaches

Synthesis of Linear Ranking Functions

(Colon & Sipma, 01), (Podelski & Rybalchenko, 04), . . .

Terminator: Termination Analysis by Abstraction & Model Checking (Cook, Podelski, Rybalchenko et al., since 05)

Julia & COSTA: Termination Analysis of java bytecode (Spoto, Mesnard, Payet, 10),

(Albert, Arenas, Codish, Genaim, Puebla, Zanardini, 08) . . .

used at Microsoft for verifying Windows device drivers

no use of TRS-techniques (stand-alone methods)

(10)

Termination of Imperative Programs

Direct Approaches

Synthesis of Linear Ranking Functions

(Colon & Sipma, 01), (Podelski & Rybalchenko, 04), . . .

Terminator: Termination Analysis by Abstraction & Model Checking (Cook, Podelski, Rybalchenko et al., since 05)

Julia & COSTA: Termination Analysis of java bytecode (Spoto, Mesnard, Payet, 10),

(Albert, Arenas, Codish, Genaim, Puebla, Zanardini, 08) . . .

used at Microsoft for verifying Windows device drivers

no use of TRS-techniques (stand-alone methods)

(11)

Termination of Imperative Programs

Direct Approaches

Synthesis of Linear Ranking Functions

(Colon & Sipma, 01), (Podelski & Rybalchenko, 04), . . .

Terminator: Termination Analysis by Abstraction & Model Checking (Cook, Podelski, Rybalchenko et al., since 05)

Julia & COSTA: Termination Analysis of java bytecode (Spoto, Mesnard, Payet, 10),

(Albert, Arenas, Codish, Genaim, Puebla, Zanardini, 08) . . .

used at Microsoft for verifying Windows device drivers

no use of TRS-techniques (stand-alone methods)

(12)

Termination of Imperative Programs

Rewrite-Based Approach

analyze java bytecode ( jbc ) instead of java using TRS-techniques for jbc is challenging

sharing and aliasing side effects

cyclic data objects object-orientation recursion

. . .

(13)

Termination of Imperative Programs

Rewrite-Based Approach

analyze java bytecode ( jbc ) instead of java using TRS-techniques for jbc is challenging

sharing and aliasing side effects

cyclic data objects object-orientation recursion

. . .

(14)

Termination of Imperative Programs

Rewrite-Based Approach

analyze java bytecode ( jbc ) instead of java using TRS-techniques for jbc is challenging

sharing and aliasing side effects

cyclic data objects object-orientation recursion

. . .

(15)

Termination of Imperative Programs

New approach (RTA ’10

, RTA ’11

)

Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc. transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(16)

Termination of Imperative Programs

New approach (RTA ’10

, RTA ’11

) Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc.

transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(17)

Termination of Imperative Programs

New approach (RTA ’10

, RTA ’11

) Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc.

transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(18)

Termination of Imperative Programs

New approach (RTA ’10

, RTA ’11

) Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc.

transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(19)

Termination of Imperative Programs

New approach (RTA ’10

, RTA ’11

) Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc.

transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(20)

Termination of Imperative Programs

New approach (RTA ’10, RTA ’11) Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc.

transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(21)

Termination of Imperative Programs

New approach (RTA ’10, RTA ’11) Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc.

transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(22)

Termination of Imperative Programs

New approach (RTA ’10, RTA ’11) Frontend

evaluate jbc a few steps

⇒termination graph

termination graph captures side effects, sharing, cyclic data objects etc.

transform

termination graph⇒TRS

Backend

prove termination of the resulting TRS (using existing techniques & tools)

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(23)

Termination of Imperative Programs

prolog - Program

jbc - Program //

Termination

Graph // TRS // Termination Tool (AProVE) haskell -

Program

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(24)

Termination of Imperative Programs

prolog - Program

&&

M M M M M jbc - Program //

Termination

Graph // TRS // Termination Tool (AProVE) haskell -

Program

88 q

q q q q

implemented in AProVE

modular termination graphs (separate graphs for separate methods)

⇒ scalability & recursion

successfully evaluated on jbc -collection

competitive termination tool for jbc

(25)

Termination of Imperative Programs

public class List { int value;

List next;

}

other techniques:

abstract objects to numbers

List-object representing [0, 1, 2] is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(26)

Termination of Imperative Programs

public class List { int value;

List next;

} other techniques:

abstract objects to numbers List-object representing [0, 1, 2]

is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(27)

Termination of Imperative Programs

public class List { int value;

List next;

} other techniques:

abstract objects to numbers List-object representing [0, 1, 2]

is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(28)

Termination of Imperative Programs

public class List { int value;

List next;

} other techniques:

abstract objects to numbers List-object representing [0, 1, 2]

is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class

List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(29)

Termination of Imperative Programs

public class List { int value;

List next;

} other techniques:

abstract objects to numbers List-object representing [0, 1, 2]

is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(30)

Termination of Imperative Programs

public class List { int value;

List next;

} other techniques:

abstract objects to numbers List-object representing [0, 1, 2]

is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms

particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(31)

Termination of Imperative Programs

public class List { int value;

List next;

} other techniques:

abstract objects to numbers List-object representing [0, 1, 2]

is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(32)

Termination of Imperative Programs

public class List { int value;

List next;

} other techniques:

abstract objects to numbers List-object representing [0, 1, 2]

is abstracted to length 3

our technique:

abstract objects to terms

introduce function symbol for every class List-object representing [0, 1, 2]

is abstracted to term: List(0, List(1, List(2, null) ) )

TRS-techniques generate suitable orders to compare arbitrary terms particularly powerful on user-defined data types

powerful on pre-defined data types by using Integer TRSs (RTA ’09)

(33)

From jbc to Termination Graphs

prolog - Program

## G

G G G jbc - Program //

Termination

Graph // TRS // Termination Tool (AProVE)

haskell - Program

;; w

w w

w

(34)

From jbc to Termination Graphs

prolog - Program

## G

G G G

jbc - Program //

Termination

Graph // TRS // Termination Tool (AProVE)

haskell - Program

;; w

w w

w

(35)

Example

class List { List n;

public void appE(int i) { if (n == null) {

if (i <= 0) return;

n = new List();

i--;

}

n.appE(i);

} }

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

(36)

Example

class List { List n;

public void appE(int i) { if (n == null) {

if (i <= 0) return;

n = new List();

i--;

}

n.appE(i);

} } 00: aload 0 // load this to opstack

01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

(37)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(38)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(39)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(40)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(41)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(42)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(43)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(44)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(45)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(46)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(47)

Abstract States of the jvm

00: aload 0 // load this to opstack 01: getfield n // load this.n to opstack 04: ifnonnull 26 // go to 26 if n != null 07: iload 1 // load i to opstack 08: ifgt 12 // go to 12 if i > 0 11: return // return (without value) 12: aload 0 // load this to opstack 13: new List // create new List object 16: dup // duplicate top of stack 17: invokespecial <init>//call constructor 20: putfield n // write new List to n 23: iinc 1, -1 // decrement i by 1 26: aload 0 // load this to opstack 27: getfield n // load this.n to opstack 30: iload 1 // load i to opstack 31: invokevirtual appE // recursive call 34: return // return (without value)

o1,i3 |

0

|

t:

o1,

i:

i3 | ε o1

:List(n=o

2

)

i3

:

Z o2

:List(?)

stack frame

1

input arguments

2

next program instruction

3

values of local variables (value of this is reference o

1

)

4

values on the operand stack

explicit sharing information

information about the heap

object at o

1

has type List, n-field has value o

2

object at address o

2

is null or of type List

i

3

is an arbitrary integer

(48)

00: aload 0 01: getfield n 04: ifnonnull 26 07: iload 1 08: ifgt 12 11: return 12: aload 0 13: new List 16: dup

17: invoke <init>

20: putfield n 23: iinc 1, -1 26: aload 0 27: getfield n 30: iload 1 31: invoke appE 34: return

o1,i3|0|t:o1,i:i3|ε o1:List(n=o2) i3:Z o2:List(?)

A

o1,i3|4|t:o1,i:i3|o2 o1:List(n=o2) i3:Z o2:List(?)

o1,i3|4|t:o1,i:i3|o4 o1:List(n=o4) i3:Z o4:List(n=o5) o5:List(?) o1,i3|4|t:o1,i:i3|null

o1:List(n=null) i3:Z

o1,i3|8|t:o1,i:i3|i3 o1:List(n=null) i3:Z

o1,i6|8|t:o1,i:i6|i6 o1:List(n=null) i6: [≤0]

o1,i6|11|t:o1,i:i6|ε o1:List(n=null) i6: [≤0]

o1,i7|8|t:o1,i:i7|i7 o1:List(n=null) i7: [>0]

o1,i7|12|t:o1,i:i7|ε o1:List(n=null) i7: [>0]

o1,i7|20|t:o1,i:i7|o8,o1 o1:List(n=null) i7: [>0]

o8:List(n=null) o1,i7|23|t:o1,i:i7|ε o1:List(n=o8) i7: [>0]

o8:List(n=null) o1,i7|26|t:o1,i:i8|ε o1:List(n=o8) i8: [≥0]

o8:List(n=null) i7: [>0]

o1,i3|26|t:o1,i:i3|ε o1:List(n=o4) i3:Z o4:List(n=o5) o5:List(?) o1,i9|26|t:o1,i:i10|ε o1:List(n=o4) i9:Z i10:Z o4:List(n=o5) o5:List(?)

o1,i9|31|t:o1,i:i10|i10,o4 o1:List(n=o4) i9:Z i10:Z o4:List(n=o5) o5:List(?) o4,i10|0|t:o4,i:i10|ε

o1,i9|34|t:o1,i:i10|ε o1:List(n=o4) i9:Z i10:Z o4:List(n=o5) o5:List(?) o4,i10|0|t:o4,i:i10|ε

o4:List(n=o5) i10:Z o5:List(?)

o11,i12|11|t:o11,i:i12|ε o1,i9|34|t:o1,i:i12|ε o1:List(n=o11) i9:Z o11:List(n=null)i12: [≤0]

o1,i9|34|t:o1,i:i12|ε o1:List(n=o11) i9:Z o11:List(n=null) i12: [≤0]

o14,i13|34|t:o14,i:i15|ε o1,i9|34|t:o1,i:i13|ε o1:List(n=o14) i9:Z o14:List(n=o16) i13:Z o16:List(n=null) i15: [≤0]

o1,i9|34|t:o1,i:i13|ε o1:List(n=o14) i9:Z o14:List(n=o16) i13:Z o16:List(n=null)

o1,i9|34|t:o1,i:i13|ε o1:List(n=o14) i9:Z o14:List(n=o16) i13:Z o16:List(?)

o17,i19|34|t:o17,i:i21|ε o1,i9|34|t:o1,i:i19|ε o1:List(n=o17)i9:Z o17:List(n=o18) i19:Z o18:List(n=o20) o20:List(?) i21:Z

o1,i9|34|t:o1,i:i19 o1:List(n=o17)o20:List(?) o17:List(n=o18) i19:Z o18:List(n=o20) i9:Z i6≤0

i7>0

i8=i71

withP withP

withP

State A:

do all calls of appE terminate?

this is an arbitrary acyclic List

i is an arbitrary integer

(49)

00: aload 0 01: getfield n 04: ifnonnull 26 07: iload 1 08: ifgt 12 11: return 12: aload 0 13: new List 16: dup

17: invoke <init>

20: putfield n 23: iinc 1, -1 26: aload 0 27: getfield n 30: iload 1 31: invoke appE 34: return

o1,i3|0|t:o1,i:i3|ε o1:List(n=o2) i3:Z o2:List(?)

A

o1,i3|4|t:o1,i:i3|o2 o1:List(n=o2) i3:Z o2:List(?)

B

o1,i3|4|t:o1,i:i3|o4 o1:List(n=o4) i3:Z o4:List(n=o5) o5:List(?) o1,i3|4|t:o1,i:i3|null

o1:List(n=null) i3:Z

o1,i3|8|t:o1,i:i3|i3 o1:List(n=null) i3:Z

o1,i6|8|t:o1,i:i6|i6 o1:List(n=null) i6: [≤0]

o1,i6|11|t:o1,i:i6|ε o1:List(n=null) i6: [≤0]

o1,i7|8|t:o1,i:i7|i7 o1:List(n=null) i7: [>0]

o1,i7|12|t:o1,i:i7|ε o1:List(n=null) i7: [>0]

o1,i7|20|t:o1,i:i7|o8,o1 o1:List(n=null) i7: [>0]

o8:List(n=null) o1,i7|23|t:o1,i:i7|ε o1:List(n=o8) i7: [>0]

o8:List(n=null) o1,i7|26|t:o1,i:i8|ε o1:List(n=o8) i8: [≥0]

o8:List(n=null) i7: [>0]

o1,i3|26|t:o1,i:i3|ε o1:List(n=o4) i3:Z o4:List(n=o5) o5:List(?) o1,i9|26|t:o1,i:i10|ε o1:List(n=o4) i9:Z i10:Z o4:List(n=o5) o5:List(?)

o1,i9|31|t:o1,i:i10|i10,o4 o1:List(n=o4) i9:Z i10:Z o4:List(n=o5) o5:List(?) o4,i10|0|t:o4,i:i10|ε

o1,i9|34|t:o1,i:i10|ε o1:List(n=o4) i9:Z i10:Z o4:List(n=o5) o5:List(?) o4,i10|0|t:o4,i:i10|ε

o4:List(n=o5) i10:Z o5:List(?)

o11,i12|11|t:o11,i:i12|ε o1,i9|34|t:o1,i:i12|ε o1:List(n=o11) i9:Z o11:List(n=null)i12: [≤0]

o1,i9|34|t:o1,i:i12|ε o1:List(n=o11) i9:Z o11:List(n=null) i12: [≤0]

o14,i13|34|t:o14,i:i15|ε o1,i9|34|t:o1,i:i13|ε o1:List(n=o14) i9:Z o14:List(n=o16) i13:Z o16:List(n=null) i15: [≤0]

o1,i9|34|t:o1,i:i13|ε o1:List(n=o14) i9:Z o14:List(n=o16) i13:Z o16:List(n=null)

o1,i9|34|t:o1,i:i13|ε o1:List(n=o14) i9:Z o14:List(n=o16) i13:Z o16:List(?)

o17,i19|34|t:o17,i:i21|ε o1,i9|34|t:o1,i:i19|ε o1:List(n=o17)i9:Z o17:List(n=o18) i19:Z o18:List(n=o20) o20:List(?) i21:Z

o1,i9|34|t:o1,i:i19 o1:List(n=o17)o20:List(?) o17:List(n=o18) i19:Z o18:List(n=o20) i9:Z i6≤0

i7>0

i8=i71

withP withP

withP

State B:

“aload 0” loads value o

1

of this on opstack

“getfield n” replaces o

1

by o

2

on opstack (value of its n-field)

A connected to B by evaluation edge

Referenzen

ÄHNLICHE DOKUMENTE

We introduce a novel pre-processing method which automatically transforms Prolog programs into logic pro- grams without cuts, where termination of the cut-free program

The reason is that in the Eval rule one does not take into account that no concretization of the current abstract goal would unify with any head of a program clause (since

We show how to combine the two most powerful approaches for automated termination analysis of logic programs (LPs): the direct approach which operates directly on LPs and

Since arbitrary techniques can be applied to search for reduction pairs required in the function exist(G, O), an obvious option is to use polynomial interpre- tations, one of the

Since we consider only definite logic programs, any program which is terminating without occur check is also terminating with occur check, but not vice versa. So if our approach

For automated (innermost) termination proofs, one tries to solve the constraints generated by the dependency pair technique with standard orders like RPOS, KBO, or polynomial

In the screenshot, the node “TRS2” is the proof obligation which corresponds to the TRS R and the edge “Dependency Pair Analysis” is the proof technique which transforms R into

The dependency pair approach is one of the most powerful techniques for automated (innermost) termination proofs of term rewrite systems (TRSs).. For any TRS, it generates