Browse Prior Art Database

Method for an efficient implementation of exception handling using illegal page fault predicate registers

IP.com Disclosure Number: IPCOM000008160D
Publication Date: 2002-May-22
Document File: 4 page(s) / 37K

Publishing Venue

The IP.com Prior Art Database

Abstract

Disclosed is a method for an efficient implementation of exception handling using illegal page fault predicate registers. Benefits include improved performance.

This text was extracted from a Microsoft Word document.
This is the abbreviated version, containing approximately 34% of the total text.

Method for an efficient implementation of exception handling using illegal page fault predicate registers

Disclosed is a method for an efficient implementation of exception handling using illegal page fault predicate registers. Benefits include improved performance.

Background

              Exception handling is an important feature of modern programming languages. A method (or function) call can return normally or throw an exception.

              Two conventional techniques exist for implementing exception handling:

·        The virtual machine (VM) unwinds the callee's stack frame, finds the caller's exception handler, and jumps to the exception handling code.

·        The compiler inserts a jump to an exception handler immediately after a call instruction. To execute a normal return, a method adjusts the return address so that it returns to the address immediately following the jump instruction. To throw an exception, a method returns to the jump instruction.

Description

              The disclosed method uses illegal page fault predicate registers to signal that a method call resulted in an exception. The runtime calling conventions are extended to reserve two predicate registers, ptexc and pfexc, that a method can use to throw an exception. These exception predicate registers always hold complement values. That is, pfexc equals not ptexc. After a method call, the exception predicate registers indicate whether the call resulted in an exception. If ptexc is true or pfexc is false after a method call, then the call resulted in an exception, and the return value register contains the exception object. Otherwise, the call returned normally and the return register contains the normal return value (if any).

              The disclosed method requires that a method's epilog (for example, the code containing a method's return sequence) be modified so that it sets the ptexc and pfexc to false and true, respectively. In addition, the compiler must generate an exception epilogthat throws an exception. The exception epilog sets ptexc to true and pfexc to false. The exception object is assigned to the integer return value register (r8) and returns to the method's caller.

              After each method call, the code must check whether the called method resulted in an exception and handle any exception appropriately. The compiler inserts a branch instruction that is predicated with ptexc after each method call. We refer to this instruction as the exception branch instruction. If ptexc is true, the exception branch instruction transfers control to code that dispatches the exception to the appropriate handler. If an exception handler does not exist for the exception, then the exception dispatching code throws the exception to the caller. Because exceptions are rare, the compiler uses the branch hint bits to predict the exception branch instruction as statically not taken. For example, the compiler uses br.spnt. This approach prevents the exception branch instruction from using up valuable branch prediction hardware resources.

              The com...