# US 7,614,045 B2 · Sharing classes and class loaders

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

- Number: US 7,614,045 B2
- Document ID: US7614045B2
- Status: Granted
- Kind: B2
- Application number: 10/949,936
- Filed: 2004-09-24
- Published: 2006-03-30
- Granted: 2009-11-03
- Earliest claimed: 2004-09-24
- Assignees: Sap SE
- Inventors: Norbert Kuck; Oliver Schmidt; Ralf Schmelter
- Web page: https://patentgrep.com/patent/US7614045B2

## CPC

- G06F 9/544: {Buffers; Shared memory; Pipes}
- G06F 9/44563: {Sharing}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Methods and apparatus, including computer systems and program products, for sharing classes and class loaders. One implementation provides a technique for performing a shared load procedure for a class, performing a post load procedure for the class, performing a shared link procedure for the class, performing a post link procedure for the class, and performing an initialization procedure for the class to reduce memory consumption and class loading time. Through performance of these procedures, a first portion of the class (which may include a class block and object) is loaded into a shared memory accessible by multiple runtime systems, and a second portion of the class (which may include a class static variable) as is stored in a local memory associated with a selected runtime system. A shared master copy of the second portion of the class is also stored in the shared memory.

## Claims

### Claim 1

A computer-readable storage medium comprising instructions which, when executed, cause a machine to:
create a shared loader accessible by a plurality of runtime systems in a shared memory, the shared loader to have a runtime representation of a class loaded in the shared memory to allow the class to be used by the plurality of runtime systems, wherein access to the shared loader by the plurality of runtime systems is restricted to receive a set of parameters providing a declarative description of the shared class loader via a declarative interface; and return a reference to the shared class loader, the declarative interface to further
prevent each of the plurality of runtime systems from using their own shared loader or from specifying an application code to be used in the shared loader, and
guarantee the class is loaded consistently in each of the plurality of runtime systems; and
invoke the shared loader to load executable code to be shared by the runtime systems, the executable code to include a shared portion and a local portion wherein
the shared portion of the executable code is stored in the shared memory, and
the local portion of the executable code is stored in a local memory of a runtime system invoking the shared load.

### Claim 2 (depends on 1)

The computer-readable storage medium of claim 1, wherein the instructions which, when executed, further cause the machine to invoke a shared loader service with a declarative description of the shared loader.

### Claim 3 (depends on 1)

The computer-readable storage medium of claim 1, wherein the executable code to be shared comprises a system code or the application code.

### Claim 4 (depends on 1)

The computer-readable storage medium of claim 1, wherein the runtime systems comprise one or more of Java virtual machines and Common Language Runtime (CLR) virtual machines.

### Claim 5 (depends on 1)

The computer-readable storage medium of claim 1, wherein the executable code comprises a class.

### Claim 6 (depends on 5)

The computer-readable storage medium of claim 5, further comprising the instructions which, when executed, further cause the machine to create a shared closure in the shared memory, the shared closure comprising:
a first object and a transitive closure of additional objects referenced by the first object, wherein at least one of the objects is an instance of the class being shared by the runtime systems; and
the shared portion of the class being shared by the runtime systems.

### Claim 7 (depends on 1)

The computer-readable storage medium of claim 1, wherein the shared portion of the executable code in the shared memory includes generated machine code.

### Claim 8 (depends on 7)

The computer-readable storage medium of claim 7, wherein the generated machine code comprises platform-specific machine code generated by a compiler.

### Claim 9

A method comprising:
creating a shared loader accessible by a plurality of runtime systems in a shared memory, the shared loader to have a runtime representation of a class loaded in the shared memory to allow the class to be used by the plurality of runtime systems, wherein access to the shared loader by the plurality of runtime systems is restricted to receive a set of parameters providing a declarative description of the shared class loader via a declarative interface; and return a reference to the shared class loader, the declarative interface to further
prevent each of the plurality of runtime systems from using their own shared loader or from specifying an application code to be used in the shared loader, and
guarantee the class is loaded consistently in each of the plurality of runtime systems; and
invoking the shared loader to load executable code to be shared by the runtime systems, the executable code to include a shared portion and a local portion wherein
the shared portion of the executable code is stored in the shared memory, and
the local portion of the executable code is stored in a local memory of a runtime system invoking the shared load.

### Claim 10 (depends on 9)

The method of claim 9, further comprising invoking a shared loader service with a declarative description of the shared loader.

### Claim 11 (depends on 9)

The method of claim 9, wherein the executable code to be shared comprises a system code or the application code.

### Claim 12 (depends on 9)

The method of claim 9, wherein the runtime systems comprise one or more of Java virtual machines and Common Language Runtime (CLR) virtual machines.

### Claim 13 (depends on 9)

The method of claim 9, wherein the executable code comprises a class.

### Claim 14 (depends on 9)

The method of claim 9, further comprising creating a shared closure in the shared memory, the shared closure comprising:
a first object and a transitive closure of additional objects referenced by the first object, wherein at least one of the objects is an instance of the class being shared by the runtime systems; and
the shared portion of the class being shared by the runtime systems.

### Claim 15 (depends on 9)

The method of claim 9, wherein the shared portion of the executable code in the shared memory includes generated machine code.

### Claim 16 (depends on 9)

The method of claim 9, wherein the generated machine code comprises platform-specific machine code generated by a compiler.

### Claim 17

A system comprising:
a server having a processing and a memory coupled to the processor, the memory having a shared memory, the server to:
create a shared loader accessible by a plurality of runtime systems in a shared memory, the shared loader to have a runtime representation of a class loaded in the shared memory to allow the class to be used by the plurality of runtime systems, wherein access to the shared loader by the plurality of runtime systems is restricted to receive a set of parameters providing a declarative description of the shared class loader via a declarative interface, and return a reference to the shared class loader, the declarative interface to further
prevent each of the plurality of runtime systems from using their own shared loader or from specifying an application code to be used in the shared loader, and
guarantee the class is loaded consistently in each of the plurality of runtime systems, and
invoke the shared loader to load executable code to be shared by the runtime systems, the executable code to include a shared portion and a local portion wherein the shared portion of the executable code is stored in the shared memory, and the local portion of the executable code is stored in a local memory of a runtime system invoking the shared load.

### Claim 18 (depends on 17)

The system of claim 17, wherein the server is further to invoke a shared loader service with a declarative description of the shared loader.

### Claim 19 (depends on 17)

The system of claim 17, wherein the executable code to be shared is a system code or the application code.

### Claim 20 (depends on 17)

The system of claim 17, wherein the runtime systems comprise one or more of Java virtual machines and Common Language Runtime (CLR) virtual machines.

### Claim 21 (depends on 17)

The system of claim 17, wherein the executable code comprises a class.

### Claim 22 (depends on 17)

The system of claim 17, wherein the sever is further to create a shared closure in the shared memory, the shared closure comprising:
a first object and a transitive closure of additional objects referenced by the first object, wherein at least one of the objects is an instance of the class being shared by the runtime systems; and
the shared portion of the class being shared by the runtime systems.

### Claim 23 (depends on 17)

The system of claim 17, wherein the shared portion of the executable code in the shared memory includes generated machine code.

### Claim 24 (depends on 17)

The system of claim 17, wherein the generated machine code comprises platform-specific machine code generated by a compiler.
