A system for generating machine code from byte code in virtual machines, comprising: a computer including a virtual machine running thereon, for executing a software application, and further including a memory space or storage medium for storing byte code as part of the software application; and a compiler, further comprising an object dematerializer that generates machine code that initializes fields of a dematerialized object to create a first code path, wherein object dematerialization puts the used fields of a locally-allocated object into registers or on the stack instead of allocating the complete object; a dematerializer injector that injects dematerialization code, by receiving a normal object reference, wherein the normal object reference comprises the return value from a call or an argument to a current function, and transforming a code path with the normal object reference into a second code path using dematerialized object fields; and wherein the compiler then joins the first and second code paths together into a resultant code path that continues to use the dematerialized object; wherein one or more indirect null checks are used to preserve application behavior on null pointer exceptions, wherein the indirect null checks are implemented using nullness communicator variables, and wherein a nullness communicator variable is used to indicate if an object was null without actually needing to store the object itself. a computer including a virtual machine running thereon, for executing a software application, and further including a memory space or storage medium for storing byte code as part of the software application; and a compiler, further comprising an object dematerializer that generates machine code that initializes fields of a dematerialized object to create a first code path, wherein object dematerialization puts the used fields of a locally-allocated object into registers or on the stack instead of allocating the complete object; a dematerializer injector that injects dematerialization code, by receiving a normal object reference, wherein the normal object reference comprises the return value from a call or an argument to a current function, and transforming a code path with the normal object reference into a second code path using dematerialized object fields; and an object dematerializer that generates machine code that initializes fields of a dematerialized object to create a first code path, wherein object dematerialization puts the used fields of a locally-allocated object into registers or on the stack instead of allocating the complete object; a dematerializer injector that injects dematerialization code, by receiving a normal object reference, wherein the normal object reference comprises the return value from a call or an argument to a current function, and transforming a code path with the normal object reference into a second code path using dematerialized object fields; and wherein the compiler then joins the first and second code paths together into a resultant code path that continues to use the dematerialized object; wherein one or more indirect null checks are used to preserve application behavior on null pointer exceptions, wherein the indirect null checks are implemented using nullness communicator variables, and wherein a nullness communicator variable is used to indicate if an object was null without actually needing to store the object itself.