A method is provided that enables native code, dynamically compiled from platform-independent
code by one task of a multitasking virtual machine, to be used by other tasks.
The system interprets the platform-independent code of a method for a threshold
number of interpretations, and then produces class initialization dependent (CID)
native code. The runtime of the system guarantees that a task uses CID code of
a method only when all of the classes of an initialized set associated with the
CID code have been initialized by the task, and otherwise, interprets the platform-independent
code of the method. This allows the compiler to avoid generating class initialization
barriers for classes from the initialized set. After a threshold number of failures
to execute the CID code of a method, task re-entrant code is generated to replace
the interpretation of its platform-independent code.