1. A method of generating code for function type calls in a runtime environment, comprising the steps of: providing a computer which includes a virtual machine for executing a software application thereon, a memory space configured for storing bytecode for the software application; wherein the bytecode includes callsites, and a bytecode-to-machine code compiler configured to optimize function reference invocations for use within the software application, including, during compilation of the bytecode and prior to execution of a particular callsite; acquiring a function reference that references a target function having a function type associated therewith; determining whether the function type associated with the target function is a function type that can be safely called from the particular callsite; and creating, upon determining that the function type associated with the target function can be safely called from the particular callsite, a function type carrier associated with the particular callsite via the bytecode-to-machine code compiler.