Exception Delivery Requirement

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

The Kernel Abstraction. Challenge: Protection How do we execute code with restricted privileges? – Either because the code is buggy or if it might be.
Chapter 9 Subprogram Control Consider program as a tree- –Each parent calls (transfers control to) child –Parent resumes when child completes –Copy rule.
Memory Allocation. Three kinds of memory Fixed memory Stack memory Heap memory.
Run time vs. Compile time
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
Exception Handling. Exceptions and Errors When a problem encounters and unexpected termination or fault, it is called an exception When we try and divide.
1 Exceptions (Section 8.5) CSCI 431 Programming Languages Fall 2003 A compilation of material developed by Felix Hernandez-Campos and Michael Scott.
Question: What causes asynchronous control? Asynchronous control ≈ not determined by normal instruction execution Example int x = 2; // suppose a transfer.
Copyright © 2005 Elsevier Chapter 8 :: Subroutines and Control Abstraction Programming Language Pragmatics Michael L. Scott.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
COP4020 Programming Languages Subroutines and Parameter Passing Prof. Xin Yuan.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
Processes and Virtual Memory
Exceptions in C++. Exceptions  Exceptions provide a way to handle the errors generated by our programs by transferring control to functions called handlers.
Exceptions and Assertions Chapter 15 – CSCI 1302.
CS412/413 Introduction to Compilers and Translators Spring ’99 Lecture 11: Functions and stack frames.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
Memory Protection: Kernel and User Address Spaces Andy Wang Operating Systems COP 4610 / CGS 5765.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
Tutorial 2: Homework 1 and Project 1
Chapter 4 – Thread Concepts
Translation Lookaside Buffer
Java Exceptions a quick review….
Exception Handling in C++
C++ Exceptions.
PZ11A Programming Language design and Implementation -4th Edition
Data Watch Presenter Information Jason Puncher and François Tétreault
Interrupts and signals
Memory Protection: Kernel and User Address Spaces
Microprocessor Systems Design I
CS 6560: Operating Systems Design
Anton Burtsev February, 2017
Protection of System Resources
Chapter 4 – Thread Concepts
Intro to Processes CSSE 332 Operating Systems
The HP OpenVMS Itanium® Calling Standard
Chapter 14: Exception Handling
CSE 120 Principles of Operating
Memory Protection: Kernel and User Address Spaces
Chapter 9 :: Subroutines and Control Abstraction
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Chapter 9: Virtual-Memory Management
C++ Exception Handling for IA-64 Unix
Chap. 8 :: Subroutines and Control Abstraction
Chap. 8 :: Subroutines and Control Abstraction
Exception Handling In Text: Chapter 14.
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
The University of Adelaide, School of Computer Science
Translation Lookaside Buffer
Architectural Support for OS
Exception Handling Imran Rashid CTO at ManiWeber Technologies.
MIPS function continued
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Languages and Compilers (SProg og Oversættere)
Exception handling Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.1.
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
Where is all the knowledge we lost with information? T. S. Eliot
Signals.
Exception handling Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.1.
Exception handling Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.1.
Memory Protection: Kernel and User Address Spaces
Exception handling Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 11.1.
Corresponds with Chapter 5
Dynamic Binary Translators and Instrumenters
Presentation transcript:

Exception Delivery Requirement After an exception, execution continues in the appropriate catch block with the correct program-visible state Exceptions may be explicitly raised by software (e.g. athrow), generated by the hardware (e.g. *(null)), or be asynchronous Java has precise exceptions constrains updates of both locals and globals

Example: NullPointerException (1) A thread dereferences <null> OS captures hardware state; raises SIGSEGV SIGSEGV delivered to trap handler (C) trap handler identifies as NullPointer trap trap handler modifies stack/registers of Java thread to be as if the faulting instruction had called VM_Runtime.deliverException passing it a trap code and a VM_Registers object (captured hardware state of excepting thread) trap handler has PC, FP, SP, etc. full hardware state Intel look at the instruction and other aspects

Example: NullPointerException (2) deliverException (Java) creates a java.lang.NullPointerException object while matching catch block not found Interpret stackframe to find machine code maps (exception tables) for current method Check for matching exception table entry for given pc and exception type If no match found, update VM_Register object to unwind stackframe (updates pc) GC is enabled when object is created, otherwise it is disabled Intel ORP delays creation of exception object until it is needed, may be useful if performance critical last step, simulates return from method

Example: NullPointerException (3) When a catch block is found, update VM_Registers so catch block can find exception object (compiler-specific) modify VM_Registers to resume execution at first instruction in catch block restore VM_Registers to hardware, and resume execution (Default top-level catch block prints stackdump and terminates thread) 1a) Baseline: push exception object on expression stack 1a) Opt: put it at known static offset 1b) modifies the PC, plus some other stuff last step is to enable GC

Exception Delivery Example Method with handler Throwing method Exception delivery methods

Implications for Optimization Java's precise exceptions constrain order of potentially excepting instructions updates to local variables that are live in catch blocks updates to global memory Some approaches multiple versions of loops [Moreira, Midkiff, Gupta, TOPLAS 99] perform liveness at exception handlers [Gupta, Choi, Hind, ECOOP 00] could be static or dynamic ignore exception dependences, but add compensation code