# US 2006/0070051 A1 · 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 2006/0070051 A1
- Document ID: US20060070051A1
- Status: Published application
- Kind: A1
- Application number: 10/949,936
- Filed: 2004-09-24
- Published: 2006-03-30
- Earliest claimed: 2004-09-24
- Assignees: Sap SE
- Inventors: Norbert Kuck; Oliver Schmidt; Ralf Schmelter
- Web page: https://patentgrep.com/patent/US20060070051A1

## 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 program product, tangibly embodied in an information carrier, the computer program product comprising instructions operable to cause data processing apparatus to:
perform a shared load procedure for executable code, the executable code comprising a first portion and a second portion, the shared load procedure comprising an operation to load the first portion of the executable code into a shared memory, the shared memory being accessible by multiple runtime systems, each of the runtime systems having an associated local memory;
perform a post load procedure for the executable code, the post load procedure comprising an operation to allocate space for the second portion of the executable code in the local memory associated with a selected runtime system from the multiple runtime systems;
perform a shared link procedure for the executable code, the shared link procedure comprising an operation to initialize a shared master copy of the second portion of the executable code in the shared memory;
perform a post link procedure for the executable code, the post link procedure comprising an operation to copy the master copy of the second portion of the executable code into the local memory associated with the selected runtime system; and
perform an initialization procedure for the executable code.

### Claim 2 (depends on 1)

The computer program product of claim 1, wherein the first portion of the executable code that is loaded into the shared memory includes a code source.

### Claim 3 (depends on 2)

The computer program product of claim 2, wherein the code source includes a digital certificate that has been attached to the executable code.

### Claim 4 (depends on 1)

The computer program product of claim 1, wherein the executable code comprises a class.

### Claim 5 (depends on 4)

The computer program product of claim 4, wherein:
the first portion of the class comprises a class block and a class object;
the second portion of the class comprises local class data; and
the operation to load the first portion of the class into the shared memory comprises operations to:
create the class block and the class object; and
store the class block and the class object in the shared memory.

### Claim 6 (depends on 5)

The computer program product of claim 5, wherein the local class data comprises static variables associated with the class.

### Claim 7 (depends on 6)

The computer program product of claim 6, wherein the local class data further comprises a protection domain associated with the class, the protection domain describing security attributes or permissions of the class.

### Claim 8 (depends on 5)

The computer program product of claim 5, wherein:
the shared memory comprises a shared lookup table;
the shared load procedure further comprises an operation to store the class block in the shared lookup table;
the local memory associated with the selected runtime system comprises a local cache; and
the post load procedure further comprises an operation to store the second portion of the class in the local cache.

### Claim 9 (depends on 4)

The computer program product of claim 4, wherein:
the class is derived from one or more superclasses;
the class implements one or more superinterfaces;
a first state and a second state are associated with the class, the first state representing a shared status of the class, the second state representing a local status of the class in the selected runtime system; and further wherein:
the shared load procedure further comprises operations to:
perform the shared load procedure for all the superclasses and the superinterfacess of the class; and
set the first state of the class to show that the class has been loaded in the shared memory;
the post load procedure further comprises operations to:
ensure that the first state of the class shows that the class has at least been loaded in the shared memory;
perform the post load procedure for all the superclasses and the superinterfaces of the class; and
set the second state of the class to show that the post load procedure has been completed for the class;
the shared link procedure further comprises operations to:
ensure that the first state of the class shows that the class has at least been loaded in the shared memory;
transform one or more string constants used by the class into shared interned strings;
perform the shared link procedure for all the superclasses and the superinterfaces of the class; and
set the first state of the class to show that the class has been linked in the shared memory;
the post link procedure further comprises operations to:
ensure that the first state of the class shows that the class has at least been linked in the shared memory;
perform the post link procedure for all the superclasses and the superinterfaces of the class; and
set the second state of the class to show that the post link procedure has been completed for the class; and
the initialization procedure comprises operations to:
ensure that the second state of the class shows that the post link procedure has been completed for the class;
determine whether the class has any class initializers;
if the class has any class initializers, invoke the class initializers; and
perform the initialization procedure for all the superclasses of the class.

