1. A method for execution by a processor in a computer system, the method comprising: identifying a first class of a plurality of classes, wherein an instance of the first class comprises a first plurality of data fields; identifying a second class of the plurality of classes, wherein an instance of the second class comprises a second plurality of data fields, and wherein the first plurality of data fields includes a data field that references the second class; in response to determining that the first class is immutable and the second class is immutable, constructing a first synthetic immutable class, an instance of which comprises a combination of the first plurality of data fields and the second plurality of data fields; and creating an instance of the first synthetic immutable class in which the first plurality of data fields and the second plurality of data fields occupy a contiguous region of memory; wherein identifying the first class, identifying the second class, determining that the first class is immutable, determining that the second class is immutable, and constructing the first synthetic immutable class comprises using at least one of a static compiler at compile time or a virtual machine at run time.