Patent ID: 7246141

Claim:
A method that facilitates skewing a bi-directional object layout to provide good cache behavior, comprising: receiving a request to access an object; wherein the request includes an object identifier and an object offset that specifies an offset of a target field within the object; wherein the object has a bi-directional layout that locates scalar fields at positive offsets and reference fields at negative offsets, so that a reference field can be immediately identified from its object offset; determining a skew value for a cache line containing the object, wherein the skew value is determined from a total amount of space within the object dedicated to at least one of reference fields and scalar fields; wherein data within the cache line is shifted based upon the skew value, wherein shifting based on the skew value allows the object to be accommodated in the minimum possible number of cache lines, so that reference fields with small negative offsets are located in the same cache line as scalar fields with small positive offsets; and using the skew value to access the object.