Browse Prior Art Database

Method for reducing memory usage by vtable sharing

IP.com Disclosure Number: IPCOM000007901D
Publication Date: 2002-May-02
Document File: 3 page(s) / 35K

Publishing Venue

The IP.com Prior Art Database

Abstract

Disclosed is a method for reducing memory usage by vtable sharing. Benefits include improved performance.

This text was extracted from a Microsoft Word document.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 50% of the total text.

Method for reducing memory usage by vtable sharing

Disclosed is a method for reducing memory usage by vtable sharing. Benefits include improved performance.

Background

              Many popular programming languages rely on an object-oriented (OO) type hierarchy. In a typical implementation of objects with an OO type hierarchy, processing overhead of one or two words per object occurs from the vtable pointer and, possibly, a header used for locks, hash code, or a forwarding pointer in a moving global catalog.

              For some operations, such as invokevirtual and instanceof, the object's vtable must be obtained. For example, assume that the reference is in register eax. The vtable pointer is required in ecx. The required result can be achieved conventionally in a very efficient code sequence using 32-bit architecture assembler syntax:  mov ecx, [eax].

              A typical program creates many small objects. For instance, applications typically contain many string-type objects that have three fields. In a conventional 32-bit implementation, the fields occupy 12 bytes in memory. Runtime typically adds two 4-byte fields (vtable and header). The combined size of the object is 20 bytes.

Description

              The disclosed method eliminates the vtable pointer for objects of popular types.

              For systems with a small amount of memory, speed may be traded for improved memory usage. Objects of popular types are allocated in the no-vtable heap (NVTH). Objects of unpopular types and large objects are allocated in the standard heap (SH). One way to find out which of the two heaps a reference belongs to is by analyzing the bit pattern of the reference. SH has higher addresses than NVTH. A constant heap boundary (HB) separates the two heaps.

              Other schemes for determining whether the pointer belongs to SH or NVTH may be used. For example, objects are allocated in the SH in the conventional way. NVTH memory is divided into consistently sized blocks that are aligned at boundaries that are a power of 2. All ob...