# US 2003/0079202 A1 · Exception handling in java computing environments

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2003/0079202 A1
- Document ID: US20030079202A1
- Status: Published application
- Kind: A1
- Application number: 09/999,841
- Filed: 2001-10-24
- Published: 2003-04-24
- Earliest claimed: 2001-10-24
- Assignees: Sun Microsystems, Inc.
- Inventors: Stepan Sokolov
- Web page: https://patentgrep.com/patent/US20030079202A1

## CPC

- G06F 9/4812: {by interrupt, e.g. masked}
- G06F 9/4484: {Executing subprograms}
- G06F 9/4486: {Formation of subprogram jump address}
- G06F 9/45504: {Abstract machines for program code execution, e.g. Java virtual machine [JVM], interpreters or emulators}
- G06F 2209/481: Exception handling
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Techniques for handling exceptions raised during the execution of Java computer programs are disclosed. The techniques can be used by a Java virtual machine to efficiently handle exceptions. A method descriptor is implemented in a Java method frame which is stored in the Java execution stack. The method descriptor provides one or more references to exception handlers associated with the Java method. The references can be used to quickly identify and invoke the appropriate exception handler. This can be achieved without having to use a native language execution stack. As a result, the overhead associated with several returns from native functions (routines or methods) can be avoided since the information needed to invoke the appropriate exception handler can be obtained efficiently from the Java execution stack. Accordingly, the performance of Java virtual machines, especially those operating with limited resources, can be significantly enhanced.

## Claims

### Claim 1

A Java computing environment, said Java computing environment comprising:
a Java virtual machine;
a Java execution stack;
at least one Java method frame stored on said Java execution stack, wherein said Java method frame includes a method descriptor, said method descriptor providing one or more references to information associated with at least one Java method; and
wherein at least one reference of said one or more references is a reference to an exception handler associated with said at least one Java method.

### Claim 2 (depends on 1)

A Java computing environment as recited in claim 1 wherein said virtual machine operates to push said at least one Java method frame on said Java execution stack.

### Claim 3 (depends on 1)

A Java computing environment as recited in claim 1, wherein said virtual machine operates to identify said Java method frame when an exception is raised.

### Claim 4 (depends on 3)

A Java computing environment as recited in claim 3, wherein said virtual machine operates to use said at least one reference to access said exception handler.

### Claim 5 (depends on 4)

A Java computing environment as recited in claim 4, wherein said virtual machine operates to invoke said exception handler.

### Claim 6 (depends on 4)

A Java computing environment as recited in claim 4, wherein said virtual machine operates to invoke one or more exception handlers written in a native language, said native language being a programming language other than the Java programming language.

### Claim 7 (depends on 6)

A Java computing environment as recited in claim 6, wherein said programming language is the C or C++ programming language.

### Claim 8 (depends on 4)

A Java computing environment as recited in claim 4, wherein said exception handler is identified by said Java virtual machine without searching a native execution stack, said native execution stack being associated with a native language, said native language being a programming language other than the Java programming language.

### Claim 9 (depends on 1)

A Java computing environment as recited in claim 1, wherein said exception handler is identified by said Java virtual machine without searching a native execution stack, said native execution stack being associated with a native language, said native language being a programming language other than the Java programming language.

### Claim 10 (depends on 1)

A Java computing environment as recited in claim 1, wherein said virtual machine is operating in an embedded system.

### Claim 11

In a Java computing environment, a method of handling exceptions during execution of a Java program; said method comprising:
determining that an exception has occurred during the execution of said Java program;
identifying a frame for a Java method, said frame being stored on a Java execution stack when said determining determines that an exception has occurred, said Java method being associated with an exception handler suitable for handling said exception;
accessing a field within said frame; said frame providing a reference to said exception handler which is suitable for handling said exception; and
invoking said execution handler to handle said exception by using said reference.

### Claim 12 (depends on 11)

A method as recited in claim 11, wherein said identifying of a frame comprises:
determining whether the frame on top of the execution stack is the frame for said Java method which is associated with an exception handler suitable for handling said exception; and
popping said frame from the top of the execution stack when said determining determines that the frame on top of the execution stack is not the frame for said Java method which is associated with an exception handler.

### Claim 13 (depends on 11)

A method as recited in claim 11, wherein said identifying of a frame operates to find said frame from said Java method which is associated with an exception handler without searching a native execution stack, said native execution stack being associated with a native language, said native language being a programming language other than the Java programming language.

### Claim 14 (depends on 13)

A method as recited in claim 13, wherein said programming language is the C or C++ programming language.

### Claim 15 (depends on 11)

A method as recited in claim 11, wherein said method is performed by a Java virtual machine.

### Claim 16 (depends on 11)

A method as recited in claim 11, wherein said method is performed by a Java virtual machine operating in an embedded system.

### Claim 17

A computer readable media including computer program code for handling exceptions during execution of a Java program; said computer readable media comprising:
computer program code for determining that an exception has occurred during the execution of said Java program;
computer program code for identifying a frame for a Java method, said frame being stored on a Java execution stack when said determining determines that an exception has occurred, said Java method being associated with an exception handler suitable for handling said exception;
computer program code for accessing a field within said frame; said frame providing a reference to said exception handler which is suitable for handling said exception; and
computer program code for invoking said execution handler to handle said exception by using said reference.

### Claim 18 (depends on 17)

A computer readable media as recited in claim 17, wherein said programming language is the C or C++ programming language.

### Claim 19 (depends on 17)

A computer readable media as recited in claim 17, wherein said computer readable media is used by a Java virtual machine.

### Claim 20 (depends on 18)

A computer readable media as recited in claim 18, wherein said Java virtual machine operating in an embedded system.
