1. A method to facilitate sharing of dynamically compiled native code among multiple tasks of a multitasking virtual machine, comprising: upon invocation by a task among multiple tasks of a program method not associated with native code, executing a platform-independent code of the program method, wherein the platform-independent code is shared among multiple tasks, and wherein an interpreter is re-entrant so that the task can use the interpreter to execute the platform independent code; and compiling the platform-independent code to one of a task re-entrant native code and a class initialization dependent native code after a first threshold number of executions of the platform-independent code, wherein a native code is shared among multiple tasks, wherein the task re-entrant native code includes a task re-entrant class initialization barrier where a class may be used for a first time by the task, and wherein the class initialization dependent native code includes the task re-entrant class initialization barrier where the class that does not belong to an initialized set associated with the native code may be used for the first time by the task.