Software Engineering ProofTransforming Compilation of Programs with Abrupt

Software Engineering Proof-Transforming Compilation of Programs with Abrupt Termination Peter Müller and Martin Nordio Microsoft Research (USA) ETH Zurich

Proof-Carrying Code Source Prog Certifying compiler code VC Generator Annotations VC Generator VC VC Proof Generator Proof Checker CPU Code Producer Software Engineering Code Consumer 2

Develop the proof for the Bytecode l Logics for intermediate languages such as Java Bytecode and CIL were developed (Müller and Bannwart) l Pro: It can produce the certificate needed l Con: It is difficult and expensive Software Engineering 3

Proof-Transforming Compilers (PTC) Source prog. + contracts Prover Source prog. + proof Bytecode + proof PTC Proof Checker CPU Code Producer Software Engineering Code Consumer 4

PTC Elements Source Language: Java Logic: Hoare-Style structured control flow variables translation functions Bytecode Logic Bytecode Language: Java Bytecode Software Engineering 5 unstructured control flow operand stack

The bytecode Language Software Engineering 6

The bytecode Logic l We use the bytecode logic developed by F. Bannwart and P. Müller l Instruction specification Software Engineering 7

The Source Language l Similar to a Java subset Software Engineering 8

Logic for Java subset l The logic is based on the programming logic developed by A. Poetzsch-Heffter and N. Rauch. l Properties of method bodies are expressed by Hoare triples of the form normal Software Engineering break 9 exception

Example: try-finally statements b= 4 ? Normal Software Engineering or Exception? 10

Compilation: try-finally statements Software Engineering 11

Example: try-finally statements Software Engineering 12

Logic for try-finally statements N B E 2 N N B E 2 B B B E 2 E 1 B E 2 finally try Software Engineering 13

Example 2: Exception Table Software Engineering 14

Example 2: Exception Table (cont. ) Exception any Exception Software Engineering 15

Example 2: Exception Table (cont. ) Exception any Exception Software Engineering 16

Translation Function Software Engineering 17

PTC l Compositional statement l While l try-finally l Break ¢ ¢ Software Engineering Translate the finally blocks dividing the exception table Add a goto end-while 18

Summary l Source Language: ¤ Subset of Java ¤ while, break, ¤ try-catch, try-finally, throw l Soundness proof Software Engineering 19
- Slides: 19