One embodiment of the present invention provides a system for efficient class
initialization barrier and access to class information private to a task that enables
sharing between multiple tasks/virtual machines of both interpreted platform-independent
code and the equivalent native code produced at runtime, wherein a class initialization
barrier guarantees that a task initializes a class before the class is first used
by the program executed by the task. The system operates by associating the shared
runtime representation of classes with tables of pointers to task class mirror
objects that hold the task private representation of a class. Entries of task class
mirror tables are used both as a mean to encode the initialization status of the
associated class for a plurality of tasks, and to provide access to the task private
representation of a class loaded by a task irrespectively of the initialization
state of the class for this task.