# US 2022/0283785 A1 · Bytecode verification using class relationship caching

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

- Number: US 2022/0283785 A1
- Document ID: US20220283785A1
- Status: Published application
- Kind: A1
- Application number: 17/826,526
- Filed: 2022-05-27
- Published: 2022-09-08
- Earliest claimed: 2019-11-25
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Sharon WANG; Daniel HEIDINGA; Hang SHAO; Oluwatobi AJILA; Graham CHAPMAN
- Web page: https://patentgrep.com/patent/US20220283785A1

## CPC

- G06F 8/33: Intelligent editors
- G06F 8/315: {Object-oriented languages}
- G06F 8/41: Compilation
- G06F 9/44589: {Program code verification, e.g. Java bytecode verification, proof-carrying code (high-level semantic checks G06F8/43; prevention of errors by analysis, debugging or testing of software G06F11/36)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A computer-implemented method for bytecode class verification includes: encountering a class requiring verification of its bytecode during a run of an application; determining whether class relationship data for the class exists in a shared classes cache; in response to a determination that the class relationship data for the class does not exist in the shared classes cache: performing a linear bytecode walk of the bytecode to identify relationship data for the class and verify that the bytecode is well-formed; and storing the identified relationship data as the class relationship data for the class in the shared classes cache; in response to a determination that the class relationship data for the class does exist in the shared classes cache: retrieving the class relationship data for the class from the shared classes cache; and processing the class relationship data.

## Claims

### Claim 1

A method comprising:
in response to a determination that class relationship data for a class does not exist in a shared classes cache during bytecode class verification, identifying and storing relationship data as the class relationship data for the class in the shared classes cache;
in response to a determination that the class relationship data for the class does exist in the shared classes cache: retrieving the class relationship data for the class from the shared classes cache; and processing the class relationship data,
wherein the class relationship data comprises at least one relationship snippet that defines a relationship between a source class and a target class, and
the processing comprises determining whether the source class and the target class are both loaded.

### Claim 2 (depends on 1)

The method of claim 1, wherein the identifying comprises performing a linear bytecode walk during a first run of an application.

### Claim 3 (depends on 2)

The method of claim 2, further comprising preventing another linear bytecode walk during a subsequent run of the application.

### Claim 4 (depends on 2)

The method of claim 2, wherein the application comprises an object-oriented programming application.

### Claim 5 (depends on 2)

The method of claim 2, further comprising compiling source code of the application into bytecode used in the linear bytecode walk.

### Claim 6 (depends on 1)

The method of claim 1, wherein the processing comprises:
validating a class relationship between the source class and the target class in response to determining that the source class and the target class are both loaded; and
registering a class relationship between the source class and the target class in response to determining that the source class and the target class are not both loaded.

### Claim 7 (depends on 6)

The method of claim 6, wherein the registering comprises recording the class relationship in a class relationship table of a class loader without loading the one or more of the source class and the target class that are not loaded.

### Claim 8

A computer program product comprising one or more computer readable storage media, and program instructions collectively stored on the one or more computer readable storage media, the program instructions executable to:
in response to a determination that class relationship data for a class does not exist in a shared classes cache during bytecode class verification, identify and store relationship data as the class relationship data for the class in the shared classes cache;
in response to a determination that the class relationship data for the class does exist in the shared classes cache: retrieve the class relationship data for the class from the shared classes cache; and process the class relationship data,
wherein the class relationship data comprises at least one relationship snippet that defines a relationship between a source class and a target class, and
the processing comprises determining whether the source class and the target class are both loaded.

### Claim 9 (depends on 8)

The computer program product of claim 8, wherein the identifying comprises performing a linear bytecode walk during a first run of an application.

### Claim 10 (depends on 9)

The computer program product of claim 9, further comprising preventing another linear bytecode walk during a subsequent run of the application.

### Claim 11 (depends on 9)

The computer program product of claim 9, wherein the application comprises an object-oriented programming application.

### Claim 12 (depends on 9)

The computer program product of claim 9, the program instructions are executable to compile source code of the application into bytecode used in the linear bytecode walk.

### Claim 13 (depends on 8)

The computer program product of claim 8, wherein the processing comprises:
validating a class relationship between the source class and the target class in response to determining that the source class and the target class are both loaded; and
registering a class relationship between the source class and the target class in response to determining that the source class and the target class are not both loaded.

### Claim 14 (depends on 13)

The computer program product of claim 13, wherein the registering comprises recording the class relationship in a class relationship table of a class loader without loading the one or more of the source class and the target class that are not loaded.

### Claim 15

A system comprising:
a processor, a computer readable memory, one or more computer readable storage media, and program instructions collectively stored on the one or more computer readable storage media, the program instructions executable by the processor to:
in response to a determination that class relationship data for a class does not exist in a shared classes cache during bytecode class verification, identify and store relationship data as the class relationship data for the class in the shared classes cache;
in response to a determination that the class relationship data for the class does exist in the shared classes cache: retrieve the class relationship data for the class from the shared classes cache; and process the class relationship data,
wherein the class relationship data comprises at least one relationship snippet that defines a relationship between a source class and a target class, and
the processing comprises determining whether the source class and the target class are both loaded.

### Claim 16 (depends on 15)

The system of claim 15, wherein the identifying comprises performing a linear bytecode walk during a first run of an application.

### Claim 17 (depends on 16)

The system of claim 16, further comprising preventing another linear bytecode walk during a subsequent run of the application.

### Claim 18 (depends on 16)

The system of claim 16, wherein the application comprises an object-oriented programming application.

### Claim 19 (depends on 16)

The system of claim 16, the program instructions are executable to compile source code of the application into bytecode used in the linear bytecode walk.

### Claim 20 (depends on 15)

The system of claim 15, wherein the processing comprises:
validating a class relationship between the source class and the target class in response to determining that the source class and the target class are both loaded; and
registering a class relationship between the source class and the target class in response to determining that the source class and the target class are not both loaded.