### Claim 10 (depends on 1)

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

### Claim 11

A computer-implemented method comprising:
performing a shared load procedure for executable code, the executable code comprising a first portion and a second portion, the shared load procedure comprising an operation to load the first portion of the executable code into a shared memory, the shared memory being accessible by multiple runtime systems, each of the runtime systems having an associated local memory;
performing a post load procedure for the executable code, the post load procedure comprising an operation to allocate space for the second portion of the executable code in the local memory associated with a selected runtime system from the multiple runtime systems;
performing a shared link procedure for the executable code, the shared link procedure comprising an operation to initialize a shared master copy of the second portion of the executable code in the shared memory;
performing a post link procedure for the executable code, the post link procedure comprising an operation to copy the master copy of the second portion of the executable code into the local memory associated with the selected runtime system; and
performing an initialization procedure for the executable code.

### Claim 12

An apparatus comprising:
means for performing a shared load procedure for executable code, the executable code comprising a first portion and a second portion, the shared load procedure comprising an operation to load the first portion of the executable code into a shared memory, the shared memory being accessible by multiple runtime systems, each of the runtime systems having an associated local memory;
means for performing a post load procedure for the executable code, the post load procedure comprising an operation to allocate space for the second portion of the executable code in the local memory associated with a selected runtime system from the multiple runtime systems;
means for performing a shared link procedure for the executable code, the shared link procedure comprising an operation to initialize a shared master copy of the second portion of the executable code in the shared memory;
means for performing a post link procedure for the executable code, the post link procedure comprising an operation to copy the master copy of the second portion of the executable code into the local memory associated with the selected runtime system; and
means for performing an initialization procedure for the executable code.

### Claim 13

A computer program product, tangibly embodied in an information carrier, the computer program product comprising instructions operable to cause data processing apparatus to:
create a shared loader in a shared memory, the shared loader being accessible by multiple runtime systems, each of the runtime systems having an associated local memory; and
invoke the shared loader to load executable code to be shared by the runtime systems, wherein the shared loader is operable to load the executable code to be shared by storing a shared portion of the executable code in the shared memory and storing a local portion of the executable code in the local memory of each of the runtime systems that invokes the shared loader to load the executable code.

### Claim 14 (depends on 13)

The computer program product of claim 13, wherein the instructions to create the shared loader comprise instructions to invoke a shared loader service with a declarative description of the shared loader.

### Claim 15 (depends on 13)

The computer program product of claim 13, wherein the executable code to be shared is system code or application code.

### Claim 16 (depends on 13)

The computer program product of claim 13, wherein the runtime systems comprise one or more of Java virtual machines and Common Language Runtime (CLR) virtual machines.

### Claim 17 (depends on 13)

The computer program product of claim 13, wherein the executable code comprises a class.

### Claim 18 (depends on 17)

The computer program product of claim 17, further comprising instructions operable to cause the data processing apparatus 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 19 (depends on 13)

The computer program product of claim 13, wherein the shared portion of the executable code in the shared memory includes generated machine code.

### Claim 20 (depends on 19)

The computer program product of claim 19, wherein the generated machine code comprises platform-specific machine code generated by a compiler.

### Claim 21

A computer-implemented method comprising:
creating a shared loader in a shared memory, the shared loader being accessible by multiple runtime systems, each of the runtime systems having an associated local memory; and
invoking the shared loader to load executable code to be shared by the runtime systems, wherein the shared loader is operable to load the executable code to be shared by storing a shared portion of the executable code in the shared memory and storing a local portion of the executable code in the local memory of each of the runtime systems that invokes the shared loader to load the executable code.

### Claim 22

An apparatus comprising:
means for creating a shared loader in a shared memory, the shared loader being accessible by multiple runtime systems, each of the runtime systems having an associated local memory; and
means for invoking the shared loader to load executable code to be shared by the runtime systems, wherein the shared loader is operable to load the executable code to be shared by storing a shared portion of the executable code in the shared memory and storing a local portion of the executable code in the local memory of each of the runtime systems that invokes the shared loader to load the executable code.
