Lecture6 - Type-safety and Compilers CSE 501 Lecture 6...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Type-safety and Compilers CSE 501 Lecture 6 April 20, 2009 1 Preliminaries Critiques? A Verifable SSA Program Representation For Aggressive Compiler Optimization ault-saFe Code Motion For Type-saFe Languages Questions on HW 1? HW 2 will be posted later today 2 Type safety A property of a programming language: a language is type-safe if it guarantees the integrity of its data types: An int is a really an int. A String is really a String. A char is really a char. Implies memory safety 3 Type-safe languages Unsafe languages: C, C++, ... Pointer arithmetic, casting, manual deallocation can generate pointers to invalid memory. Safe languages: Java, C#, Python, JavaScript, ML, ... Static checks: Deref. of an int wont compile Dynamic checks: Null check on a Feld access Automatic garbage collection 4 Example Java source if (a != null) while (!done) { b = (B) a; ... = ... b.x ...; ... } Java developer- compiles to bytecode- ships to client Client- verifes bytecode- compile to native code- executes Bytecode (simplifed) ifnull a goto EXIT L: ifeq done, 0 goto EXIT b = checkcast a, B t1 = getfield b, B::x ... goto L EXIT: Verifably type-saFe- checkcast :- runtime type check- getfeld :- statically typed- runtime null check 5 Why type-safety? Security, reliability, debuggability Buffer overFows, etc., common exploits Untrusted code, e.g., in web browsers No seg faults or mysterious corruption Is our C subset type-safe? Why type-safety? Security, reliability, debuggability Buffer overFows, etc., common exploits Untrusted code, e.g., in web browsers No seg faults or mysterious corruption Is our C subset type-safe? 6 How does type safety impact compilation?...
View Full Document

This note was uploaded on 02/09/2012 for the course CSE 403 taught by Professor Staff during the Spring '08 term at University of Washington.

Page1 / 29

Lecture6 - Type-safety and Compilers CSE 501 Lecture 6...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online