The invention describes a method an apparatus to minimize the costs
introduced in the native code of a method M in order to make it
executable (concurrently or serially) by multiple tasks, wherein M's
native code is produced by the dynamic compiler of a multitasking virtual
machine. One embodiment of the present invention describes a mechanism
that annotates the shared runtime representation of classes with
information that identifies the particular event that triggered the
initialization of these classes, and in particular, if that event is the
execution of class initialization barrier from a method of another class.
These annotations are then used during each dynamic compilation of a
method M of a class C to determine when native code corresponding to a
class initialization barrier needs to be generated in the task re-entrant
native code produced by the dynamic compiler for M.